org.apache.calcite.sql2rel.NullInitializerExpressionFactory Java Examples

The following examples show how to use org.apache.calcite.sql2rel.NullInitializerExpressionFactory. 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: RelOptTableImpl.java    From Bats with Apache License 2.0 6 votes vote down vote up
/** Helper for {@link #getColumnStrategies()}. */
public static List<ColumnStrategy> columnStrategies(final RelOptTable table) {
    final int fieldCount = table.getRowType().getFieldCount();
    final InitializerExpressionFactory ief = Util.first(table.unwrap(InitializerExpressionFactory.class),
            NullInitializerExpressionFactory.INSTANCE);
    return new AbstractList<ColumnStrategy>() {
        @Override
        public int size() {
            return fieldCount;
        }

        @Override
        public ColumnStrategy get(int index) {
            return ief.generationStrategy(table, index);
        }
    };
}
 
Example #2
Source File: RelOptTableImpl.java    From calcite with Apache License 2.0 6 votes vote down vote up
/** Helper for {@link #getColumnStrategies()}. */
public static List<ColumnStrategy> columnStrategies(final RelOptTable table) {
  final int fieldCount = table.getRowType().getFieldCount();
  final InitializerExpressionFactory ief =
      Util.first(table.unwrap(InitializerExpressionFactory.class),
          NullInitializerExpressionFactory.INSTANCE);
  return new AbstractList<ColumnStrategy>() {
    public int size() {
      return fieldCount;
    }

    public ColumnStrategy get(int index) {
      return ief.generationStrategy(table, index);
    }
  };
}
 
Example #3
Source File: MockCatalogReader.java    From calcite with Apache License 2.0 5 votes vote down vote up
public static MockModifiableViewRelOptTable create(MockModifiableViewTable modifiableViewTable,
    MockCatalogReader catalogReader, String catalogName, String schemaName, String name,
    boolean stream, double rowCount, ColumnResolver resolver) {
  final Table underlying = modifiableViewTable.unwrap(Table.class);
  final InitializerExpressionFactory initializerExpressionFactory =
      underlying instanceof Wrapper
          ? ((Wrapper) underlying).unwrap(InitializerExpressionFactory.class)
          : NullInitializerExpressionFactory.INSTANCE;
  return new MockModifiableViewRelOptTable(modifiableViewTable,
      catalogReader, catalogName, schemaName, name, stream, rowCount,
      resolver, Util.first(initializerExpressionFactory,
      NullInitializerExpressionFactory.INSTANCE));
}
 
Example #4
Source File: MockCatalogReader.java    From calcite with Apache License 2.0 5 votes vote down vote up
public static MockRelViewTable create(ViewTable viewTable,
    MockCatalogReader catalogReader, String catalogName, String schemaName, String name,
    boolean stream, double rowCount, ColumnResolver resolver) {
  Table underlying = viewTable.unwrap(Table.class);
  InitializerExpressionFactory initializerExpressionFactory =
      underlying instanceof Wrapper
          ? ((Wrapper) underlying).unwrap(InitializerExpressionFactory.class)
          : NullInitializerExpressionFactory.INSTANCE;
  return new MockRelViewTable(viewTable,
      catalogReader, catalogName, schemaName, name, stream, rowCount,
      resolver, Util.first(initializerExpressionFactory,
      NullInitializerExpressionFactory.INSTANCE));
}
 
Example #5
Source File: MaterializedViewTable.java    From calcite with Apache License 2.0 4 votes vote down vote up
MaterializedViewTable(String name, RelProtoDataType protoRowType) {
  super(name, protoRowType, protoRowType,
      NullInitializerExpressionFactory.INSTANCE);
}
 
Example #6
Source File: MockCatalogReader.java    From calcite with Apache License 2.0 4 votes vote down vote up
public static MockTable create(MockCatalogReader catalogReader,
    List<String> names, boolean stream, double rowCount) {
  return new MockTable(catalogReader, names, stream, false, rowCount, null,
      NullInitializerExpressionFactory.INSTANCE);
}
 
Example #7
Source File: MockCatalogReader.java    From calcite with Apache License 2.0 4 votes vote down vote up
public static MockTable create(MockCatalogReader catalogReader,
    MockSchema schema, String name, boolean stream, double rowCount,
    ColumnResolver resolver) {
  return create(catalogReader, schema, name, stream, rowCount, resolver,
      NullInitializerExpressionFactory.INSTANCE, false);
}