@Override public List<ColumnStrategy> getColumnStrategies() { return RelOptTableImpl.columnStrategies(this); }
public QuarkTileTable(QuarkTile quarkTile, CalciteCatalogReader calciteCatalogReader, RelDataType relDataType, Path path, QuarkTable backingTable) { this.quarkTile = quarkTile; this.backingTable = backingTable; this.relOptTable = RelOptTableImpl.create( calciteCatalogReader, relDataType, this, path); }
private TableScan createTemporaryTableScan(RelOptTableImpl relOptTable, List<String> tableAlias, TableScan tableScan, RelNode originTable) { RelDataType type = originTable.getRowType(); RelOptTableImpl relOptTableWithAlias = relOptTable.modifyTableName(tableAlias); RelOptTable newRelOptTable = RelOptTableImpl.create( relOptTableWithAlias.getRelOptSchema(), type, relOptTableWithAlias.getTable(), ImmutableList.copyOf(relOptTableWithAlias.getQualifiedName()) ); return new TemporaryTableScan( tableScan.getCluster(), tableScan.getTraitSet(), newRelOptTable ); }
private TableScan createNewTableScanFromSelection(EnumerableTableScan oldScan, List<String> newFiles, String cacheFileRoot, boolean wasAllPartitionsPruned, MetadataContext metaContext) { final RelOptTableImpl t = (RelOptTableImpl) oldScan.getTable(); final FormatSelection formatSelection = (FormatSelection) table.getSelection(); final FileSelection newFileSelection = new FileSelection(null, newFiles, getBaseTableLocation(), cacheFileRoot, wasAllPartitionsPruned, formatSelection.getSelection().getDirStatus()); newFileSelection.setMetaContext(metaContext); final FormatSelection newFormatSelection = new FormatSelection(formatSelection.getFormat(), newFileSelection); final DrillTranslatableTable newTable = new DrillTranslatableTable( new DynamicDrillTable(table.getPlugin(), table.getStorageEngineName(), table.getUserName(), newFormatSelection)); final RelOptTableImpl newOptTableImpl = RelOptTableImpl.create(t.getRelOptSchema(), t.getRowType(), newTable, GuavaUtils.convertToUnshadedImmutableList(ImmutableList.of())); // return an EnumerableTableScan with fileSelection being part of digest of TableScan node. return DirPrunedEnumerableTableScan.create(oldScan.getCluster(), newOptTableImpl, newFileSelection.toString()); }
@Override protected RelOptTable extend(Table extendedTable) { final RelDataType extendedRowType = extendedTable.getRowType(getRelOptSchema().getTypeFactory()); return new RelOptTableImpl(getRelOptSchema(), extendedRowType, getQualifiedName(), extendedTable, expressionFunction, getRowCount()); }
public RelNode toRel(ToRelContext context) { if (this.getRowType().isDynamicStruct()) { final RelDataType staticRowType = new RelRecordType(getRowType().getFieldList()); final RelOptTable relOptTable = this.copy(staticRowType); return relOptTable.toRel(context); final List<ColumnStrategy> strategies = getColumnStrategies(); if (strategies.contains(ColumnStrategy.VIRTUAL)) { final RelDataTypeFactory.Builder b =
public RelOptTable copyOf(RelOptTable table) { if (table instanceof RelOptTableWrapper) { final RelOptTableWrapper wrapper = (RelOptTableWrapper) table; return new RelOptTableWrapper( wrapper.getQualifiedName(), copyOf(wrapper.getRelOptTable()) ); } else if (table instanceof RelOptTableImpl) { final RelOptTableImpl impl = (RelOptTableImpl) table; return impl.copy(copyOf(impl.getRowType())); // this won't copy the RelOptSchema } notSupported(table); return table; }
public static RelOptTableImpl create(RelOptSchema schema, RelDataType rowType, final CalciteSchema.TableEntry tableEntry, Double rowCount) { final Table table = tableEntry.getTable(); return new RelOptTableImpl(schema, rowType, tableEntry.path(), table, getClassExpressionFunction(tableEntry, table), rowCount); }
@Override public boolean equals(Object obj) { return obj instanceof RelOptTableImpl && this.rowType.equals(((RelOptTableImpl) obj).getRowType()) && this.table == ((RelOptTableImpl) obj).table; }
/** * Creates a copy of this RelOptTable. The new RelOptTable will have newRowType. */ public RelOptTableImpl copy(RelDataType newRowType) { return new RelOptTableImpl(this.schema, newRowType, this.names, this.table, this.expressionFunction, this.rowCount); }
public <T> T unwrap(Class<T> clazz) { if (clazz.isInstance(this)) { return clazz.cast(this); } if (clazz.isInstance(table)) { return clazz.cast(table); } if (table instanceof Wrapper) { final T t = ((Wrapper) table).unwrap(clazz); if (t != null) { return t; } } if (clazz == CalciteSchema.class) { return clazz.cast( Schemas.subSchema(((CalciteCatalogReader) schema).rootSchema, Util.skipLast(getQualifiedName()))); } return null; }
private static Function<Class, Expression> getClassExpressionFunction( CalciteSchema.TableEntry tableEntry, Table table) { return getClassExpressionFunction(tableEntry.schema.plus(), tableEntry.name, table); }
private RelOptTable createVirtualRelOptTable() { List<String> names = createVirtualTableName(); RelDataTypeSystem relDataTypeSystem = new VirtualTypeSystem(); RelDataTypeFieldImpl relDataTypeField = new RelDataTypeFieldImpl( "columnName", 0, new BasicSqlType(relDataTypeSystem, SqlTypeName.ANY)); List<RelDataTypeField> relDataTypeFieldList = new ArrayList<>(); relDataTypeFieldList.add(relDataTypeField); return RelOptTableImpl.create(null, new RelRecordType(relDataTypeFieldList), new VirtualTable(names.get(0)), names, null); }
@Override protected RelOptTable extend(Table extendedTable) { final RelDataType extendedRowType = extendedTable.getRowType(getRelOptSchema().getTypeFactory()); return new RelOptTableImpl(getRelOptSchema(), extendedRowType, getQualifiedName(), extendedTable, expressionFunction, getRowCount()); }
public RelNode toRel(ToRelContext context) { if (this.getRowType().isDynamicStruct()) { final RelDataType staticRowType = new RelRecordType(getRowType().getFieldList()); final RelOptTable relOptTable = this.copy(staticRowType); return relOptTable.toRel(context); final List<ColumnStrategy> strategies = getColumnStrategies(); if (strategies.contains(ColumnStrategy.VIRTUAL)) { final RelDataTypeFactory.Builder b =
public static RelOptTableImpl create(RelOptSchema schema, RelDataType rowType, final CalciteSchema.TableEntry tableEntry, Double rowCount) { final Table table = tableEntry.getTable(); return new RelOptTableImpl(schema, rowType, tableEntry.path(), table, getClassExpressionFunction(tableEntry, table), rowCount); }
@Override public boolean equals(Object obj) { return obj instanceof RelOptTableImpl && this.rowType.equals(((RelOptTableImpl) obj).getRowType()) && this.table == ((RelOptTableImpl) obj).table; }
public static RelOptTableImpl create( RelOptSchema schema, RelDataType rowType, List<String> names, Expression expression) { return new RelOptTableImpl(schema, rowType, names, null, c -> expression, null); }
public <T> T unwrap(Class<T> clazz) { if (clazz.isInstance(this)) { return clazz.cast(this); } if (clazz.isInstance(table)) { return clazz.cast(table); } if (table instanceof Wrapper) { final T t = ((Wrapper) table).unwrap(clazz); if (t != null) { return t; } } if (clazz == CalciteSchema.class) { return clazz.cast( Schemas.subSchema(((CalciteCatalogReader) schema).rootSchema, Util.skipLast(getQualifiedName()))); } return null; }
private static Function<Class, Expression> getClassExpressionFunction( CalciteSchema.TableEntry tableEntry, Table table) { return getClassExpressionFunction(tableEntry.schema.plus(), tableEntry.name, table); }