public void validateWith(SqlWith with, SqlValidatorScope scope) { final SqlValidatorNamespace namespace = getNamespace(with); validateNamespace(namespace, unknownType); }
public void validateDelete(SqlDelete call) { final SqlSelect sqlSelect = call.getSourceSelect(); validateSelect(sqlSelect, unknownType); final SqlValidatorNamespace targetNamespace = getNamespace(call); validateNamespace(targetNamespace, unknownType); final SqlValidatorTable table = targetNamespace.getTable(); validateAccess(call.getTargetTable(), table, SqlAccessEnum.DELETE); }
protected RelDataType getLogicalTargetRowType( RelDataType targetRowType, SqlInsert insert) { if (insert.getTargetColumnList() == null && conformance.isInsertSubsetColumnsAllowed()) { // Target an implicit subset of columns. final SqlNode source = insert.getSource(); final RelDataType sourceRowType = getNamespace(source).getRowType(); final RelDataType logicalSourceRowType = getLogicalSourceRowType(sourceRowType, insert); final RelDataType implicitTargetRowType = typeFactory.createStructType( targetRowType.getFieldList() .subList(0, logicalSourceRowType.getFieldCount())); final SqlValidatorNamespace targetNamespace = getNamespace(insert); validateNamespace(targetNamespace, implicitTargetRowType); return implicitTargetRowType; } else { // Either the set of columns are explicitly targeted, or target the full // set of columns. return targetRowType; } }
public void validateQuery(SqlNode node, SqlValidatorScope scope, RelDataType targetRowType) { final SqlValidatorNamespace ns = getNamespace(node, scope); if (node.getKind() == SqlKind.TABLESAMPLE) { List<SqlNode> operands = ((SqlCall) node).getOperandList(); SqlSampleSpec sampleSpec = SqlLiteral.sampleValue(operands.get(1)); if (sampleSpec instanceof SqlSampleSpec.SqlTableSampleSpec) { validateFeature(RESOURCE.sQLFeature_T613(), node.getParserPosition()); } else if (sampleSpec instanceof SqlSampleSpec.SqlSubstitutionSampleSpec) { validateFeature(RESOURCE.sQLFeatureExt_T613_Substitution(), node.getParserPosition()); } } validateNamespace(ns, targetRowType); switch (node.getKind()) { case EXTEND: // Until we have a dedicated namespace for EXTEND deriveType(scope, node); } if (node == top) { validateModality(node); } validateAccess( node, ns.getTable(), SqlAccessEnum.SELECT); }
public void validateUpdate(SqlUpdate call) { final SqlValidatorNamespace targetNamespace = getNamespace(call); validateNamespace(targetNamespace, unknownType); final RelOptTable relOptTable = SqlValidatorUtil.getRelOptTable( targetNamespace, catalogReader.unwrap(Prepare.CatalogReader.class), null, null); final SqlValidatorTable table = relOptTable == null ? targetNamespace.getTable() : relOptTable.unwrap(SqlValidatorTable.class); final RelDataType targetRowType = createTargetRowType( table, call.getTargetColumnList(), true); final SqlSelect select = call.getSourceSelect(); validateSelect(select, targetRowType); final RelDataType sourceRowType = getNamespace(call).getRowType(); checkTypeAssignment(sourceRowType, targetRowType, call); checkConstraint(table, call, targetRowType); validateAccess(call.getTargetTable(), table, SqlAccessEnum.UPDATE); }
public void validateInsert(SqlInsert insert) { final SqlValidatorNamespace targetNamespace = getNamespace(insert); validateNamespace(targetNamespace, unknownType); final RelOptTable relOptTable = SqlValidatorUtil.getRelOptTable( targetNamespace, catalogReader.unwrap(Prepare.CatalogReader.class), null, null);
validateNamespace(targetNamespace, unknownType);
public RelDataType getRowType() { if (rowType == null) { validator.validateNamespace(this, validator.unknownType); Preconditions.checkArgument(rowType != null, "validate must set rowType"); } return rowType; }
public RelDataType getRowType() { if (rowType == null) { validator.validateNamespace(this, validator.unknownType); Preconditions.checkArgument(rowType != null, "validate must set rowType"); } return rowType; }
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); } }
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); } }
public void validateWith(SqlWith with, SqlValidatorScope scope) { final SqlValidatorNamespace namespace = getNamespace(with); validateNamespace(namespace, unknownType); }
public void validateWith(SqlWith with, SqlValidatorScope scope) { final SqlValidatorNamespace namespace = getNamespace(with); validateNamespace(namespace, unknownType); }
public void validateDelete(SqlDelete call) { final SqlSelect sqlSelect = call.getSourceSelect(); validateSelect(sqlSelect, unknownType); final SqlValidatorNamespace targetNamespace = getNamespace(call); validateNamespace(targetNamespace, unknownType); final SqlValidatorTable table = targetNamespace.getTable(); validateAccess(call.getTargetTable(), table, SqlAccessEnum.DELETE); }
public void validateDelete(SqlDelete call) { final SqlSelect sqlSelect = call.getSourceSelect(); validateSelect(sqlSelect, unknownType); final SqlValidatorNamespace targetNamespace = getNamespace(call); validateNamespace(targetNamespace, unknownType); final SqlValidatorTable table = targetNamespace.getTable(); validateAccess(call.getTargetTable(), table, SqlAccessEnum.DELETE); }
protected RelDataType getLogicalTargetRowType( RelDataType targetRowType, SqlInsert insert) { if (insert.getTargetColumnList() == null && conformance.isInsertSubsetColumnsAllowed()) { // Target an implicit subset of columns. final SqlNode source = insert.getSource(); final RelDataType sourceRowType = getNamespace(source).getRowType(); final RelDataType logicalSourceRowType = getLogicalSourceRowType(sourceRowType, insert); final RelDataType implicitTargetRowType = typeFactory.createStructType( targetRowType.getFieldList() .subList(0, logicalSourceRowType.getFieldCount())); final SqlValidatorNamespace targetNamespace = getNamespace(insert); validateNamespace(targetNamespace, implicitTargetRowType); return implicitTargetRowType; } else { // Either the set of columns are explicitly targeted, or target the full // set of columns. return targetRowType; } }
protected RelDataType getLogicalTargetRowType( RelDataType targetRowType, SqlInsert insert) { if (insert.getTargetColumnList() == null && conformance.isInsertSubsetColumnsAllowed()) { // Target an implicit subset of columns. final SqlNode source = insert.getSource(); final RelDataType sourceRowType = getNamespace(source).getRowType(); final RelDataType logicalSourceRowType = getLogicalSourceRowType(sourceRowType, insert); final RelDataType implicitTargetRowType = typeFactory.createStructType( targetRowType.getFieldList() .subList(0, logicalSourceRowType.getFieldCount())); final SqlValidatorNamespace targetNamespace = getNamespace(insert); validateNamespace(targetNamespace, implicitTargetRowType); return implicitTargetRowType; } else { // Either the set of columns are explicitly targeted, or target the full // set of columns. return targetRowType; } }
public void validateQuery(SqlNode node, SqlValidatorScope scope, RelDataType targetRowType) { final SqlValidatorNamespace ns = getNamespace(node, scope); if (node.getKind() == SqlKind.TABLESAMPLE) { List<SqlNode> operands = ((SqlCall) node).getOperandList(); SqlSampleSpec sampleSpec = SqlLiteral.sampleValue(operands.get(1)); if (sampleSpec instanceof SqlSampleSpec.SqlTableSampleSpec) { validateFeature(RESOURCE.sQLFeature_T613(), node.getParserPosition()); } else if (sampleSpec instanceof SqlSampleSpec.SqlSubstitutionSampleSpec) { validateFeature(RESOURCE.sQLFeatureExt_T613_Substitution(), node.getParserPosition()); } } validateNamespace(ns, targetRowType); switch (node.getKind()) { case EXTEND: // Until we have a dedicated namespace for EXTEND deriveType(scope, node); } if (node == top) { validateModality(node); } validateAccess( node, ns.getTable(), SqlAccessEnum.SELECT); }
public void validateUpdate(SqlUpdate call) { final SqlValidatorNamespace targetNamespace = getNamespace(call); validateNamespace(targetNamespace, unknownType); final RelOptTable relOptTable = SqlValidatorUtil.getRelOptTable( targetNamespace, catalogReader.unwrap(Prepare.CatalogReader.class), null, null); final SqlValidatorTable table = relOptTable == null ? targetNamespace.getTable() : relOptTable.unwrap(SqlValidatorTable.class); final RelDataType targetRowType = createTargetRowType( table, call.getTargetColumnList(), true); final SqlSelect select = call.getSourceSelect(); validateSelect(select, targetRowType); final RelDataType sourceRowType = getNamespace(call).getRowType(); checkTypeAssignment(sourceRowType, targetRowType, call); checkConstraint(table, call, targetRowType); validateAccess(call.getTargetTable(), table, SqlAccessEnum.UPDATE); }
public void validateUpdate(SqlUpdate call) { final SqlValidatorNamespace targetNamespace = getNamespace(call); validateNamespace(targetNamespace, unknownType); final RelOptTable relOptTable = SqlValidatorUtil.getRelOptTable( targetNamespace, catalogReader.unwrap(Prepare.CatalogReader.class), null, null); final SqlValidatorTable table = relOptTable == null ? targetNamespace.getTable() : relOptTable.unwrap(SqlValidatorTable.class); final RelDataType targetRowType = createTargetRowType( table, call.getTargetColumnList(), true); final SqlSelect select = call.getSourceSelect(); validateSelect(select, targetRowType); final RelDataType sourceRowType = getNamespace(call).getRowType(); checkTypeAssignment(sourceRowType, targetRowType, call); checkConstraint(table, call, targetRowType); validateAccess(call.getTargetTable(), table, SqlAccessEnum.UPDATE); }