public FrameworkConfig buildFrameWorkConfig() { if (hasUdf) { List<SqlOperatorTable> sqlOperatorTables = new ArrayList<>(); sqlOperatorTables.add(SqlStdOperatorTable.instance()); sqlOperatorTables.add(new CalciteCatalogReader(CalciteSchema.from(schema), Collections.emptyList(), typeFactory, new CalciteConnectionConfigImpl(new Properties()))); return Frameworks.newConfigBuilder().defaultSchema(schema) .operatorTable(new ChainedSqlOperatorTable(sqlOperatorTables)).build(); } else { return Frameworks.newConfigBuilder().defaultSchema(schema).build(); } }
public Casing unquotedCasing() { return CalciteConnectionProperty.UNQUOTED_CASING.wrap(properties) .getEnum(Casing.class, lex().unquotedCasing); }
private static CalciteConnectionConfig mutate(CalciteConnectionConfig config, ImmutableMap<CalciteConnectionProperty, String> propValues) { for (Map.Entry<CalciteConnectionProperty, String> e : propValues.entrySet()) { config = ((CalciteConnectionConfigImpl) config).set(e.getKey(), e.getValue()); } return config; }
public <T> T fun(Class<T> operatorTableClass, T defaultOperatorTable) { final String fun = CalciteConnectionProperty.FUN.wrap(properties).getString(); if (fun == null || fun.equals("") || fun.equals("standard")) { return defaultOperatorTable; } final Collection<SqlOperatorTable> tables = new LinkedHashSet<>(); for (String s : fun.split(",")) { operatorTable(s, tables); } tables.add(SqlStdOperatorTable.instance()); return operatorTableClass.cast( ChainedSqlOperatorTable.of( tables.toArray(new SqlOperatorTable[0]))); }
public boolean caseSensitive() { return CalciteConnectionProperty.CASE_SENSITIVE.wrap(properties) .getBoolean(lex().caseSensitive); }
private static CalciteConnectionConfig mutate(CalciteConnectionConfig config, ImmutableMap<CalciteConnectionProperty, String> propValues) { for (Map.Entry<CalciteConnectionProperty, String> e : propValues.entrySet()) { config = ((CalciteConnectionConfigImpl) config).set(e.getKey(), e.getValue()); } return config; }
public <T> T fun(Class<T> operatorTableClass, T defaultOperatorTable) { final String fun = CalciteConnectionProperty.FUN.wrap(properties).getString(); if (fun == null || fun.equals("") || fun.equals("standard")) { return defaultOperatorTable; } final Collection<SqlOperatorTable> tables = new LinkedHashSet<>(); for (String s : fun.split(",")) { operatorTable(s, tables); } tables.add(SqlStdOperatorTable.instance()); return operatorTableClass.cast( ChainedSqlOperatorTable.of( tables.toArray(new SqlOperatorTable[0]))); }
public QueryPlanner(SchemaPlus schema) { final List<RelTraitDef> traitDefs = new ArrayList<RelTraitDef>(); traitDefs.add(ConventionTraitDef.INSTANCE); traitDefs.add(RelCollationTraitDef.INSTANCE); List<SqlOperatorTable> sqlOperatorTables = new ArrayList<>(); sqlOperatorTables.add(SqlStdOperatorTable.instance()); sqlOperatorTables.add(new CalciteCatalogReader(CalciteSchema.from(schema), Collections.emptyList(), typeFactory, new CalciteConnectionConfigImpl(new Properties()))); FrameworkConfig config = Frameworks.newConfigBuilder() .defaultSchema(schema) .operatorTable(new ChainedSqlOperatorTable(sqlOperatorTables)) .traitDefs(traitDefs) .context(Contexts.EMPTY_CONTEXT) .ruleSets(StreamsStormRuleSets.getRuleSets()) .costFactory(null) .typeSystem(StormRelDataTypeSystem.STORM_REL_DATATYPE_SYSTEM) .build(); this.planner = Frameworks.getPlanner(config); }
public Casing unquotedCasing() { return CalciteConnectionProperty.UNQUOTED_CASING.wrap(properties) .getEnum(Casing.class, lex().unquotedCasing); }
private static RelOptPlanner createPlanner( HiveConf conf, Set<RelNode> corrScalarRexSQWithAgg, Set<RelNode> scalarAggNoGbyNoWin) { final Double maxSplitSize = (double) HiveConf.getLongVar( conf, HiveConf.ConfVars.MAPREDMAXSPLITSIZE); final Double maxMemory = (double) HiveConf.getLongVar( conf, HiveConf.ConfVars.HIVECONVERTJOINNOCONDITIONALTASKTHRESHOLD); HiveAlgorithmsConf algorithmsConf = new HiveAlgorithmsConf(maxSplitSize, maxMemory); HiveRulesRegistry registry = new HiveRulesRegistry(); Properties calciteConfigProperties = new Properties(); calciteConfigProperties.setProperty( CalciteConnectionProperty.TIME_ZONE.camelName(), conf.getLocalTimeZone().getId()); calciteConfigProperties.setProperty( CalciteConnectionProperty.MATERIALIZATIONS_ENABLED.camelName(), Boolean.FALSE.toString()); CalciteConnectionConfig calciteConfig = new CalciteConnectionConfigImpl(calciteConfigProperties); boolean isCorrelatedColumns = HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_CBO_STATS_CORRELATED_MULTI_KEY_JOINS); boolean heuristicMaterializationStrategy = HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_MATERIALIZED_VIEW_REWRITING_SELECTION_STRATEGY).equals("heuristic"); HivePlannerContext confContext = new HivePlannerContext(algorithmsConf, registry, calciteConfig, corrScalarRexSQWithAgg, scalarAggNoGbyNoWin, new HiveConfPlannerContext(isCorrelatedColumns, heuristicMaterializationStrategy)); return HiveVolcanoPlanner.createPlanner(confContext); }
public Casing quotedCasing() { return CalciteConnectionProperty.QUOTED_CASING.wrap(properties) .getEnum(Casing.class, lex().quotedCasing); }
public CalciteConnectionConfig config() { return new CalciteConnectionConfigImpl(info); }
public Quoting quoting() { return CalciteConnectionProperty.QUOTING.wrap(properties) .getEnum(Quoting.class, lex().quoting); }
public CalciteConnectionConfig config() { return new CalciteConnectionConfigImpl(info); }
public boolean caseSensitive() { return CalciteConnectionProperty.CASE_SENSITIVE.wrap(properties) .getBoolean(lex().caseSensitive); }
public CalciteConnectionConfig config() { return new CalciteConnectionConfigImpl(info); }
public Quoting quoting() { return CalciteConnectionProperty.QUOTING.wrap(properties) .getEnum(Quoting.class, lex().quoting); }
/** Returns a copy of this configuration with one property changed. */ public CalciteConnectionConfigImpl set(CalciteConnectionProperty property, String value) { final Properties properties1 = new Properties(properties); properties1.setProperty(property.camelName(), value); return new CalciteConnectionConfigImpl(properties1); }
public Casing quotedCasing() { return CalciteConnectionProperty.QUOTED_CASING.wrap(properties) .getEnum(Casing.class, lex().quotedCasing); }
/** Returns a copy of this configuration with one property changed. */ public CalciteConnectionConfigImpl set(CalciteConnectionProperty property, String value) { final Properties properties1 = new Properties(properties); properties1.setProperty(property.camelName(), value); return new CalciteConnectionConfigImpl(properties1); }