Search in sources :

Example 41 with JavaTypeFactory

use of org.apache.calcite.adapter.java.JavaTypeFactory in project calcite by apache.

the class SqlOperatorBindingTest method setUp.

@Before
public void setUp() {
    JavaTypeFactory typeFactory = new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
    integerDataType = typeFactory.createSqlType(SqlTypeName.INTEGER);
    integerType = SqlTypeUtil.convertTypeToSpec(integerDataType);
    rexBuilder = new RexBuilder(typeFactory);
}
Also used : JavaTypeFactoryImpl(org.apache.calcite.jdbc.JavaTypeFactoryImpl) JavaTypeFactory(org.apache.calcite.adapter.java.JavaTypeFactory) RexBuilder(org.apache.calcite.rex.RexBuilder) Before(org.junit.Before)

Example 42 with JavaTypeFactory

use of org.apache.calcite.adapter.java.JavaTypeFactory in project calcite by apache.

the class ViewTableMacro method viewTable.

/**
 * Allows a sub-class to return an extension of {@link ViewTable} by
 * overriding this method.
 */
protected ViewTable viewTable(CalcitePrepare.AnalyzeViewResult parsed, String viewSql, List<String> schemaPath, List<String> viewPath) {
    final JavaTypeFactory typeFactory = (JavaTypeFactory) parsed.typeFactory;
    final Type elementType = typeFactory.getJavaClass(parsed.rowType);
    return new ViewTable(elementType, RelDataTypeImpl.proto(parsed.rowType), viewSql, schemaPath, viewPath);
}
Also used : Type(java.lang.reflect.Type) JavaTypeFactory(org.apache.calcite.adapter.java.JavaTypeFactory)

Example 43 with JavaTypeFactory

use of org.apache.calcite.adapter.java.JavaTypeFactory in project calcite by apache.

the class ViewTableMacro method modifiableViewTable.

/**
 * Allows a sub-class to return an extension of {@link ModifiableViewTable}
 * by overriding this method.
 */
protected ModifiableViewTable modifiableViewTable(CalcitePrepare.AnalyzeViewResult parsed, String viewSql, List<String> schemaPath, List<String> viewPath, CalciteSchema schema) {
    final JavaTypeFactory typeFactory = (JavaTypeFactory) parsed.typeFactory;
    final Type elementType = typeFactory.getJavaClass(parsed.rowType);
    return new ModifiableViewTable(elementType, RelDataTypeImpl.proto(parsed.rowType), viewSql, schemaPath, viewPath, parsed.table, Schemas.path(schema.root(), parsed.tablePath), parsed.constraint, parsed.columnMapping);
}
Also used : Type(java.lang.reflect.Type) JavaTypeFactory(org.apache.calcite.adapter.java.JavaTypeFactory)

Aggregations

JavaTypeFactory (org.apache.calcite.adapter.java.JavaTypeFactory)43 JavaTypeFactoryImpl (org.apache.calcite.jdbc.JavaTypeFactoryImpl)18 ArrayList (java.util.ArrayList)15 SchemaPlus (org.apache.calcite.schema.SchemaPlus)15 StreamableTable (org.apache.calcite.schema.StreamableTable)12 Table (org.apache.calcite.schema.Table)12 RelDataType (org.apache.calcite.rel.type.RelDataType)10 Expression (org.apache.calcite.linq4j.tree.Expression)9 BlockBuilder (org.apache.calcite.linq4j.tree.BlockBuilder)8 SqlNode (org.apache.calcite.sql.SqlNode)7 Type (java.lang.reflect.Type)6 ParameterExpression (org.apache.calcite.linq4j.tree.ParameterExpression)6 FrameworkConfig (org.apache.calcite.tools.FrameworkConfig)6 CompilerUtil (org.apache.storm.sql.compiler.CompilerUtil)6 CalciteCatalogReader (org.apache.calcite.prepare.CalciteCatalogReader)5 RelNode (org.apache.calcite.rel.RelNode)5 SqlOperatorTable (org.apache.calcite.sql.SqlOperatorTable)5 ChainedSqlOperatorTable (org.apache.calcite.sql.util.ChainedSqlOperatorTable)5 ImmutableList (com.google.common.collect.ImmutableList)4 CalcitePrepare (org.apache.calcite.jdbc.CalcitePrepare)4