Skip to content

Commit

Permalink
Fix client.Get when policy.FilterExpression and bin names are both pr…
Browse files Browse the repository at this point in the history
…ovided
  • Loading branch information
khaf committed Jun 7, 2022
1 parent 9c0665a commit 09c3eb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion command.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,13 @@ func (cmd *baseCommand) setRead(policy *BasePolicy, key *Key, binNames []string)

predSize := 0
if policy.FilterExpression != nil {
if err := cmd.writeFilterExpression(policy.FilterExpression, predSize); err != nil {
predSize, err = cmd.estimateExpressionSize(policy.FilterExpression)
if err != nil {
return err
}
if predSize > 0 {
fieldCount++
}
} else if len(policy.PredExp) > 0 {
predSize = cmd.estimatePredExpSize(policy.PredExp)
fieldCount++
Expand Down
2 changes: 1 addition & 1 deletion expression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ var _ = gg.Describe("Expression Filters", func() {
as.ExpIntBin("bin"),
as.ExpIntVal(35),
)
_, err = client.Get(rpolicy, key)
_, err = client.Get(rpolicy, key, "bin")
gm.Expect(err).ToNot(gm.HaveOccurred())

})
Expand Down

0 comments on commit 09c3eb9

Please sign in to comment.