Java Code Examples for org.apache.calcite.sql.SqlJoin#getLeft()

The following examples show how to use org.apache.calcite.sql.SqlJoin#getLeft() . 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 5 votes vote down vote up
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 2
Source File: SqlValidatorImpl.java    From flink with Apache License 2.0 5 votes vote down vote up
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 3
Source File: SqlParseUtil.java    From alchemy with Apache License 2.0 5 votes vote down vote up
private static void parseFrom(SqlNode from, List<String> sources, List<String> udfs) throws SqlParseException {
    SqlKind sqlKind = from.getKind();
    switch (sqlKind) {
        case IDENTIFIER:
            SqlIdentifier identifier = (SqlIdentifier)from;
            addSource(sources, identifier.getSimple());
            break;
        case AS:
            SqlBasicCall sqlBasicCall = (SqlBasicCall)from;
            parseFrom(sqlBasicCall.operand(0), sources, udfs);
            break;
        case SELECT:
            parseSource((SqlSelect)from, sources, udfs);
            break;
        case JOIN:
            SqlJoin sqlJoin = (SqlJoin)from;
            SqlNode left = sqlJoin.getLeft();
            SqlNode right = sqlJoin.getRight();
            parseFrom(left, sources, udfs);
            parseFrom(right, sources, udfs);
            break;
        case LATERAL:
            SqlBasicCall basicCall = (SqlBasicCall)from;
            SqlNode childNode = basicCall.getOperands()[0];
            parseFunction(childNode, udfs);
        default:
    }
}