OrderExpressionExpander(SqlSelect select, SqlNode root) { super(getOrderScope(select)); this.select = select; this.root = root; this.aliasList = getNamespace(select).getRowType().getFieldNames(); }
private RelDataType validateUsingCol(SqlIdentifier id, SqlNode leftOrRight) { if (id.names.size() == 1) { String name = id.names.get(0); final SqlValidatorNamespace namespace = getNamespace(leftOrRight); final RelDataType rowType = namespace.getRowType(); final SqlNameMatcher nameMatcher = catalogReader.nameMatcher(); final RelDataTypeField field = nameMatcher.field(rowType, name); if (field != null) { if (nameMatcher.frequency(rowType.getFieldNames(), name) > 1) { throw newValidationError(id, RESOURCE.columnInUsingNotUnique(id.toString())); } return field.getType(); } } throw newValidationError(id, RESOURCE.columnNotFound(id.toString())); }
RelDataType rowType = ns.getRowType(); for (RelDataTypeField field : rowType.getFieldList()) { hintList.add( && (selectScope.getChildren().size() == 1)) { RelDataType rowType = selectScope.getChildren().get(0).getRowType(); for (RelDataTypeField field : rowType.getFieldList()) { hintList.add(
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; } }
for (ScopeChild child : scope.children) { final int before = fields.size(); if (child.namespace.getRowType().isDynamicStruct()) { hasDynamicStruct = true; final SqlValidatorNamespace fromNs = getNamespace(from, scope); assert fromNs != null; final RelDataType rowType = fromNs.getRowType(); for (RelDataTypeField field : rowType.getFieldList()) { String columnName = field.getName();
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); }
final SqlValidatorNamespace sqlNs = getNamespace(matchRecognize.getTableRef()); final RelDataType inputDataType = sqlNs.getRowType(); for (RelDataTypeField fs : inputDataType.getFieldList()) { if (!typeBuilder.nameExists(fs.getName())) { ns.setType(getNamespace(matchRecognize.getTableRef()).getRowType()); } else { ns.setType(rowType);
final RelDataType sourceRowType = getNamespace(source).getRowType(); final RelDataType logicalTargetRowType = getLogicalTargetRowType(targetRowType, insert);
final RelDataType leftRowType = getNamespace(left).getRowType(); final RelDataType rightRowType = getNamespace(right).getRowType(); final SqlNameMatcher nameMatcher = catalogReader.nameMatcher(); List<String> naturalColumnNames =
public RelDataType getRowType() { return namespace.getRowType(); }
@Override public void resolveTable(List<String> names, SqlNameMatcher nameMatcher, Path path, Resolved resolved) { if (names.size() == 1 && names.equals(withItem.name.names)) { final SqlValidatorNamespace ns = validator.getNamespace(withItem); final Step path2 = path .plus(ns.getRowType(), 0, names.get(0), StructKind.FULLY_QUALIFIED); resolved.found(ns, false, null, path2, null); return; } super.resolveTable(names, nameMatcher, path, resolved); }
@Override public void resolveTable(List<String> names, SqlNameMatcher nameMatcher, Path path, Resolved resolved) { if (names.size() == 1 && names.equals(withItem.name.names)) { final SqlValidatorNamespace ns = validator.getNamespace(withItem); final Step path2 = path .plus(ns.getRowType(), 0, names.get(0), StructKind.FULLY_QUALIFIED); resolved.found(ns, false, null, path2, null); return; } super.resolveTable(names, nameMatcher, path, resolved); }
@Override public void resolve(List<String> names, SqlNameMatcher nameMatcher, boolean deep, Resolved resolved) { if (names.size() == 1 && names.equals(withItem.name.names)) { final SqlValidatorNamespace ns = validator.getNamespace(withItem); final Step path = Path.EMPTY.plus(ns.getRowType(), 0, names.get(0), StructKind.FULLY_QUALIFIED); resolved.found(ns, false, null, path, null); return; } super.resolve(names, nameMatcher, deep, resolved); } }
OrderExpressionExpander(SqlSelect select, SqlNode root) { super(getOrderScope(select)); this.select = select; this.root = root; this.aliasList = getNamespace(select).getRowType().getFieldNames(); }
/** The row type of the found namespace, nullable if the lookup has * looked into outer joins. */ public RelDataType rowType() { return namespace.getValidator().getTypeFactory() .createTypeWithNullability(namespace.getRowType(), nullable); } }
/** The row type of the found namespace, nullable if the lookup has * looked into outer joins. */ public RelDataType rowType() { return namespace.getValidator().getTypeFactory() .createTypeWithNullability(namespace.getRowType(), nullable); } }
OrderExpressionExpander(SqlSelect select, SqlNode root) { super(getOrderScope(select)); this.select = select; this.root = root; this.aliasList = getNamespace(select).getRowType().getFieldNames(); }
@Override public SqlMonotonicity getMonotonicity(String columnName) { SqlMonotonicity monotonicity = null; int index = getRowType().getFieldNames().indexOf(columnName); if (index < 0) { return SqlMonotonicity.NOT_MONOTONIC; } for (SqlNode operand : call.getOperandList()) { final SqlValidatorNamespace namespace = validator.getNamespace(operand); monotonicity = combine(monotonicity, namespace.getMonotonicity( namespace.getRowType().getFieldNames().get(index))); } return monotonicity; }
public RelDataType resolveColumn(String name, SqlNode ctx) { final SqlValidatorNamespace selectNs = validator.getNamespace(select); final RelDataType rowType = selectNs.getRowType(); final SqlNameMatcher nameMatcher = validator.catalogReader.nameMatcher(); final RelDataTypeField field = nameMatcher.field(rowType, name); if (field != null) { return field.getType(); } final SqlValidatorScope selectScope = validator.getSelectScope(select); return selectScope.resolveColumn(name, ctx); }
public RelDataType resolveColumn(String name, SqlNode ctx) { final SqlValidatorNamespace selectNs = validator.getNamespace(select); final RelDataType rowType = selectNs.getRowType(); final SqlNameMatcher nameMatcher = validator.catalogReader.nameMatcher(); final RelDataTypeField field = nameMatcher.field(rowType, name); if (field != null) { return field.getType(); } final SqlValidatorScope selectScope = validator.getSelectScope(select); return selectScope.resolveColumn(name, ctx); }