Java Code Examples for org.apache.calcite.sql2rel.NullInitializerExpressionFactory

The following examples show how to use org.apache.calcite.sql2rel.NullInitializerExpressionFactory. These examples are extracted from open source projects. 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 Project: Bats   Source File: RelOptTableImpl.java    License: 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 Project: calcite   Source File: RelOptTableImpl.java    License: 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 Project: calcite   Source File: MockCatalogReader.java    License: 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 Project: calcite   Source File: MockCatalogReader.java    License: 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 Project: calcite   Source File: MaterializedViewTable.java    License: Apache License 2.0 4 votes vote down vote up
MaterializedViewTable(String name, RelProtoDataType protoRowType) {
  super(name, protoRowType, protoRowType,
      NullInitializerExpressionFactory.INSTANCE);
}
 
Example 6
Source Project: calcite   Source File: MockCatalogReader.java    License: 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 Project: calcite   Source File: MockCatalogReader.java    License: 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);
}