public SamzaSqlUdfOperatorTable(List<SamzaSqlScalarFunctionImpl> scalarFunctions) { operatorTable = new ListSqlOperatorTable(getSqlOperators(scalarFunctions)); }
/** * Adds an operator to this table. */ public void addOperator(SqlOperator op) { listOpTab.add(op); }
@Override public List<SqlOperator> getOperatorList() { return operatorTable.getOperatorList(); } }
/** Creates an operator table that contains functions in the given class. * * @see ModelHandler#addFunctions */ public static SqlOperatorTable operatorTable(String className) { // Dummy schema to collect the functions final CalciteSchema schema = CalciteSchema.createRootSchema(false, false); ModelHandler.addFunctions(schema.plus(), null, ImmutableList.of(), className, "*", true); // The following is technical debt; see [CALCITE-2082] Remove // RelDataTypeFactory argument from SqlUserDefinedAggFunction constructor final SqlTypeFactoryImpl typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final ListSqlOperatorTable table = new ListSqlOperatorTable(); for (String name : schema.getFunctionNames()) { for (Function function : schema.getFunctions(name, true)) { final SqlIdentifier id = new SqlIdentifier(name, SqlParserPos.ZERO); table.add( toOp(typeFactory, id, function)); } } return table; }
@Override public void lookupOperatorOverloads(SqlIdentifier opName, SqlFunctionCategory category, SqlSyntax syntax, List<SqlOperator> operatorList) { operatorTable.lookupOperatorOverloads(opName, category, syntax, operatorList); }
public void lookupOperatorOverloads(SqlIdentifier opName, SqlFunctionCategory category, SqlSyntax syntax, List<SqlOperator> operatorList) { for (SqlOperator operator : this.operatorList) { if (operator.getSyntax() != syntax) { continue; } if (!opName.isSimple() || !operator.isName(opName.getSimple())) { continue; } if (category != null && category != category(operator) && !category.isUserDefinedNotSpecificFunction()) { continue; } operatorList.add(operator); } }
/** Creates an operator table that contains functions in the given class. * * @see ModelHandler#addFunctions */ public static SqlOperatorTable operatorTable(String className) { // Dummy schema to collect the functions final CalciteSchema schema = CalciteSchema.createRootSchema(false, false); ModelHandler.addFunctions(schema.plus(), null, ImmutableList.of(), className, "*", true); // The following is technical debt; see [CALCITE-2082] Remove // RelDataTypeFactory argument from SqlUserDefinedAggFunction constructor final SqlTypeFactoryImpl typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final ListSqlOperatorTable table = new ListSqlOperatorTable(); for (String name : schema.getFunctionNames()) { for (Function function : schema.getFunctions(name, true)) { final SqlIdentifier id = new SqlIdentifier(name, SqlParserPos.ZERO); table.add( toOp(typeFactory, id, function)); } } return table; }
@Override public void lookupOperatorOverloads(SqlIdentifier opName, SqlFunctionCategory category, SqlSyntax syntax, List<SqlOperator> operatorList) { operatorTable.lookupOperatorOverloads(opName, category, syntax, operatorList); }
public void lookupOperatorOverloads(SqlIdentifier opName, SqlFunctionCategory category, SqlSyntax syntax, List<SqlOperator> operatorList) { for (SqlOperator operator : this.operatorList) { if (operator.getSyntax() != syntax) { continue; } if (!opName.isSimple() || !operator.isName(opName.getSimple())) { continue; } if (category != null && category != category(operator) && !category.isUserDefinedNotSpecificFunction()) { continue; } operatorList.add(operator); } }
public SamzaSqlUdfOperatorTable(List<SamzaSqlScalarFunctionImpl> scalarFunctions) { operatorTable = new ListSqlOperatorTable(getSqlOperators(scalarFunctions)); }
/** * Adds an operator to this table. */ public void addOperator(SqlOperator op) { listOpTab.add(op); }
@Override public List<SqlOperator> getOperatorList() { return operatorTable.getOperatorList(); } }
public MockSqlOperatorTable(SqlOperatorTable parentTable) { super(ImmutableList.of(parentTable, new ListSqlOperatorTable())); listOpTab = (ListSqlOperatorTable) tableList.get(1); }
/** * Adds an operator to this table. */ public void addOperator(SqlOperator op) { listOpTab.add(op); }
public MockSqlOperatorTable(SqlOperatorTable parentTable) { super(ImmutableList.of(parentTable, new ListSqlOperatorTable())); listOpTab = (ListSqlOperatorTable) tableList.get(1); }
public MockSqlOperatorTable(SqlOperatorTable parentTable) { super(ImmutableList.of(parentTable, new ListSqlOperatorTable())); listOpTab = (ListSqlOperatorTable) tableList.get(1); }
SqlOperatorTable opTab = ChainedSqlOperatorTable.of(stdOpTab, new ListSqlOperatorTable( ImmutableList.of(new MyCountAggFunction()))); final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
SqlOperatorTable opTab = ChainedSqlOperatorTable.of(stdOpTab, new ListSqlOperatorTable( ImmutableList.of(new MyCountAggFunction()))); final SchemaPlus rootSchema = Frameworks.createRootSchema(true);