private SqlKind getOp(RexCall call) { SqlKind op = call.getKind(); if (call.getKind().equals(SqlKind.OTHER_FUNCTION) && SqlTypeUtil.inBooleanFamily(call.getType())) { SqlOperator sqlOp = call.getOperator(); String opName = (sqlOp != null) ? sqlOp.getName() : ""; if (opName.equalsIgnoreCase("in")) { op = SqlKind.IN; } } return op; }
private SqlKind getOp(RexCall call) { SqlKind op = call.getKind(); if (call.getKind().equals(SqlKind.OTHER_FUNCTION) && SqlTypeUtil.inBooleanFamily(call.getType())) { SqlOperator sqlOp = call.getOperator(); String opName = (sqlOp != null) ? sqlOp.getName() : ""; if (opName.equalsIgnoreCase("in")) { op = SqlKind.IN; } } return op; }
protected void validateWhereOrOn( SqlValidatorScope scope, SqlNode condition, String clause) { validateNoAggs(aggOrOverOrGroupFinder, condition, clause); inferUnknownTypes( booleanType, scope, condition); condition.validate(this, scope); final RelDataType type = deriveType(scope, condition); if (!SqlTypeUtil.inBooleanFamily(type)) { throw newValidationError(condition, RESOURCE.condMustBeBoolean(clause)); } }
protected void validateHavingClause(SqlSelect select) { // HAVING is validated in the scope after groups have been created. // For example, in "SELECT empno FROM emp WHERE empno = 10 GROUP BY // deptno HAVING empno = 10", the reference to 'empno' in the HAVING // clause is illegal. SqlNode having = select.getHaving(); if (having == null) { return; } final AggregatingScope havingScope = (AggregatingScope) getSelectScope(select); if (getConformance().isHavingAlias()) { SqlNode newExpr = expandGroupByOrHavingExpr(having, havingScope, select, true); if (having != newExpr) { having = newExpr; select.setHaving(newExpr); } } havingScope.checkAggregateExpr(having, true); inferUnknownTypes( booleanType, havingScope, having); having.validate(this, havingScope); final RelDataType type = deriveType(havingScope, having); if (!SqlTypeUtil.inBooleanFamily(type)) { throw newValidationError(having, RESOURCE.havingMustBeBoolean()); } }
if (!SqlTypeUtil.inBooleanFamily(type)) { throw newValidationError(expand, RESOURCE.condMustBeBoolean("DEFINE"));
private boolean isBoolean(RexNode node) { RelDataType type = node.getType(); return SqlTypeUtil.inBooleanFamily(type); }
private boolean isBoolean(RexNode node) { RelDataType type = node.getType(); return SqlTypeUtil.inBooleanFamily(type); }
private SqlKind getOp(RexCall call) { SqlKind op = call.getKind(); if (call.getKind().equals(SqlKind.OTHER_FUNCTION) && SqlTypeUtil.inBooleanFamily(call.getType())) { SqlOperator sqlOp = call.getOperator(); String opName = (sqlOp != null) ? sqlOp.getName() : ""; if (opName.equalsIgnoreCase("in")) { op = SqlKind.IN; } } return op; } }
protected void validateWhereOrOn( SqlValidatorScope scope, SqlNode condition, String clause) { validateNoAggs(aggOrOverOrGroupFinder, condition, clause); inferUnknownTypes( booleanType, scope, condition); condition.validate(this, scope); final RelDataType type = deriveType(scope, condition); if (!SqlTypeUtil.inBooleanFamily(type)) { throw newValidationError(condition, RESOURCE.condMustBeBoolean(clause)); } }
protected void validateWhereOrOn( SqlValidatorScope scope, SqlNode condition, String clause) { validateNoAggs(aggOrOverOrGroupFinder, condition, clause); inferUnknownTypes( booleanType, scope, condition); condition.validate(this, scope); final RelDataType type = deriveType(scope, condition); if (!SqlTypeUtil.inBooleanFamily(type)) { throw newValidationError(condition, RESOURCE.condMustBeBoolean(clause)); } }
public void validateCall( SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { assert call.getOperator() == this; assert call.operandCount() == 2; SqlCall aggCall = call.operand(0); if (!aggCall.getOperator().isAggregator()) { throw validator.newValidationError(aggCall, RESOURCE.filterNonAggregate()); } final SqlNode condition = call.operand(1); validator.validateAggregateParams(aggCall, condition, scope); final RelDataType type = validator.deriveType(scope, condition); if (!SqlTypeUtil.inBooleanFamily(type)) { throw validator.newValidationError(condition, RESOURCE.condMustBeBoolean("FILTER")); } }
protected void validateHavingClause(SqlSelect select) { // HAVING is validated in the scope after groups have been created. // For example, in "SELECT empno FROM emp WHERE empno = 10 GROUP BY // deptno HAVING empno = 10", the reference to 'empno' in the HAVING // clause is illegal. SqlNode having = select.getHaving(); if (having == null) { return; } final AggregatingScope havingScope = (AggregatingScope) getSelectScope(select); if (getConformance().isHavingAlias()) { SqlNode newExpr = expandGroupByOrHavingExpr(having, havingScope, select, true); if (having != newExpr) { having = newExpr; select.setHaving(newExpr); } } havingScope.checkAggregateExpr(having, true); inferUnknownTypes( booleanType, havingScope, having); having.validate(this, havingScope); final RelDataType type = deriveType(havingScope, having); if (!SqlTypeUtil.inBooleanFamily(type)) { throw newValidationError(having, RESOURCE.havingMustBeBoolean()); } }
if (!SqlTypeUtil.inBooleanFamily(type)) { throw newValidationError(expand, RESOURCE.condMustBeBoolean("DEFINE"));
protected void validateHavingClause(SqlSelect select) { // HAVING is validated in the scope after groups have been created. // For example, in "SELECT empno FROM emp WHERE empno = 10 GROUP BY // deptno HAVING empno = 10", the reference to 'empno' in the HAVING // clause is illegal. SqlNode having = select.getHaving(); if (having == null) { return; } final AggregatingScope havingScope = (AggregatingScope) getSelectScope(select); if (getConformance().isHavingAlias()) { SqlNode newExpr = expandGroupByOrHavingExpr(having, havingScope, select, true); if (having != newExpr) { having = newExpr; select.setHaving(newExpr); } } havingScope.checkAggregateExpr(having, true); inferUnknownTypes( booleanType, havingScope, having); having.validate(this, havingScope); final RelDataType type = deriveType(havingScope, having); if (!SqlTypeUtil.inBooleanFamily(type)) { throw newValidationError(having, RESOURCE.havingMustBeBoolean()); } }
if (!SqlTypeUtil.inBooleanFamily(type)) { throw newValidationError(expand, RESOURCE.condMustBeBoolean("DEFINE"));
public void validateCall( SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { assert call.getOperator() == this; assert call.operandCount() == 2; SqlCall aggCall = getAggCall(call); if (!aggCall.getOperator().isAggregator()) { throw validator.newValidationError(aggCall, RESOURCE.filterNonAggregate()); } final SqlNode condition = call.operand(1); SqlNodeList orderList = null; if (hasWithinGroupCall(call)) { SqlCall withinGroupCall = getWithinGroupCall(call); orderList = withinGroupCall.operand(1); } validator.validateAggregateParams(aggCall, condition, orderList, scope); final RelDataType type = validator.deriveType(scope, condition); if (!SqlTypeUtil.inBooleanFamily(type)) { throw validator.newValidationError(condition, RESOURCE.condMustBeBoolean("FILTER")); } }
callBinding.getScope(), node); if (!SqlTypeUtil.inBooleanFamily(type)) { if (throwOnFailure) { throw callBinding.newError(RESOURCE.expectedBoolean());
callBinding.getScope(), node); if (!SqlTypeUtil.inBooleanFamily(type)) { if (throwOnFailure) { throw callBinding.newError(RESOURCE.expectedBoolean());
new Checker(inputRowType, RexUtil.types(exprs), null, litmus); if (condition != null) { if (!SqlTypeUtil.inBooleanFamily(condition.getType())) { return litmus.fail("condition must be boolean");
new Checker(inputRowType, RexUtil.types(exprs), null, litmus); if (condition != null) { if (!SqlTypeUtil.inBooleanFamily(condition.getType())) { return litmus.fail("condition must be boolean");