validator.getNamespace(from).resolve(); if (fromNamespace.getNode() != null) { convertFrom(bb, fromNamespace.getNode()); return; final List<String> columnList = SqlValidatorUtil.deriveNaturalJoinColumnList( validator.getNamespace(left).getRowType(), validator.getNamespace(right).getRowType()); conditionExp = convertUsing(leftRel, rightRel, columnList); } else {
name = namespace.translate(name); namespace = null;
public boolean fieldExists(String name) { return namespace.fieldExists(name); }
/** * Validates a namespace. */ protected void validateNamespace(final SqlValidatorNamespace namespace) { namespace.validate(); setValidatedNodeType( namespace.getNode(), namespace.getRowType()); }
String correlName = createCorrel(); mapCorrelToDeferred.put(correlName, lookup); final RelDataType rowType = foundNs.getRowType(); return rexBuilder.makeCorrel(rowType, correlName);
SqlParserPos starPosition = identifier.getParserPosition(); for (Pair<String, SqlValidatorNamespace> p : scope.children) { final SqlNode from = p.right.getNode(); final SqlValidatorNamespace fromNs = getNamespace(from, scope); assert fromNs != null; final RelDataType rowType = fromNs.getRowType(); for (RelDataTypeField field : rowType.getFieldList()) { String columnName = field.getName(); RESOURCE.unknownIdentifier(tableName)); final SqlNode from = childNs.getNode(); final SqlValidatorNamespace fromNs = getNamespace(from); assert fromNs != null; final RelDataType rowType = fromNs.getRowType(); for (RelDataTypeField field : rowType.getFieldList()) { String columnName = field.getName();
SqlValidatorTable table = resolvedNamespace.getTable(); if (validator.shouldExpandIdentifiers()) { RelDataType rowType = resolvedNamespace.getRowType(); final String fieldName = field.getName(); final SqlMonotonicity monotonicity = resolvedNamespace.getMonotonicity(fieldName); if (monotonicity != SqlMonotonicity.NOT_MONOTONIC) { builder.add(
public void validateUpdate(SqlUpdate call) { IdentifierNamespace targetNamespace = getNamespace(call.getTargetTable()).unwrap( IdentifierNamespace.class); validateNamespace(targetNamespace); SqlValidatorTable table = targetNamespace.getTable(); RelDataType targetRowType = createTargetRowType( table, call.getTargetColumnList(), true); SqlSelect select = call.getSourceSelect(); validateSelect(select, targetRowType); RelDataType sourceRowType = getNamespace(select).getRowType(); checkTypeAssignment(sourceRowType, targetRowType, call); validateAccess(call.getTargetTable(), table, SqlAccessEnum.UPDATE); }
/** * Registers a new namespace, and adds it as a child of its parent scope. * Derived class can override this method to tinker with namespaces as they * are created. * * @param usingScope Parent scope (which will want to look for things in * this namespace) * @param alias Alias by which parent will refer to this namespace * @param ns Namespace * @param forceNullable Whether to force the type of namespace to be */ protected void registerNamespace( SqlValidatorScope usingScope, String alias, SqlValidatorNamespace ns, boolean forceNullable) { if (forceNullable) { ns.makeNullable(); } namespaces.put( ns.getNode(), ns); if (usingScope != null) { usingScope.addChild(ns, alias); } }
public void validateInsert(SqlInsert insert) { SqlValidatorNamespace targetNamespace = getNamespace(insert); validateNamespace(targetNamespace); SqlValidatorTable table = targetNamespace.getTable(); RelDataType sourceRowType = getNamespace(source).getRowType(); RelDataType logicalTargetRowType = getLogicalTargetRowType(targetRowType, insert);
ns = scope.resolve(name, null, null); } else { ns = ns.lookupChild(name); RelDataType rowType = ns.getRowType(); for (RelDataTypeField field : rowType.getFieldList()) { hintList.add( selectScope.getChildren().get(0).getRowType(); for (RelDataTypeField field : rowType.getFieldList()) { hintList.add(
public SqlNode getNode() { return namespace.getNode(); }
public RelDataType getRowTypeSansSystemColumns() { return namespace.getRowTypeSansSystemColumns(); }
if (namespace == null) { namespace = scope.resolve(name, null, null); final SqlValidatorTable table = namespace.getTable(); if (table != null) { origin.addAll(table.getQualifiedName()); namespace = namespace.lookupChild(name); if (namespace != null) { origin.add(name);
getNamespace(select).unwrap(SelectNamespace.class); final Pair<String, SqlValidatorNamespace> child = children.get(duplicateAliasOrdinal); throw newValidationError(child.right.getEnclosingNode(), RESOURCE.fromAliasDuplicate(child.left));
public List<Pair<SqlNode, SqlMonotonicity>> getMonotonicExprs() { return namespace.getMonotonicExprs(); }
public SqlValidatorTable getTable() { return namespace.getTable(); }
public SqlMonotonicity getMonotonicity(SqlValidatorScope scope) { // First check for builtin functions which don't have parentheses, // like "LOCALTIME". final SqlValidator validator = scope.getValidator(); SqlCall call = SqlUtil.makeCall( validator.getOperatorTable(), this); if (call != null) { return call.getMonotonicity(scope); } final SqlIdentifier fqId = scope.fullyQualify(this); final SqlValidatorNamespace ns = SqlValidatorUtil.lookup(scope, Util.skipLast(fqId.names)); return ns.resolve().getMonotonicity(Util.last(fqId.names)); } }
public SqlMonotonicity getMonotonicity(String columnName) { return namespace.getMonotonicity(columnName); }