org.apache.calcite.sql.SqlMerge Java Examples

The following examples show how to use org.apache.calcite.sql.SqlMerge. 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 4 votes vote down vote up
public void validateMerge(SqlMerge call) {
	SqlSelect sqlSelect = call.getSourceSelect();
	// REVIEW zfong 5/25/06 - Does an actual type have to be passed into
	// validateSelect()?

	// REVIEW jvs 6-June-2006:  In general, passing unknownType like
	// this means we won't be able to correctly infer the types
	// for dynamic parameter markers (SET x = ?).  But
	// maybe validateUpdate and validateInsert below will do
	// the job?

	// REVIEW ksecretan 15-July-2011: They didn't get a chance to
	// since validateSelect() would bail.
	// Let's use the update/insert targetRowType when available.
	IdentifierNamespace targetNamespace =
		(IdentifierNamespace) getNamespace(call.getTargetTable());
	validateNamespace(targetNamespace, unknownType);

	SqlValidatorTable table = targetNamespace.getTable();
	validateAccess(call.getTargetTable(), table, SqlAccessEnum.UPDATE);

	RelDataType targetRowType = unknownType;

	if (call.getUpdateCall() != null) {
		targetRowType = createTargetRowType(
			table,
			call.getUpdateCall().getTargetColumnList(),
			true);
	}
	if (call.getInsertCall() != null) {
		targetRowType = createTargetRowType(
			table,
			call.getInsertCall().getTargetColumnList(),
			false);
	}

	validateSelect(sqlSelect, targetRowType);

	if (call.getUpdateCall() != null) {
		validateUpdate(call.getUpdateCall());
	}
	if (call.getInsertCall() != null) {
		validateInsert(call.getInsertCall());
	}
}
 
Example #2
Source File: SqlValidatorImpl.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
MergeNamespace(SqlValidatorImpl validator, SqlMerge node,
	SqlNode enclosingNode, SqlValidatorScope parentScope) {
	super(validator, node.getTargetTable(), enclosingNode, parentScope);
	this.node = Objects.requireNonNull(node);
}
 
Example #3
Source File: SqlValidatorImpl.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public SqlMerge getNode() {
	return node;
}
 
Example #4
Source File: SqlValidatorImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
public void validateMerge(SqlMerge call) {
	SqlSelect sqlSelect = call.getSourceSelect();
	// REVIEW zfong 5/25/06 - Does an actual type have to be passed into
	// validateSelect()?

	// REVIEW jvs 6-June-2006:  In general, passing unknownType like
	// this means we won't be able to correctly infer the types
	// for dynamic parameter markers (SET x = ?).  But
	// maybe validateUpdate and validateInsert below will do
	// the job?

	// REVIEW ksecretan 15-July-2011: They didn't get a chance to
	// since validateSelect() would bail.
	// Let's use the update/insert targetRowType when available.
	IdentifierNamespace targetNamespace =
		(IdentifierNamespace) getNamespace(call.getTargetTable());
	validateNamespace(targetNamespace, unknownType);

	SqlValidatorTable table = targetNamespace.getTable();
	validateAccess(call.getTargetTable(), table, SqlAccessEnum.UPDATE);

	RelDataType targetRowType = unknownType;

	if (call.getUpdateCall() != null) {
		targetRowType = createTargetRowType(
			table,
			call.getUpdateCall().getTargetColumnList(),
			true);
	}
	if (call.getInsertCall() != null) {
		targetRowType = createTargetRowType(
			table,
			call.getInsertCall().getTargetColumnList(),
			false);
	}

	validateSelect(sqlSelect, targetRowType);

	if (call.getUpdateCall() != null) {
		validateUpdate(call.getUpdateCall());
	}
	if (call.getInsertCall() != null) {
		validateInsert(call.getInsertCall());
	}
}
 
Example #5
Source File: SqlValidatorImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
MergeNamespace(SqlValidatorImpl validator, SqlMerge node,
	SqlNode enclosingNode, SqlValidatorScope parentScope) {
	super(validator, node.getTargetTable(), enclosingNode, parentScope);
	this.node = Objects.requireNonNull(node);
}
 
Example #6
Source File: SqlValidatorImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
public SqlMerge getNode() {
	return node;
}
 
Example #7
Source File: SqlValidator.java    From Bats with Apache License 2.0 2 votes vote down vote up
/**
 * Validates a MERGE statement.
 *
 * @param merge MERGE statement
 */
void validateMerge(SqlMerge merge);
 
Example #8
Source File: SqlValidator.java    From calcite with Apache License 2.0 2 votes vote down vote up
/**
 * Validates a MERGE statement.
 *
 * @param merge MERGE statement
 */
void validateMerge(SqlMerge merge);