org.apache.calcite.schema.Path Java Examples

The following examples show how to use org.apache.calcite.schema.Path. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModifiableViewTable.java    From Bats with Apache License 2.0 5 votes vote down vote up
/** Creates a ModifiableViewTable. */
public ModifiableViewTable(Type elementType, RelProtoDataType rowType,
    String viewSql, List<String> schemaPath, List<String> viewPath,
    Table table, Path tablePath, RexNode constraint,
    ImmutableIntList columnMapping) {
  super(elementType, rowType, viewSql, schemaPath, viewPath);
  this.table = table;
  this.tablePath = tablePath;
  this.constraint = constraint;
  this.columnMapping = columnMapping;
  this.initializerExpressionFactory = new ModifiableViewTableInitializerExpressionFactory();
}
 
Example #2
Source File: QuarkTileTable.java    From quark with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #3
Source File: RelOptTableImpl.java    From calcite with Apache License 2.0 5 votes vote down vote up
public static RelOptTableImpl create(RelOptSchema schema, RelDataType rowType,
    Table table, Path path) {
  final SchemaPlus schemaPlus = MySchemaPlus.create(path);
  return new RelOptTableImpl(schema, rowType, Pair.left(path), table,
      getClassExpressionFunction(schemaPlus, Util.last(path).left, table),
      table.getStatistic().getRowCount());
}
 
Example #4
Source File: RelOptTableImpl.java    From calcite with Apache License 2.0 5 votes vote down vote up
public static MySchemaPlus create(Path path) {
  final Pair<String, Schema> pair = Util.last(path);
  final SchemaPlus parent;
  if (path.size() == 1) {
    parent = null;
  } else {
    parent = create(path.parent());
  }
  return new MySchemaPlus(parent, pair.left, pair.right);
}
 
Example #5
Source File: ModifiableViewTable.java    From calcite with Apache License 2.0 5 votes vote down vote up
/** Creates a ModifiableViewTable. */
public ModifiableViewTable(Type elementType, RelProtoDataType rowType,
    String viewSql, List<String> schemaPath, List<String> viewPath,
    Table table, Path tablePath, RexNode constraint,
    ImmutableIntList columnMapping) {
  super(elementType, rowType, viewSql, schemaPath, viewPath);
  this.table = table;
  this.tablePath = tablePath;
  this.constraint = constraint;
  this.columnMapping = columnMapping;
  this.initializerExpressionFactory = new ModifiableViewTableInitializerExpressionFactory();
}
 
Example #6
Source File: FrameworksTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
/** Test for {@link Path}. */
@Test void testSchemaPath() {
  final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
  final FrameworkConfig config = Frameworks.newConfigBuilder()
      .defaultSchema(
          CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.HR))
      .build();
  final Path path = Schemas.path(config.getDefaultSchema());
  assertThat(path.size(), is(2));
  assertThat(path.get(0).left, is(""));
  assertThat(path.get(1).left, is("hr"));
  assertThat(path.names().size(), is(1));
  assertThat(path.names().get(0), is("hr"));
  assertThat(path.schemas().size(), is(2));

  final Path parent = path.parent();
  assertThat(parent.size(), is(1));
  assertThat(parent.names().size(), is(0));

  final Path grandparent = parent.parent();
  assertThat(grandparent.size(), is(0));

  try {
    Object o = grandparent.parent();
    fail("expected exception, got " + o);
  } catch (IllegalArgumentException e) {
    // ok
  }
}
 
Example #7
Source File: MockCatalogReader.java    From calcite with Apache License 2.0 5 votes vote down vote up
MockModifiableViewTable(Type elementType, RelProtoDataType rowType,
    String viewSql, List<String> schemaPath, List<String> viewPath,
    Table table, Path tablePath, RexNode constraint,
    ImmutableIntList columnMapping) {
  super(elementType, rowType, viewSql, schemaPath, viewPath, table,
      tablePath, constraint, columnMapping);
  this.constraint = constraint;
}
 
Example #8
Source File: MockCatalogReader.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Override public Path getTablePath() {
  final ImmutableList.Builder<Pair<String, Schema>> builder =
      ImmutableList.builder();
  for (String name : fromTable.names) {
    builder.add(Pair.of(name, null));
  }
  return Schemas.path(builder.build());
}
 
Example #9
Source File: ModifiableViewTable.java    From Bats with Apache License 2.0 4 votes vote down vote up
public Path getTablePath() {
  return tablePath;
}
 
Example #10
Source File: ModifiableViewTable.java    From calcite with Apache License 2.0 4 votes vote down vote up
public Path getTablePath() {
  return tablePath;
}