use of io.crate.sql.tree.LongLiteral in project crate by crate.
the class AstBuilder method visitMaybeParametrizedDataType.
@Override
public Node visitMaybeParametrizedDataType(SqlBaseParser.MaybeParametrizedDataTypeContext context) {
StringLiteral name = (StringLiteral) visit(context.baseDataType());
var parameters = new ArrayList<Integer>(context.integerLiteral().size());
for (var param : context.integerLiteral()) {
var literal = visit(param);
int val;
if (literal instanceof LongLiteral) {
val = Math.toIntExact(((LongLiteral) literal).getValue());
} else {
val = ((IntegerLiteral) literal).getValue();
}
parameters.add(val);
}
return new ColumnType<>(name.getValue(), parameters);
}
Aggregations