Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions client-java/controller/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@
<scope>provided</scope>
</dependency>

<!-- Needed for DynamoDb parsing, fixing version to latest one compatible with Java 8, don't upgrade to 4.10 -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
Comment thread
aschenzle marked this conversation as resolved.
<version>4.9.3</version>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand Down Expand Up @@ -204,10 +211,15 @@
<artifactId>lettuce-core</artifactId>
<scope>test</scope>
</dependency>
<!-- Bringing Netty dependency explicitly as it was excluded from spring-boot-starter-data-redis to avoid version conflict -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>netty-nio-client</artifactId>
<artifactId>dynamodb</artifactId>
<scope>test</scope>
</dependency>
<!-- Some third-party library we use in our test scaffolding might need SLF4j (i.e., Docker) -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Comment thread
aschenzle marked this conversation as resolved.
<scope>test</scope>
</dependency>

Expand All @@ -227,7 +239,6 @@
<artifactId>grpc-stub</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -265,6 +276,23 @@
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<!-- Needed for DynamoDB parsing -->
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
Comment thread
aschenzle marked this conversation as resolved.
<configuration>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you marked this as resolved, but i don't see any <version> declaration here. how come?

<listener>false</listener>
<visitor>true</visitor>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>

<!--
As this library is going to be used and imported by the SUTs,
need to shade its dependencies to avoid the "Jar Hell".
Expand Down Expand Up @@ -346,7 +374,12 @@
<pattern>net.sf.jsqlparser</pattern>
<shadedPattern>shaded.net.sf.jsqlparser</shadedPattern>
</relocation>
</relocations>
<!-- Needed for DynamoDb parsing -->
<relocation>
<pattern>org.antlr</pattern>
<shadedPattern>shaded.org.antlr</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
grammar DynamoDbConditionExpression;

expression
: orExpr EOF
;

orExpr
: andExpr (OR andExpr)*
;

andExpr
: notExpr (AND notExpr)*
;

notExpr
: NOT notExpr #negatedExpr
| primary #primaryExpr
;

primary
: LPAREN orExpr RPAREN #parenthesizedPrimary
| predicate #predicatePrimary
;

predicate
: ATTRIBUTE_EXISTS LPAREN path RPAREN #attributeExistsPredicate
| ATTRIBUTE_NOT_EXISTS LPAREN path RPAREN #attributeNotExistsPredicate
| ATTRIBUTE_TYPE LPAREN path COMMA value RPAREN #attributeTypePredicate
| BEGINS_WITH LPAREN path COMMA value RPAREN #beginsWithPredicate
| CONTAINS LPAREN path COMMA value RPAREN #containsPredicate
| SIZE LPAREN path RPAREN comparator value #sizePredicate
| path BETWEEN value AND value #betweenPredicate
| path IN LPAREN value (COMMA value)* RPAREN #inPredicate
| path comparator value #comparisonPredicate
;

comparator
: EQ
| NE
| LT
| LTE
| GT
| GTE
;

path
: IDENTIFIER
;

value
: PLACEHOLDER #placeholderValue
| STRING_LITERAL #stringValue
| NUMBER_LITERAL #numberValue
| BOOLEAN_LITERAL #booleanValue
| NULL_LITERAL #nullValue
| IDENTIFIER #identifierValue
;

LPAREN : '(';
RPAREN : ')';
COMMA : ',';
EQ : '=';
NE : '<>';
LTE : '<=';
GTE : '>=';
LT : '<';
GT : '>';

AND : A N D;
OR : O R;
NOT : N O T;
BETWEEN : B E T W E E N;
IN : I N;
ATTRIBUTE_EXISTS : A T T R I B U T E '_' E X I S T S;
ATTRIBUTE_NOT_EXISTS : A T T R I B U T E '_' N O T '_' E X I S T S;
ATTRIBUTE_TYPE : A T T R I B U T E '_' T Y P E;
BEGINS_WITH : B E G I N S '_' W I T H;
CONTAINS : C O N T A I N S;
SIZE : S I Z E;

BOOLEAN_LITERAL : T R U E | F A L S E;
NULL_LITERAL : N U L L;

PLACEHOLDER : ':' IDENT_START IDENT_PART*;
NUMBER_LITERAL : '-'? DIGIT+ ('.' DIGIT+)? EXPONENT?;
STRING_LITERAL : '\'' ~['\r\n]* '\'';

IDENTIFIER : IDENT_START IDENT_PART* INDEX* ('.' IDENT_START IDENT_PART* INDEX*)*;

WS : [ \t\r\n]+ -> skip;

fragment INDEX : '[' DIGIT+ ']';
fragment EXPONENT : [eE] [+\-]? DIGIT+;
fragment IDENT_START : [a-zA-Z_#];
fragment IDENT_PART : [a-zA-Z0-9_];
fragment DIGIT : [0-9];

fragment A : [aA];
fragment B : [bB];
fragment C : [cC];
fragment D : [dD];
fragment E : [eE];
fragment F : [fF];
fragment G : [gG];
fragment H : [hH];
fragment I : [iI];
fragment J : [jJ];
fragment K : [kK];
fragment L : [lL];
fragment M : [mM];
fragment N : [nN];
fragment O : [oO];
fragment P : [pP];
fragment Q : [qQ];
fragment R : [rR];
fragment S : [sS];
fragment T : [tT];
fragment U : [uU];
fragment V : [vV];
fragment W : [wW];
fragment X : [xX];
fragment Y : [yY];
fragment Z : [zZ];
Loading
Loading