Skip to content

lucene: DynamoDB scalar grouped values are stringified into nonsense PartiQL #227

Description

@Lutherwaves

Found during the final review of #224 and deliberately left out of that PR's scope.

Problem

In the DynamoDB PartiQL driver, a grouped value expression on a scalar field is handed to the upstream go-lucene base driver, which stringifies the sub-expression rather than expanding it:

title:(hello* OR world)  ->  "title" = (? OR ("id" = ?))

That is not a valid predicate — it references the default field id, and the parenthesised sub-expression is rendered as a value. It matches nothing and returns no error.

Relationship to #224

The PR for #224 fixed the array twin of this bug (tags:(golang OR rust) was rendering contains(tags, ?) bound to the literal string "id:golang OR id:rust"), by expanding grouped values in the DynamoDB driver for array fields. The scalar path was left untouched because it is pre-existing and outside that PR's scope.

The SQL driver handles both correctly via renderGroupedFieldExpr / renderGroupedFieldLeaf.

Suggested fix

Give the DynamoDB driver the same grouped-value expansion for scalar fields that it now has for array fields, re-rendering each leaf against the outer field.

Note

Verified by driving real queries through Parser.ParseToDynamoDBPartiQL, not hand-built ASTs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions