Skip to content

Commit

Permalink
ZDM-606: Support colon operator in fuzzy SAI queries
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-antoniak committed Jun 6, 2024
1 parent f893984 commit f8bbf19
Show file tree
Hide file tree
Showing 27 changed files with 2,172 additions and 1,824 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG/CHANGELOG-2.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

Changelog for the ZDM Proxy, new PRs should update the `unreleased` section.

When cutting a new release, update the `unreleased` heading to the tag being generated and date, like `## vX.Y.Z - YYYY-MM-DD` and create a new placeholder section for `unreleased` entries.

## Unreleased

* [#112](https://github.com/datastax/zdm-proxy/pull/112) [ZDM-606](https://datastax.jira.com/browse/ZDM-606): Support COLON operator in fuzzy SAI queries and logical OR clause

## v2.2.0 - YYYY-MM-DD

### New Features

### Improvements

### Bug Fixes
17 changes: 12 additions & 5 deletions antlr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

## How to generate the grammar files

First, install antlr 4.
1. Install ANTLR 4.
- On a Mac: `brew install antlr`.

On a Mac: `brew install antlr`.
2. Generate the Go files for the `SimplifiedCql` grammar:
```
antlr -Dlanguage=Go antlr/SimplifiedCql.g4
```
Second, generate the Go files for the `SimplifiedCql` grammar:

antlr -Dlanguage=Go antlr/SimplifiedCql.g4
Current ZDM code works with ANTLR 4.9.3, so if you have issues downloading it from system package managers you can:
1. Download JAR file from https://repo1.maven.org/maven2/org/antlr/antlr4/4.9.3
2. Generate Go files for simplified CQL grammar:
```
java -Xmx500M -cp ".:/path/to/antlr4-4.9.3-complete.jar" org.antlr.v4.Tool -Dlanguage=Go antlr/SimplifiedCql.g4
```
9 changes: 8 additions & 1 deletion antlr/SimplifiedCql.g4
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ condition

// Note: custom index expressions not supported
whereClause
: K_WHERE relation ( K_AND relation )*
: K_WHERE relation ( logicalOperator relation )*
;

logicalOperator
: K_AND
| K_OR
;

relation
Expand Down Expand Up @@ -211,6 +216,7 @@ operator
| '>'
| '>='
| '!='
| ':'
;

// CQL literals
Expand Down Expand Up @@ -492,6 +498,7 @@ K_MAP: M A P;
K_NAN: N A N;
K_NOT: N O T;
K_NULL: N U L L;
K_OR: O R;
K_ORDER: O R D E R;
K_PARTITION: P A R T I T I O N;
K_PER: P E R;
Expand Down
7 changes: 5 additions & 2 deletions antlr/SimplifiedCql.interp

Large diffs are not rendered by default.

91 changes: 46 additions & 45 deletions antlr/SimplifiedCql.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -65,46 +65,47 @@ K_MAP=64
K_NAN=65
K_NOT=66
K_NULL=67
K_ORDER=68
K_PARTITION=69
K_PER=70
K_SELECT=71
K_SET=72
K_SMALLINT=73
K_TEXT=74
K_TIMESTAMP=75
K_TIMEUUID=76
K_TIME=77
K_TINYINT=78
K_TOKEN=79
K_TTL=80
K_TUPLE=81
K_TYPE=82
K_UNLOGGED=83
K_UPDATE=84
K_USE=85
K_USING=86
K_UUID=87
K_VALUES=88
K_VARCHAR=89
K_VARINT=90
K_WHERE=91
K_WRITETIME=92
STRING_LITERAL=93
QUOTED_IDENTIFIER=94
INTEGER=95
QMARK=96
FLOAT=97
BOOLEAN=98
DURATION=99
UNQUOTED_IDENTIFIER=100
HEXNUMBER=101
UUID=102
WS=103
COMMENT=104
MULTILINE_COMMENT=105
EOS=106
OTHER=107
K_OR=68
K_ORDER=69
K_PARTITION=70
K_PER=71
K_SELECT=72
K_SET=73
K_SMALLINT=74
K_TEXT=75
K_TIMESTAMP=76
K_TIMEUUID=77
K_TIME=78
K_TINYINT=79
K_TOKEN=80
K_TTL=81
K_TUPLE=82
K_TYPE=83
K_UNLOGGED=84
K_UPDATE=85
K_USE=86
K_USING=87
K_UUID=88
K_VALUES=89
K_VARCHAR=90
K_VARINT=91
K_WHERE=92
K_WRITETIME=93
STRING_LITERAL=94
QUOTED_IDENTIFIER=95
INTEGER=96
QMARK=97
FLOAT=98
BOOLEAN=99
DURATION=100
UNQUOTED_IDENTIFIER=101
HEXNUMBER=102
UUID=103
WS=104
COMMENT=105
MULTILINE_COMMENT=106
EOS=107
OTHER=108
'('=1
')'=2
','=3
Expand All @@ -122,8 +123,8 @@ OTHER=107
'>'=15
'>='=16
'!='=17
'{'=18
'}'=19
':'=20
'?'=96
';'=106
':'=18
'{'=19
'}'=20
'?'=97
';'=107
7 changes: 5 additions & 2 deletions antlr/SimplifiedCqlLexer.interp

Large diffs are not rendered by default.

91 changes: 46 additions & 45 deletions antlr/SimplifiedCqlLexer.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -65,46 +65,47 @@ K_MAP=64
K_NAN=65
K_NOT=66
K_NULL=67
K_ORDER=68
K_PARTITION=69
K_PER=70
K_SELECT=71
K_SET=72
K_SMALLINT=73
K_TEXT=74
K_TIMESTAMP=75
K_TIMEUUID=76
K_TIME=77
K_TINYINT=78
K_TOKEN=79
K_TTL=80
K_TUPLE=81
K_TYPE=82
K_UNLOGGED=83
K_UPDATE=84
K_USE=85
K_USING=86
K_UUID=87
K_VALUES=88
K_VARCHAR=89
K_VARINT=90
K_WHERE=91
K_WRITETIME=92
STRING_LITERAL=93
QUOTED_IDENTIFIER=94
INTEGER=95
QMARK=96
FLOAT=97
BOOLEAN=98
DURATION=99
UNQUOTED_IDENTIFIER=100
HEXNUMBER=101
UUID=102
WS=103
COMMENT=104
MULTILINE_COMMENT=105
EOS=106
OTHER=107
K_OR=68
K_ORDER=69
K_PARTITION=70
K_PER=71
K_SELECT=72
K_SET=73
K_SMALLINT=74
K_TEXT=75
K_TIMESTAMP=76
K_TIMEUUID=77
K_TIME=78
K_TINYINT=79
K_TOKEN=80
K_TTL=81
K_TUPLE=82
K_TYPE=83
K_UNLOGGED=84
K_UPDATE=85
K_USE=86
K_USING=87
K_UUID=88
K_VALUES=89
K_VARCHAR=90
K_VARINT=91
K_WHERE=92
K_WRITETIME=93
STRING_LITERAL=94
QUOTED_IDENTIFIER=95
INTEGER=96
QMARK=97
FLOAT=98
BOOLEAN=99
DURATION=100
UNQUOTED_IDENTIFIER=101
HEXNUMBER=102
UUID=103
WS=104
COMMENT=105
MULTILINE_COMMENT=106
EOS=107
OTHER=108
'('=1
')'=2
','=3
Expand All @@ -122,8 +123,8 @@ OTHER=107
'>'=15
'>='=16
'!='=17
'{'=18
'}'=19
':'=20
'?'=96
';'=106
':'=18
'{'=19
'}'=20
'?'=97
';'=107
6 changes: 6 additions & 0 deletions antlr/simplifiedcql_base_listener.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f8bbf19

Please sign in to comment.