Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CQL JSON: "not equal" binary comparison not available #607

Closed
constantinius opened this issue Jul 10, 2021 · 5 comments · Fixed by #610
Closed

CQL JSON: "not equal" binary comparison not available #607

constantinius opened this issue Jul 10, 2021 · 5 comments · Fixed by #610

Comments

@constantinius
Copy link
Contributor

constantinius commented Jul 10, 2021

The not equal predicate is available for CQL Text in the BNF

...

comparisonOperator = eq | neq | lt | gt | lteq | gteq;

neq = lt gt;

...

but not for CQL JSON encoding:

// ...

    "binaryComparisonPredicate": {
         "oneOf": [
            { "$ref": "#/$defs/eqExpression" },
            { "$ref": "#/$defs/ltExpression" },
            { "$ref": "#/$defs/gtExpression" },
            { "$ref": "#/$defs/lteExpression" },
            { "$ref": "#/$defs/gteExpression" }
         ]
      },

// ...

I understand that you could always do a not with an eq inside, but this is needlessly complex and the same would be true for CQL Text. So this property <> 123 could be written as NOT property = 123

My suggestion would be to add an neExpression (or neqExpression) and add it as a possibility to the binaryComparisonPredicate.

@constantinius
Copy link
Contributor Author

Suggested changes:

// ...

    "binaryComparisonPredicate": {
         "oneOf": [
            { "$ref": "#/$defs/eqExpression" },
            { "$ref": "#/$defs/ltExpression" },
            { "$ref": "#/$defs/gtExpression" },
            { "$ref": "#/$defs/lteExpression" },
            { "$ref": "#/$defs/gteExpression" }
         ]
      },


      "eqExpression": {
         "type": "object",
         "required": ["eq"],
         "properties": {
            "eq": { "$ref": "#/$defs/scalarOperands" }
         }
      },

      "neExpression": {
         "type": "object",
         "required": ["ne"],
         "properties": {
            "ne": { "$ref": "#/$defs/scalarOperands" }
         }
      },

      "ltExpression": {
         "type": "object",
           "required": ["lt"],
           "properties": {
              "lt": { "$ref": "#/$defs/scalarOperands" }
         }
      },

      "gtExpression": {
         "type": "object",
         "required": ["gt"],
         "properties": {
            "gt": { "$ref": "#/$defs/scalarOperands" }
         }
      },

      "lteExpression": {
         "type": "object",
         "required": ["lte"],
         "properties": {
            "lte": { "$ref": "#/$defs/scalarOperands" }
         }
      },

      "gteExpression": {
         "type": "object",
         "required": ["gte"],
         "properties": {
            "gte": { "$ref": "#/$defs/scalarOperands" }
         }
      },

// ...

@cportele
Copy link
Member

Thanks! Yes, this is an oversight and will be corrected as proposed.

@cportele cportele self-assigned this Jul 11, 2021
@pvretano
Copy link
Contributor

Already identified as a deficiency in issue #578.

@constantinius
Copy link
Contributor Author

Sorry, my bad. I did search for an existing issue, but that slipped through.

@pvretano
Copy link
Contributor

@constantinius LOL! Sorry I was just trying to link the two issues so that we keep track of the fact that fixing this issue will also resolve part of #578.

cportele added a commit that referenced this issue Jul 19, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
closes #607

adds "neq", but also see #578 for related comments/changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants