org.apache.calcite.sql.validate.SqlValidatorNamespace Java Examples
The following examples show how to use
org.apache.calcite.sql.validate.SqlValidatorNamespace.
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: SqlAdvisorValidator.java From Bats with Apache License 2.0 | 5 votes |
protected void validateNamespace(final SqlValidatorNamespace namespace, RelDataType targetRowType) { // Only attempt to validate each namespace once. Otherwise if // validation fails, we may end up cycling. if (activeNamespaces.add(namespace)) { super.validateNamespace(namespace, targetRowType); } else { namespace.setType(emptyStructType); } }
Example #2
Source File: SqlCallBinding.java From Bats with Apache License 2.0 | 5 votes |
@Override public RelDataType getOperandType(int ordinal) { final SqlNode operand = call.operand(ordinal); final RelDataType type = validator.deriveType(scope, operand); final SqlValidatorNamespace namespace = validator.getNamespace(operand); if (namespace != null) { return namespace.getType(); } return type; }
Example #3
Source File: TypeInferenceOperandChecker.java From flink with Apache License 2.0 | 5 votes |
/** * Adopted from {@link org.apache.calcite.sql.validate.implicit.AbstractTypeCoercion}. */ private void updateInferredType(SqlValidator validator, SqlNode node, RelDataType type) { validator.setValidatedNodeType(node, type); final SqlValidatorNamespace namespace = validator.getNamespace(node); if (namespace != null) { namespace.setType(type); } }
Example #4
Source File: SqlAdvisorValidator.java From calcite with Apache License 2.0 | 5 votes |
protected void validateNamespace(final SqlValidatorNamespace namespace, RelDataType targetRowType) { // Only attempt to validate each namespace once. Otherwise if // validation fails, we may end up cycling. if (activeNamespaces.add(namespace)) { super.validateNamespace(namespace, targetRowType); } else { namespace.setType(emptyStructType); } }
Example #5
Source File: AbstractTypeCoercion.java From calcite with Apache License 2.0 | 5 votes |
/** * Update inferred type for a SqlNode. */ protected void updateInferredType(SqlNode node, RelDataType type) { validator.setValidatedNodeType(node, type); final SqlValidatorNamespace namespace = validator.getNamespace(node); if (namespace != null) { namespace.setType(type); } }
Example #6
Source File: SqlCallBinding.java From calcite with Apache License 2.0 | 5 votes |
@Override public RelDataType getOperandType(int ordinal) { final SqlNode operand = call.operand(ordinal); final RelDataType type = validator.deriveType(scope, operand); final SqlValidatorNamespace namespace = validator.getNamespace(operand); if (namespace != null) { return namespace.getType(); } return type; }
Example #7
Source File: AbstractSqlTester.java From calcite with Apache License 2.0 | 5 votes |
public void checkMonotonic(String query, SqlMonotonicity expectedMonotonicity) { SqlValidator validator = getValidator(); SqlNode n = parseAndValidate(validator, query); final RelDataType rowType = validator.getValidatedNodeType(n); final SqlValidatorNamespace selectNamespace = validator.getNamespace(n); final String field0 = rowType.getFieldList().get(0).getName(); final SqlMonotonicity monotonicity = selectNamespace.getMonotonicity(field0); assertThat(monotonicity, equalTo(expectedMonotonicity)); }