Merge pull request #844 from nosqlbench/nosqlbench-843-cqlgen-mv

nosqlbench-843-cqlgen-mv
This commit is contained in:
Jonathan Shook 2022-12-12 14:19:30 -06:00 committed by GitHub
commit 875d0d9606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 4 deletions

View File

@ -21,6 +21,8 @@
* Project : cql-parser; an ANTLR4 grammar for Apache Cassandra CQL https://github.com/kdcro101cql-parser
*/
// TODO: Add support for
// CREATE CUSTOM INDEX idxname ON ksname.tbname (fieldname) USING 'StorageAttachedIndex';
parser grammar CqlParser;
options

View File

@ -175,7 +175,11 @@ public class CqlModelBuilder extends CqlParserBaseListener {
@Override
public void exitTableOptionItem(CqlParser.TableOptionItemContext ctx) {
if (table!=null) {
table.setCompactStorage(ctx.kwCompactStorage() != null);
} else {
logger.debug("table option item found with no table, this is likely for a materialized view");
}
}
@Override
@ -196,8 +200,12 @@ public class CqlModelBuilder extends CqlParserBaseListener {
.map(c -> c.getText())
.toList();
if (table!=null) {
IntStream.range(0, columns.size())
.forEach(i -> table.addTableClusteringOrder(columns.get(i), orders.get(i)));
} else {
logger.debug("clustering order found, but not active table. This is likely for a materialized view.");
}
}
private String textOf(ParserRuleContext ctx) {

View File

@ -13,11 +13,14 @@ bindings:
float: ToFloat();
map<text,timestamp>: MapSized(3,Combinations('A-Z;0-9', ToJavaInstant()));
frozen<list<int>>: ListSizedHashed(HashRange(3,7),ToInt()));
list<text>: ListStepped(ToString(),ToString())
list<text>: ListStepped(ToString(),ToString());
list<ascii>: ListStepped(ToString(),ToString())
map<text,text>: MapSized(3, Combinations('A-Z;0-9'), ToString(), ToString());
map<ascii,text>: MapSized(3, Combinations('A-Z;0-9'), ToString(), ToString());
map<int,int>: MapSized(3, ToInt(), ToInt());
counter: HashRange(1,3);
set<text>: SetSized(HashRange(3,4),ToString()));
set<ascii>: SetSized(HashRange(3,4),ToString()));
smallint: ToShort();
time: StartingEpochMillis('2022-01-01 00:00:00'); ToLocalTime();
timestamp: ToJavaInstant();