Expression expression = node.accept(compiler); if (!expression.isStateless()) { if (compiler.isAggregate()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.AGGREGATE_IN_GROUP_BY) .setMessage(expression.toString()).build().buildException();
public static Expression compile(StatementContext context, SelectStatement statement, GroupBy groupBy) throws SQLException { ParseNode having = statement.getHaving(); if (having == null) { return null; } ExpressionCompiler expressionBuilder = new ExpressionCompiler(context, groupBy); Expression expression = having.accept(expressionBuilder); if (expression.getDataType() != PBoolean.INSTANCE) { throw TypeMismatchException.newException(PBoolean.INSTANCE, expression.getDataType(), expression.toString()); } if (LiteralExpression.isBooleanFalseOrNull(expression)) { context.setScanRanges(ScanRanges.NOTHING); return null; } else if (LiteralExpression.isTrue(expression)) { return null; } if (!expressionBuilder.isAggregate()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.ONLY_AGGREGATE_IN_HAVING_CLAUSE).build().buildException(); } return expression; }
expression = node.getNode().accept(compiler); if (!expression.isStateless() && !compiler.isAggregate()) { if (statement.isAggregate() || statement.isDistinct()) {
Expression expression = node.accept(compiler); if (!expression.isStateless()) { if (compiler.isAggregate()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.AGGREGATE_IN_GROUP_BY) .setMessage(expression.toString()).build().buildException();
Expression expression = node.accept(compiler); if (!expression.isStateless()) { if (compiler.isAggregate()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.AGGREGATE_IN_GROUP_BY) .setMessage(expression.toString()).build().buildException();
public static Expression compile(StatementContext context, SelectStatement statement, GroupBy groupBy) throws SQLException { ParseNode having = statement.getHaving(); if (having == null) { return null; } ExpressionCompiler expressionBuilder = new ExpressionCompiler(context, groupBy); Expression expression = having.accept(expressionBuilder); if (expression.getDataType() != PBoolean.INSTANCE) { throw TypeMismatchException.newException(PBoolean.INSTANCE, expression.getDataType(), expression.toString()); } if (LiteralExpression.isBooleanFalseOrNull(expression)) { context.setScanRanges(ScanRanges.NOTHING); return null; } else if (LiteralExpression.isTrue(expression)) { return null; } if (!expressionBuilder.isAggregate()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.ONLY_AGGREGATE_IN_HAVING_CLAUSE).build().buildException(); } return expression; }
public static Expression compile(StatementContext context, SelectStatement statement, GroupBy groupBy) throws SQLException { ParseNode having = statement.getHaving(); if (having == null) { return null; } ExpressionCompiler expressionBuilder = new ExpressionCompiler(context, groupBy); Expression expression = having.accept(expressionBuilder); if (expression.getDataType() != PBoolean.INSTANCE) { throw TypeMismatchException.newException(PBoolean.INSTANCE, expression.getDataType(), expression.toString()); } if (LiteralExpression.isBooleanFalseOrNull(expression)) { context.setScanRanges(ScanRanges.NOTHING); return null; } else if (LiteralExpression.isTrue(expression)) { return null; } if (!expressionBuilder.isAggregate()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.ONLY_AGGREGATE_IN_HAVING_CLAUSE).build().buildException(); } return expression; }
expression = node.getNode().accept(compiler); if (!expression.isStateless() && !compiler.isAggregate()) { if (statement.isAggregate() || statement.isDistinct()) {
expression = node.getNode().accept(compiler); if (!expression.isStateless() && !compiler.isAggregate()) { if (statement.isAggregate() || statement.isDistinct()) {