• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Function类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.calcite.schema.Function的典型用法代码示例。如果您正苦于以下问题:Java Function类的具体用法?Java Function怎么用?Java Function使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Function类属于org.apache.calcite.schema包,在下文中一共展示了Function类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addImplicitTablesBasedOnNullaryFunctionsToBuilder

import org.apache.calcite.schema.Function; //导入依赖的package包/类
protected void addImplicitTablesBasedOnNullaryFunctionsToBuilder(
        ImmutableSortedMap.Builder<String, Table> builder) {
    ImmutableSortedMap<String, Table> explicitTables = builder.build();

    for (String s : implicitFunctionCache.get(System.currentTimeMillis())) {
        // explicit table wins.
        if (explicitTables.containsKey(s)) {
            continue;
        }
        for (Function function : getSchema().getFunctions(s)) {
            if (function instanceof TableMacro
                    && function.getParameters().isEmpty()) {
                final Table table = ((TableMacro) function).apply(ImmutableList.of());
                builder.put(s, table);
            }
        }
    }
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:19,代码来源:CachingCalciteSchema.java


示例2: getImplicitTableBasedOnNullaryFunction

import org.apache.calcite.schema.Function; //导入依赖的package包/类
protected TableEntry getImplicitTableBasedOnNullaryFunction(String tableName,
                                                            boolean caseSensitive) {
    final NavigableSet<String> set =
            implicitFunctionCache.get(System.currentTimeMillis());
    for (String s : find(set, tableName)) {
        for (Function function : getSchema().getFunctions(s)) {
            if (function instanceof TableMacro
                    && function.getParameters().isEmpty()) {
                final Table table =
                        ((TableMacro) function).apply(ImmutableList.of());
                return tableEntry(tableName, table);
            }
        }
    }
    return null;
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:17,代码来源:CachingCalciteSchema.java


示例3: addImplicitTablesBasedOnNullaryFunctionsToBuilder

import org.apache.calcite.schema.Function; //导入依赖的package包/类
protected void addImplicitTablesBasedOnNullaryFunctionsToBuilder(
        ImmutableSortedMap.Builder<String, Table> builder) {
    ImmutableSortedMap<String, Table> explicitTables = builder.build();

    for (String s : getSchema().getFunctionNames()) {
        // explicit table wins.
        if (explicitTables.containsKey(s)) {
            continue;
        }
        for (Function function : getSchema().getFunctions(s)) {
            if (function instanceof TableMacro
                    && function.getParameters().isEmpty()) {
                final Table table = ((TableMacro) function).apply(ImmutableList.of());
                builder.put(s, table);
            }
        }
    }
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:19,代码来源:SimpleCalciteSchema.java


示例4: handleCreateFunction

import org.apache.calcite.schema.Function; //导入依赖的package包/类
private void handleCreateFunction(SqlCreateFunction sqlCreateFunction) throws ClassNotFoundException {
  if(sqlCreateFunction.jarName() != null) {
    throw new UnsupportedOperationException("UDF 'USING JAR' not implemented");
  }
  Method method;
  Function function;
  if ((method=findMethod(sqlCreateFunction.className(), "evaluate")) != null) {
    function = ScalarFunctionImpl.create(method);
  } else if (findMethod(sqlCreateFunction.className(), "add") != null) {
    function = AggregateFunctionImpl.create(Class.forName(sqlCreateFunction.className()));
  } else {
    throw new RuntimeException("Invalid scalar or aggregate function");
  }
  schema.add(sqlCreateFunction.functionName().toUpperCase(), function);
  hasUdf = true;
}
 
开发者ID:hortonworks,项目名称:streamline,代码行数:17,代码来源:StreamlineSqlImpl.java


示例5: execute

import org.apache.calcite.schema.Function; //导入依赖的package包/类
public void execute(CalcitePrepare.Context context) {
  final Pair<CalciteSchema, String> pair =
      SqlDdlNodes.schema(context, true, name);
  final SchemaPlus schemaPlus = pair.left.plus();
  for (Function function : schemaPlus.getFunctions(pair.right)) {
    if (function.getParameters().isEmpty()) {
      if (!getReplace()) {
        throw SqlUtil.newContextException(name.getParserPosition(),
            RESOURCE.viewExists(pair.right));
      }
      pair.left.removeFunction(pair.right);
    }
  }
  final SqlNode q = SqlDdlNodes.renameColumns(columnList, query);
  final String sql = q.toSqlString(CalciteSqlDialect.DEFAULT).getSql();
  final ViewTableMacro viewTableMacro =
      ViewTable.viewMacro(schemaPlus, sql, pair.left.path(null),
          context.getObjectPath(), false);
  final TranslatableTable x = viewTableMacro.apply(ImmutableList.of());
  Util.discard(x);
  schemaPlus.add(pair.right, viewTableMacro);
}
 
开发者ID:apache,项目名称:calcite,代码行数:23,代码来源:SqlCreateView.java


示例6: addImplicitTablesBasedOnNullaryFunctionsToBuilder

import org.apache.calcite.schema.Function; //导入依赖的package包/类
protected void addImplicitTablesBasedOnNullaryFunctionsToBuilder(
    ImmutableSortedMap.Builder<String, Table> builder) {
  ImmutableSortedMap<String, Table> explicitTables = builder.build();

  final long now = System.currentTimeMillis();
  final NameSet set = implicitFunctionCache.get(now);
  for (String s : set.iterable()) {
    // explicit table wins.
    if (explicitTables.containsKey(s)) {
      continue;
    }
    for (Function function : schema.getFunctions(s)) {
      if (function instanceof TableMacro
          && function.getParameters().isEmpty()) {
        final Table table = ((TableMacro) function).apply(ImmutableList.of());
        builder.put(s, table);
      }
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:21,代码来源:CachingCalciteSchema.java


示例7: getImplicitTableBasedOnNullaryFunction

import org.apache.calcite.schema.Function; //导入依赖的package包/类
protected TableEntry getImplicitTableBasedOnNullaryFunction(String tableName,
    boolean caseSensitive) {
  final long now = System.currentTimeMillis();
  final NameSet set = implicitFunctionCache.get(now);
  for (String s : set.range(tableName, caseSensitive)) {
    for (Function function : schema.getFunctions(s)) {
      if (function instanceof TableMacro
          && function.getParameters().isEmpty()) {
        final Table table =
            ((TableMacro) function).apply(ImmutableList.of());
        return tableEntry(tableName, table);
      }
    }
  }
  return null;
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:CachingCalciteSchema.java


示例8: addImplicitTablesBasedOnNullaryFunctionsToBuilder

import org.apache.calcite.schema.Function; //导入依赖的package包/类
protected void addImplicitTablesBasedOnNullaryFunctionsToBuilder(
    ImmutableSortedMap.Builder<String, Table> builder) {
  ImmutableSortedMap<String, Table> explicitTables = builder.build();

  for (String s : schema.getFunctionNames()) {
    // explicit table wins.
    if (explicitTables.containsKey(s)) {
      continue;
    }
    for (Function function : schema.getFunctions(s)) {
      if (function instanceof TableMacro
          && function.getParameters().isEmpty()) {
        final Table table = ((TableMacro) function).apply(ImmutableList.of());
        builder.put(s, table);
      }
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:SimpleCalciteSchema.java


示例9: operatorTable

import org.apache.calcite.schema.Function; //导入依赖的package包/类
/** 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.<String>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;
}
 
开发者ID:apache,项目名称:calcite,代码行数:26,代码来源:CalciteCatalogReader.java


示例10: createFunctionMap

import org.apache.calcite.schema.Function; //导入依赖的package包/类
private Multimap<String, Function> createFunctionMap() {
  final ImmutableMultimap.Builder<String, Function> builder =
      ImmutableMultimap.builder();
  for (Method method : clazz.getMethods()) {
    final String methodName = method.getName();
    if (method.getDeclaringClass() == Object.class
        || methodName.equals("toString")) {
      continue;
    }
    if (TranslatableTable.class.isAssignableFrom(method.getReturnType())) {
      final TableMacro tableMacro =
          new MethodTableMacro(this, method);
      builder.put(methodName, tableMacro);
    }
  }
  return builder.build();
}
 
开发者ID:apache,项目名称:calcite,代码行数:18,代码来源:ReflectiveSchema.java


示例11: convertArguments

import org.apache.calcite.schema.Function; //导入依赖的package包/类
/**
 * Converts arguments from {@link org.apache.calcite.sql.SqlNode} to
 * java object format.
 *
 * @param typeFactory type factory used to convert the arguments
 * @param operandList input arguments
 * @param function target function to get parameter types from
 * @param opName name of the operator to use in error message
 * @param failOnNonLiteral true when conversion should fail on non-literal
 * @return converted list of arguments
 */
public static List<Object> convertArguments(RelDataTypeFactory typeFactory,
    List<SqlNode> operandList, Function function,
    SqlIdentifier opName,
    boolean failOnNonLiteral) {
  List<Object> arguments = new ArrayList<>(operandList.size());
  // Construct a list of arguments, if they are all constants.
  for (Pair<FunctionParameter, SqlNode> pair
      : Pair.zip(function.getParameters(), operandList)) {
    try {
      final Object o = getValue(pair.right);
      final Object o2 = coerce(o, pair.left.getType(typeFactory));
      arguments.add(o2);
    } catch (NonLiteralException e) {
      if (failOnNonLiteral) {
        throw new IllegalArgumentException("All arguments of call to macro "
            + opName + " should be literal. Actual argument #"
            + pair.left.getOrdinal() + " (" + pair.left.getName()
            + ") is not literal: " + pair.right);
      }
      arguments.add(null);
    }
  }
  return arguments;
}
 
开发者ID:apache,项目名称:calcite,代码行数:36,代码来源:SqlUserDefinedTableMacro.java


示例12: getFunctions

import org.apache.calcite.schema.Function; //导入依赖的package包/类
public List<Function> getFunctions(final List<String> tableSchemaPath, final FileSystemPlugin plugin, final SchemaConfig schemaConfig) {
  List<TableSignature> sigs = getTableSignatures(tableSchemaPath.get(tableSchemaPath.size() - 1));
  return FluentIterable.from(sigs).transform(new com.google.common.base.Function<TableSignature, Function>() {
    @Override
    public Function apply(TableSignature input) {
      return new WithOptionsTableMacro(tableSchemaPath, input, plugin, schemaConfig);
    }
  }).toList();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:FormatPluginOptionExtractor.java


示例13: rawTableNames

import org.apache.calcite.schema.Function; //导入依赖的package包/类
private Set<String> rawTableNames() {
  return newHashSet(
      transform(tables.keySet(), new com.google.common.base.Function<TableInstance, String>() {
    @Override
    public String apply(TableInstance input) {
      return input.sig.name;
    }
  }));
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:10,代码来源:WorkspaceSchemaFactory.java


示例14: getFunctions

import org.apache.calcite.schema.Function; //导入依赖的package包/类
@Override
public List<Function> getFunctions(String name) {
  List<TableSignature> sigs = optionExtractor.getTableSignatures(name);
  return Lists.transform(sigs, new com.google.common.base.Function<TableSignature, Function>() {
    @Override
    public Function apply(TableSignature input) {
      return new WithOptionsTableMacro(input, WorkspaceSchema.this);
    }
  });
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:11,代码来源:WorkspaceSchemaFactory.java


示例15: addImplicitFunctionToBuilder

import org.apache.calcite.schema.Function; //导入依赖的package包/类
protected void addImplicitFunctionToBuilder(
        ImmutableList.Builder<Function> builder) {
    // Add implicit functions, case-insensitive.
    for (String name2
            : find(implicitFunctionCache.get(System.currentTimeMillis()), getName())) {
        final Collection<Function> functions = getSchema().getFunctions(name2);
        if (functions != null) {
            builder.addAll(functions);
        }
    }
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:12,代码来源:CachingCalciteSchema.java


示例16: getImplicitTableBasedOnNullaryFunction

import org.apache.calcite.schema.Function; //导入依赖的package包/类
protected TableEntry getImplicitTableBasedOnNullaryFunction(String tableName,
                                                            boolean caseSensitive) {
    for (String s : getSchema().getFunctionNames()) {
        for (Function function : getSchema().getFunctions(s)) {
            if (function instanceof TableMacro
                    && function.getParameters().isEmpty()) {
                final Table table = ((TableMacro) function).apply(ImmutableList.of());
                return tableEntry(tableName, table);
            }
        }
    }
    return null;
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:14,代码来源:SimpleCalciteSchema.java


示例17: add

import org.apache.calcite.schema.Function; //导入依赖的package包/类
private FunctionEntry add(String funcName, Function function) {
    final FunctionEntryImpl entry =
            new FunctionEntryImpl(this, funcName, function);
    functionMap.put(funcName, entry);
    functionNames.add(funcName);
    if (function.getParameters().isEmpty()) {
        nullaryFunctionMap.put(funcName, entry);
    }
    return entry;
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:11,代码来源:CalciteSchema.java


示例18: addImplicitFunctionsToBuilder

import org.apache.calcite.schema.Function; //导入依赖的package包/类
protected void addImplicitFunctionsToBuilder(
    ImmutableList.Builder<Function> builder,
    String name, boolean caseSensitive) {
  // Add implicit functions, case-insensitive.
  final long now = System.currentTimeMillis();
  final NameSet set = implicitFunctionCache.get(now);
  for (String name2 : set.range(name, caseSensitive)) {
    final Collection<Function> functions = schema.getFunctions(name2);
    if (functions != null) {
      builder.addAll(functions);
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:CachingCalciteSchema.java


示例19: addImplicitFunctionsToBuilder

import org.apache.calcite.schema.Function; //导入依赖的package包/类
protected void addImplicitFunctionsToBuilder(
    ImmutableList.Builder<Function> builder,
    String name, boolean caseSensitive) {
  Collection<Function> functions = schema.getFunctions(name);
  if (functions != null) {
    builder.addAll(functions);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:SimpleCalciteSchema.java


示例20: getImplicitTableBasedOnNullaryFunction

import org.apache.calcite.schema.Function; //导入依赖的package包/类
protected TableEntry getImplicitTableBasedOnNullaryFunction(String tableName,
    boolean caseSensitive) {
  Collection<Function> functions = schema.getFunctions(tableName);
  if (functions != null) {
    for (Function function : functions) {
      if (function instanceof TableMacro
          && function.getParameters().isEmpty()) {
        final Table table = ((TableMacro) function).apply(ImmutableList.of());
        return tableEntry(tableName, table);
      }
    }
  }
  return null;
}
 
开发者ID:apache,项目名称:calcite,代码行数:15,代码来源:SimpleCalciteSchema.java



注:本文中的org.apache.calcite.schema.Function类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ServerRequestImpl类代码示例发布时间:2022-05-22
下一篇:
Java GLProfiler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap