Java Code Examples for org.apache.calcite.sql.SqlJoin#getConditionType()
The following examples show how to use
org.apache.calcite.sql.SqlJoin#getConditionType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SqlValidatorImpl.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** Returns the set of field names in the join condition specified by USING * or implicitly by NATURAL, de-duplicated and in order. */ private List<String> usingNames(SqlJoin join) { switch (join.getConditionType()) { case USING: final ImmutableList.Builder<String> list = ImmutableList.builder(); final Set<String> names = catalogReader.nameMatcher().createSet(); for (SqlNode node : (SqlNodeList) join.getCondition()) { final String name = ((SqlIdentifier) node).getSimple(); if (names.add(name)) { list.add(name); } } return list.build(); case NONE: if (join.isNatural()) { final RelDataType t0 = getValidatedNodeType(join.getLeft()); final RelDataType t1 = getValidatedNodeType(join.getRight()); return SqlValidatorUtil.deriveNaturalJoinColumnList( catalogReader.nameMatcher(), t0, t1); } } return null; }
Example 2
Source File: SqlValidatorImpl.java From flink with Apache License 2.0 | 6 votes |
/** Returns the set of field names in the join condition specified by USING * or implicitly by NATURAL, de-duplicated and in order. */ private List<String> usingNames(SqlJoin join) { switch (join.getConditionType()) { case USING: final ImmutableList.Builder<String> list = ImmutableList.builder(); final Set<String> names = catalogReader.nameMatcher().createSet(); for (SqlNode node : (SqlNodeList) join.getCondition()) { final String name = ((SqlIdentifier) node).getSimple(); if (names.add(name)) { list.add(name); } } return list.build(); case NONE: if (join.isNatural()) { final RelDataType t0 = getValidatedNodeType(join.getLeft()); final RelDataType t1 = getValidatedNodeType(join.getRight()); return SqlValidatorUtil.deriveNaturalJoinColumnList( catalogReader.nameMatcher(), t0, t1); } } return null; }
Example 3
Source File: SqlValidatorImpl.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void lookupJoinHints( SqlJoin join, SqlValidatorScope scope, SqlParserPos pos, Collection<SqlMoniker> hintList) { SqlNode left = join.getLeft(); SqlNode right = join.getRight(); SqlNode condition = join.getCondition(); lookupFromHints(left, scope, pos, hintList); if (hintList.size() > 0) { return; } lookupFromHints(right, scope, pos, hintList); if (hintList.size() > 0) { return; } final JoinConditionType conditionType = join.getConditionType(); final SqlValidatorScope joinScope = scopes.get(join); switch (conditionType) { case ON: condition.findValidOptions(this, joinScope, pos, hintList); return; default: // No suggestions. // Not supporting hints for other types such as 'Using' yet. return; } }
Example 4
Source File: SqlValidatorImpl.java From flink with Apache License 2.0 | 5 votes |
private void lookupJoinHints( SqlJoin join, SqlValidatorScope scope, SqlParserPos pos, Collection<SqlMoniker> hintList) { SqlNode left = join.getLeft(); SqlNode right = join.getRight(); SqlNode condition = join.getCondition(); lookupFromHints(left, scope, pos, hintList); if (hintList.size() > 0) { return; } lookupFromHints(right, scope, pos, hintList); if (hintList.size() > 0) { return; } final JoinConditionType conditionType = join.getConditionType(); final SqlValidatorScope joinScope = scopes.get(join); switch (conditionType) { case ON: condition.findValidOptions(this, joinScope, pos, hintList); return; default: // No suggestions. // Not supporting hints for other types such as 'Using' yet. return; } }