/** Creates a copy, assigning a new kind. */ public RelRoot withKind(SqlKind kind) { if (kind == this.kind) { return this; } return new RelRoot(rel, validatedRowType, kind, fields, collation); }
/** Creates a copy of this RelRoot, assigning a {@link RelNode}. */ public RelRoot withRel(RelNode rel) { if (rel == this.rel) { return this; } return new RelRoot(rel, validatedRowType, kind, fields, collation); }
/** Creates a copy, assigning a new kind. */ public RelRoot withKind(SqlKind kind) { if (kind == this.kind) { return this; } return new RelRoot(rel, validatedRowType, kind, fields, collation); }
/** Creates a copy of this RelRoot, assigning a {@link RelNode}. */ public RelRoot withRel(RelNode rel) { if (rel == this.rel) { return this; } return new RelRoot(rel, validatedRowType, kind, fields, collation); }
public RelRoot withCollation(RelCollation collation) { return new RelRoot(rel, validatedRowType, kind, fields, collation); }
public RelRoot withCollation(RelCollation collation) { return new RelRoot(rel, validatedRowType, kind, fields, collation); }
/** Creates a simple RelRoot. */ public static RelRoot of(RelNode rel, RelDataType rowType, SqlKind kind) { final ImmutableIntList refs = ImmutableIntList.identity(rowType.getFieldCount()); final List<String> names = rowType.getFieldNames(); return new RelRoot(rel, rowType, kind, Pair.zip(refs, names), RelCollations.EMPTY); }
/** Creates a simple RelRoot. */ public static RelRoot of(RelNode rel, RelDataType rowType, SqlKind kind) { final ImmutableIntList refs = ImmutableIntList.identity(rowType.getFieldCount()); final List<String> names = rowType.getFieldNames(); return new RelRoot(rel, rowType, kind, Pair.zip(refs, names), RelCollations.EMPTY); }
? ((Sort) rel).collation : RelCollations.EMPTY; RelRoot root = new RelRoot(rel, resultType, SqlKind.SELECT, fields, collation);
root = new RelRoot(rootSort == null ? rootPrj : rootSort, validRowType, root.kind, projFields, rootSort == null ? root.collation : rootSort.getCollation());
? ((Sort) rel).collation : RelCollations.EMPTY; RelRoot root = new RelRoot(rel, resultType, SqlKind.SELECT, fields, collation);
? ((Sort) rel).collation : RelCollations.EMPTY; RelRoot root = new RelRoot(rel, resultType, SqlKind.SELECT, fields, collation);
public static RelRoot expandView(NamespaceKey path, final String viewOwner, final String queryString, final List<String> context, final SqlConverter sqlConverter) { ViewExpansionToken token = null; try { //RelDataType rowType = view.getRowType(cluster.getTypeFactory()); token = sqlConverter.getViewExpansionContext().reserveViewExpansionToken(viewOwner); final DremioCatalogReader catalog; if(viewOwner != null) { catalog = sqlConverter.getCatalogReader().withSchemaPathAndUser(viewOwner, context); } else { catalog = sqlConverter.getCatalogReader().withSchemaPath(context); } final SqlConverter newConverter = new SqlConverter(sqlConverter, catalog); final SqlNode parsedNode = newConverter.parse(queryString); final SqlNode validatedNode = newConverter.validate(parsedNode); final RelRootPlus root = newConverter.toConvertibleRelRoot(validatedNode, true); if(path == null) { return root; } // we need to make sure that if a inner expansion is context sensitive, we consider the current // expansion context sensitive even if it isn't locally. final boolean contextSensitive = root.isContextSensitive() || ExpansionNode.isContextSensitive(root.rel); return new RelRoot(ExpansionNode.wrap(path, root.rel, contextSensitive), root.validatedRowType, root.kind, root.fields, root.collation); } finally { if (token != null) { token.release(); } } }