org.apache.calcite.sql2rel.SqlRexConvertletTable Java Examples
The following examples show how to use
org.apache.calcite.sql2rel.SqlRexConvertletTable.
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: TableEnv.java From marble with Apache License 2.0 | 6 votes |
private FrameworkConfig createFrameworkConfig( SqlParser.Config sqlParserConfig, SqlOperatorTable sqlOperatorTable, SqlRexConvertletTable convertletTable, CalciteConnectionConfig calciteConnectionConfig, RelDataTypeSystem relDataTypeSystem, RexExecutor rexExecutor) { return Frameworks .newConfigBuilder() .defaultSchema(rootSchema) .parserConfig(sqlParserConfig) .operatorTable(sqlOperatorTable) .convertletTable(convertletTable) .typeSystem(relDataTypeSystem) .executor(rexExecutor) .context(Contexts.of(calciteConnectionConfig)) .build(); }
Example #2
Source File: CalcitePrepareImpl.java From calcite with Apache License 2.0 | 6 votes |
CalcitePreparingStmt(CalcitePrepareImpl prepare, Context context, CatalogReader catalogReader, RelDataTypeFactory typeFactory, CalciteSchema schema, EnumerableRel.Prefer prefer, RelOptCluster cluster, Convention resultConvention, SqlRexConvertletTable convertletTable) { super(context, catalogReader, resultConvention); this.prepare = prepare; this.schema = schema; this.prefer = prefer; this.cluster = cluster; this.planner = cluster.getPlanner(); this.rexBuilder = cluster.getRexBuilder(); this.typeFactory = typeFactory; this.convertletTable = convertletTable; }
Example #3
Source File: BatsOptimizerTest.java From Bats with Apache License 2.0 | 5 votes |
static RelNode testSqlToRelConverter(RelOptPlanner planner) throws Exception { RexBuilder rexBuilder = createRexBuilder(); RelOptCluster cluster = RelOptCluster.create(planner, rexBuilder); RelOptTable.ViewExpander viewExpander = ViewExpanders.simpleContext(cluster); Pair<SqlNode, SqlValidator> pair = testSqlValidator(); SqlNode sqlNode = pair.left; SqlValidator validator = pair.right; CatalogReader catalogReader = createCalciteCatalogReader(); SqlRexConvertletTable convertletTable = StandardConvertletTable.INSTANCE; SqlToRelConverter.Config config = SqlToRelConverter.Config.DEFAULT; // 不转换成EnumerableTableScan,而是LogicalTableScan config = SqlToRelConverter.configBuilder().withConvertTableAccess(false).build(); SqlToRelConverter converter = new SqlToRelConverter(viewExpander, validator, catalogReader, cluster, convertletTable, config); boolean needsValidation = false; boolean top = false; RelRoot root = converter.convertQuery(sqlNode, needsValidation, top); RelNode relNode = root.rel; String plan = RelOptUtil.toString(relNode); System.out.println("Logical Plan:"); System.out.println("------------------------------------------------------------------"); System.out.println(plan); System.out.println(); // testPrograms(root.rel); return relNode; }
Example #4
Source File: DremioSqlToRelConverter.java From dremio-oss with Apache License 2.0 | 5 votes |
public DremioSqlToRelConverter( SqlConverter sqlConverter, SqlValidator validator, SqlRexConvertletTable convertletTable, Config config) { super(new NoOpExpander(), validator, sqlConverter.getCatalogReader(), sqlConverter.getCluster(), convertletTable, config); this.sqlConverter = sqlConverter; }
Example #5
Source File: CalciteMaterializer.java From calcite with Apache License 2.0 | 5 votes |
CalciteMaterializer(CalcitePrepareImpl prepare, CalcitePrepare.Context context, CatalogReader catalogReader, CalciteSchema schema, RelOptCluster cluster, SqlRexConvertletTable convertletTable) { super(prepare, context, catalogReader, catalogReader.getTypeFactory(), schema, EnumerableRel.Prefer.ANY, cluster, BindableConvention.INSTANCE, convertletTable); }
Example #6
Source File: Frameworks.java From calcite with Apache License 2.0 | 5 votes |
StdFrameworkConfig(Context context, SqlRexConvertletTable convertletTable, SqlOperatorTable operatorTable, ImmutableList<Program> programs, ImmutableList<RelTraitDef> traitDefs, SqlParser.Config parserConfig, SqlValidator.Config sqlValidatorConfig, SqlToRelConverter.Config sqlToRelConverterConfig, SchemaPlus defaultSchema, RelOptCostFactory costFactory, RelDataTypeSystem typeSystem, RexExecutor executor, boolean evolveLattice, SqlStatisticProvider statisticProvider, RelOptTable.ViewExpander viewExpander) { this.context = context; this.convertletTable = convertletTable; this.operatorTable = operatorTable; this.programs = programs; this.traitDefs = traitDefs; this.parserConfig = parserConfig; this.sqlValidatorConfig = sqlValidatorConfig; this.sqlToRelConverterConfig = sqlToRelConverterConfig; this.defaultSchema = defaultSchema; this.costFactory = costFactory; this.typeSystem = typeSystem; this.executor = executor; this.evolveLattice = evolveLattice; this.statisticProvider = statisticProvider; this.viewExpander = viewExpander; }
Example #7
Source File: TableConfig.java From marble with Apache License 2.0 | 4 votes |
public SqlRexConvertletTable getConvertletTable() { return convertletTable; }
Example #8
Source File: TableConfig.java From marble with Apache License 2.0 | 4 votes |
public void setConvertletTable( SqlRexConvertletTable convertletTable) { this.convertletTable = convertletTable; }
Example #9
Source File: TableEnv.java From marble with Apache License 2.0 | 4 votes |
public TableEnv(TableConfig tableConfig) { try { this.tableConfig = tableConfig; SqlParser.Config sqlParserConfig = tableConfig.getSqlParserConfig() != null ? tableConfig.getSqlParserConfig() : SqlParser .configBuilder().setCaseSensitive(false) .build(); SqlOperatorTable sqlStdOperatorTable = tableConfig .getSqlOperatorTable() != null ? tableConfig.getSqlOperatorTable() : ChainedSqlOperatorTable.of(SqlStdOperatorTable.instance()); CalciteConnectionConfig calciteConnectionConfig = tableConfig .getCalciteConnectionConfig() != null ? tableConfig.getCalciteConnectionConfig() : createDefaultConnectionConfig(sqlParserConfig); RelDataTypeSystem typeSystem = tableConfig.getRelDataTypeSystem() != null ? tableConfig.getRelDataTypeSystem() : calciteConnectionConfig.typeSystem(RelDataTypeSystem.class, RelDataTypeSystem.DEFAULT); SqlRexConvertletTable convertletTable = tableConfig .getConvertletTable() != null ? tableConfig .getConvertletTable() : StandardConvertletTable.INSTANCE; RexExecutor rexExecutor = tableConfig.getRexExecutor() != null ? tableConfig.getRexExecutor() : RexUtil.EXECUTOR; this.calciteCatalogReader = new CalciteCatalogReader( CalciteSchema.from(rootSchema), CalciteSchema.from(rootSchema).path(null), new JavaTypeFactoryImpl(typeSystem), calciteConnectionConfig); this.frameworkConfig = createFrameworkConfig(sqlParserConfig, ChainedSqlOperatorTable.of(sqlStdOperatorTable, calciteCatalogReader), convertletTable, calciteConnectionConfig, typeSystem, rexExecutor); } catch (Exception e) { throw new RuntimeException(e); } }
Example #10
Source File: MycatCalciteDataContext.java From Mycat2 with GNU General Public License v3.0 | 4 votes |
@Override public SqlRexConvertletTable getConvertletTable() { return MycatCalciteSupport.INSTANCE.config.getConvertletTable(); }
Example #11
Source File: ReflectionAllowedMonitoringConvertletTable.java From dremio-oss with Apache License 2.0 | 4 votes |
public ReflectionAllowedMonitoringConvertletTable(SqlRexConvertletTable delegate) { super(); this.delegate = delegate; }
Example #12
Source File: CalcitePrepareImpl.java From calcite with Apache License 2.0 | 4 votes |
/** Factory method for default convertlet table. */ protected SqlRexConvertletTable createConvertletTable() { return StandardConvertletTable.INSTANCE; }
Example #13
Source File: Frameworks.java From calcite with Apache License 2.0 | 4 votes |
public SqlRexConvertletTable getConvertletTable() { return convertletTable; }
Example #14
Source File: FrameworkConfig.java From Bats with Apache License 2.0 | 2 votes |
/** * Returns the convertlet table that should be used when converting from SQL * to row expressions */ SqlRexConvertletTable getConvertletTable();
Example #15
Source File: FrameworkConfig.java From calcite with Apache License 2.0 | 2 votes |
/** * Returns the convertlet table that should be used when converting from SQL * to row expressions */ SqlRexConvertletTable getConvertletTable();