@Override public boolean isWithin(SqlValidatorScope scope2) { if (this == scope2) { return true; } SqlValidatorScope s = getValidator().getSelectScope((SqlSelect) node); return s.isWithin(scope2); } }
@Override public boolean isWithin(SqlValidatorScope scope2) { if (this == scope2) { return true; } SqlValidatorScope s = getValidator().getSelectScope((SqlSelect) node); return s.isWithin(scope2); } }
public void found(SqlValidatorNamespace namespace, boolean nullable, SqlValidatorScope scope, Path path, List<String> remainingNames) { if (scope instanceof TableScope) { scope = scope.getValidator().getSelectScope((SqlSelect) scope.getNode()); } if (scope instanceof AggregatingSelectScope) { scope = ((AggregatingSelectScope) scope).parent; assert scope instanceof SelectScope; } resolves.add( new Resolve(namespace, nullable, scope, path, remainingNames)); }
public void found(SqlValidatorNamespace namespace, boolean nullable, SqlValidatorScope scope, Path path, List<String> remainingNames) { if (scope instanceof TableScope) { scope = scope.getValidator().getSelectScope((SqlSelect) scope.getNode()); } if (scope instanceof AggregatingSelectScope) { scope = ((AggregatingSelectScope) scope).parent; assert scope instanceof SelectScope; } resolves.add( new Resolve(namespace, nullable, scope, path, remainingNames)); }
final SqlValidatorScope seekScope = (seek instanceof SqlSelect) ? validator.getSelectScope((SqlSelect) seek) : null; final Blackboard seekBb = createBlackboard(seekScope, null, false);
final SqlValidatorScope seekScope = (seek instanceof SqlSelect) ? validator.getSelectScope((SqlSelect) seek) : null; final Blackboard seekBb = createBlackboard(seekScope, null, false);
/** * Converts an EXISTS or IN predicate into a join. For EXISTS, the sub-query * produces an indicator variable, and the result is a relational expression * which outer joins that indicator to the original query. After performing * the outer join, the condition will be TRUE if the EXISTS condition holds, * NULL otherwise. * * @param seek A query, for example 'select * from emp' or * 'values (1,2,3)' or '('Foo', 34)'. * @param subQueryType Whether sub-query is IN, EXISTS or scalar * @param logic Whether the answer needs to be in full 3-valued logic (TRUE, * FALSE, UNKNOWN) will be required, or whether we can accept an * approximation (say representing UNKNOWN as FALSE) * @param notIn Whether the operation is NOT IN * @return join expression */ private RelOptUtil.Exists convertExists( SqlNode seek, RelOptUtil.SubQueryType subQueryType, RelOptUtil.Logic logic, boolean notIn, RelDataType targetDataType) { final SqlValidatorScope seekScope = (seek instanceof SqlSelect) ? validator.getSelectScope((SqlSelect) seek) : null; final Blackboard seekBb = createBlackboard(seekScope, null, false); RelNode seekRel = convertQueryOrInList(seekBb, seek, targetDataType); return RelOptUtil.createExistsPlan(seekRel, subQueryType, logic, notIn); }
/** * Converts an EXISTS or IN predicate into a join. For EXISTS, the sub-query * produces an indicator variable, and the result is a relational expression * which outer joins that indicator to the original query. After performing * the outer join, the condition will be TRUE if the EXISTS condition holds, * NULL otherwise. * * @param seek A query, for example 'select * from emp' or * 'values (1,2,3)' or '('Foo', 34)'. * @param subQueryType Whether sub-query is IN, EXISTS or scalar * @param logic Whether the answer needs to be in full 3-valued logic (TRUE, * FALSE, UNKNOWN) will be required, or whether we can accept an * approximation (say representing UNKNOWN as FALSE) * @param notIn Whether the operation is NOT IN * @return join expression */ private RelOptUtil.Exists convertExists( SqlNode seek, RelOptUtil.SubQueryType subQueryType, RelOptUtil.Logic logic, boolean notIn, RelDataType targetDataType) { final SqlValidatorScope seekScope = (seek instanceof SqlSelect) ? validator.getSelectScope((SqlSelect) seek) : null; final Blackboard seekBb = createBlackboard(seekScope, null, false); RelNode seekRel = convertQueryOrInList(seekBb, seek, targetDataType); return RelOptUtil.createExistsPlan(seekRel, subQueryType, logic, notIn); }
public SqlMonotonicity getMonotonicity(String sql) { final SqlValidator validator = getValidator(); final SqlNode node = parseAndValidate(validator, sql); final SqlSelect select = (SqlSelect) node; final SqlNode selectItem0 = select.getSelectList().get(0); final SqlValidatorScope scope = validator.getSelectScope(select); return selectItem0.getMonotonicity(scope); }
this.bb = bb; this.aggregatingSelectScope = (AggregatingSelectScope) bb.getValidator().getSelectScope(select);
this.bb = bb; this.aggregatingSelectScope = (AggregatingSelectScope) bb.getValidator().getSelectScope(select);
this.bb = bb; this.aggregatingSelectScope = (AggregatingSelectScope) bb.getValidator().getSelectScope(select);
this.bb = bb; this.aggregatingSelectScope = (AggregatingSelectScope) bb.getValidator().getSelectScope(select);
public SqlMonotonicity getMonotonicity(String sql) { final SqlValidator validator = getValidator(); final SqlNode node = parseAndValidate(validator, sql); final SqlSelect select = (SqlSelect) node; final SqlNode selectItem0 = select.getSelectList().get(0); final SqlValidatorScope scope = validator.getSelectScope(select); return selectItem0.getMonotonicity(scope); }