use of com.datastax.oss.dsbulk.generated.cql3.CqlParser.RelationTypeContext in project dsbulk by datastax.
the class QueryInspector method visitRelation.
// WHERE clause
@Override
@Nullable
public CQLFragment visitRelation(RelationContext ctx) {
// relation contains another relation: drill down
while (ctx.relation() != null) {
ctx = ctx.relation();
}
// myCol = :myVar or myCol = ?
if (ctx.getChildCount() == 3 && ctx.getChild(0) instanceof CidentContext && ctx.getChild(1) instanceof RelationTypeContext && ctx.getChild(2) instanceof TermContext && ctx.getChild(1).getText().equals("=")) {
CQLWord column = visitCident(ctx.cident());
if (column.equals(SOLR_QUERY)) {
hasSearchClause = true;
}
CQLFragment variable = visitTerm(ctx.term().get(0));
assignmentsBuilder.put(column, variable.equals(QUESTION_MARK) ? column : variable);
} else if (ctx.K_TOKEN() != null) {
CQLFragment variable = visitTerm(ctx.term().get(0));
if (variable instanceof CQLWord) {
if (variable == QUESTION_MARK) {
variable = INTERNAL_TOKEN_VARNAME;
}
if (ctx.relationType().getText().equals(">")) {
tokenRangeRestrictionStartVariable = (CQLWord) variable;
tokenRangeRestrictionStartVariableIndex = tokenRangeRestrictionVariableIndex++;
} else if (ctx.relationType().getText().equals("<=")) {
tokenRangeRestrictionEndVariable = (CQLWord) variable;
tokenRangeRestrictionEndVariableIndex = tokenRangeRestrictionVariableIndex++;
}
}
}
// other relation types: unsupported
return null;
}
Aggregations