@Override public void exitGroupByClause(@NotNull GroupByClauseContext ctx) { String bucketType = ctx.ID().getText(); String timespan = ctx.TIMESPAN().getText(); long bucketSize = Long.parseLong(timespan.substring(0, timespan.length() - 1)); char unitId = timespan.charAt(timespan.length() - 1); InfluxTimeUnit bucketSizeUnit = InfluxTimeUnit.findById(String.valueOf(unitId)); if (bucketSizeUnit == null) { throw new RuntimeException("Unknown time unit: " + unitId); } definitionsBuilder.setGroupByClause(new GroupByClause(bucketType, bucketSize, bucketSizeUnit)); }
public SelectQueryDefinitions getSelectQueryDefinitions() { return definitionsBuilder.createSelectQueryDefinitions(); }
@Override public void exitLimitClause(@NotNull LimitClauseContext ctx) { int limit = Integer.parseInt(ctx.INT().getText()); definitionsBuilder.setLimitClause(new LimitClause(limit)); }
@Override public void exitOrderAsc(@NotNull OrderAscContext ctx) { definitionsBuilder.setOrderDesc(false); }
@Override public void exitWhereClause(@NotNull WhereClauseContext ctx) { definitionsBuilder.setWhereClause(booleanExpressionQueue.removeLast()); }
@Override public void exitFromClause(@NotNull FromClauseContext ctx) { definitionsBuilder.setFromClause(new FromClause(name, alias)); name = null; alias = null; }
@Override public void exitColumnDefinitionList(@NotNull ColumnDefinitionListContext ctx) { definitionsBuilder.setColumnDefinitions(columnDefinitions); }