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

Java ScannableTable类代码示例

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

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



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

示例1: get

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
public Profiler.Profile get() {
  final ProfilerImpl profiler =
      ProfilerImpl.builder()
          .withPassSize(200)
          .withMinimumSurprise(0.3D)
          .build();
  final List<Profiler.Column> columns = new ArrayList<>();
  for (Lattice.Column column : lattice.columns) {
    columns.add(new Profiler.Column(column.ordinal, column.alias));
  }
  final String sql =
      lattice.sql(ImmutableBitSet.range(lattice.columns.size()),
          false, ImmutableList.<Lattice.Measure>of());
  final Table table =
      new MaterializationService.DefaultTableFactory()
          .createTable(lattice.rootSchema, sql,
              ImmutableList.<String>of());
  final ImmutableList<ImmutableBitSet> initialGroups =
      ImmutableList.of();
  final Enumerable<List<Comparable>> rows =
      ((ScannableTable) table).scan(null).select(TO_LIST);
  return profiler.profile(rows, columns, initialGroups);
}
 
开发者ID:apache,项目名称:calcite,代码行数:24,代码来源:ProfilerLatticeStatisticProvider.java


示例2: deduceElementType

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
public static Class deduceElementType(Table table) {
  if (table instanceof QueryableTable) {
    final QueryableTable queryableTable = (QueryableTable) table;
    final Type type = queryableTable.getElementType();
    if (type instanceof Class) {
      return (Class) type;
    } else {
      return Object[].class;
    }
  } else if (table instanceof ScannableTable
      || table instanceof FilterableTable
      || table instanceof ProjectableFilterableTable
      || table instanceof StreamableTable) {
    return Object[].class;
  } else {
    return Object.class;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:EnumerableTableScan.java


示例3: toRows

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
private Expression toRows(PhysType physType, Expression expression) {
  if (physType.getFormat() == JavaRowFormat.SCALAR
      && Object[].class.isAssignableFrom(elementType)
      && getRowType().getFieldCount() == 1
      && (table.unwrap(ScannableTable.class) != null
          || table.unwrap(FilterableTable.class) != null
          || table.unwrap(ProjectableFilterableTable.class) != null)) {
    return Expressions.call(BuiltInMethod.SLICE0.method, expression);
  }
  JavaRowFormat oldFormat = format();
  if (physType.getFormat() == oldFormat && !hasCollectionField(rowType)) {
    return expression;
  }
  final ParameterExpression row_ =
      Expressions.parameter(elementType, "row");
  final int fieldCount = table.getRowType().getFieldCount();
  List<Expression> expressionList = new ArrayList<>(fieldCount);
  for (int i = 0; i < fieldCount; i++) {
    expressionList.add(fieldExpression(row_, i, physType, oldFormat));
  }
  return Expressions.call(expression,
      BuiltInMethod.SELECT.method,
      Expressions.lambda(Function1.class, physType.record(expressionList),
          row_));
}
 
开发者ID:apache,项目名称:calcite,代码行数:26,代码来源:EnumerableTableScan.java


示例4: create

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
/** Creates a {@link TableFunctionImpl} from a method. */
public static TableFunction create(final Method method) {
  if (!Modifier.isStatic(method.getModifiers())) {
    Class clazz = method.getDeclaringClass();
    if (!classHasPublicZeroArgsConstructor(clazz)) {
      throw RESOURCE.requireDefaultConstructor(clazz.getName()).ex();
    }
  }
  final Class<?> returnType = method.getReturnType();
  if (!QueryableTable.class.isAssignableFrom(returnType)
      && !ScannableTable.class.isAssignableFrom(returnType)) {
    return null;
  }
  CallImplementor implementor = createImplementor(method);
  return new TableFunctionImpl(method, implementor);
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:TableFunctionImpl.java


示例5: cardinality

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
private double cardinality(Lattice lattice, Lattice.Column column) {
  final String sql = lattice.countSql(ImmutableBitSet.of(column.ordinal));
  final Table table =
      new MaterializationService.DefaultTableFactory()
          .createTable(lattice.rootSchema, sql, ImmutableList.<String>of());
  final Object[] values =
      Iterables.getOnlyElement(((ScannableTable) table).scan(null));
  return ((Number) values[0]).doubleValue();
}
 
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:SqlLatticeStatisticProvider.java


示例6: canHandle

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
/** Returns whether EnumerableTableScan can generate code to handle a
 * particular variant of the Table SPI. */
public static boolean canHandle(Table table) {
  // FilterableTable and ProjectableFilterableTable cannot be handled in
  // enumerable convention because they might reject filters and those filters
  // would need to be handled dynamically.
  return table instanceof QueryableTable
      || table instanceof ScannableTable;
}
 
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:EnumerableTableScan.java


示例7: getElementType

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
public Type getElementType(List<Object> arguments) {
  final Table table = apply(arguments);
  if (table instanceof QueryableTable) {
    QueryableTable queryableTable = (QueryableTable) table;
    return queryableTable.getElementType();
  } else if (table instanceof ScannableTable) {
    return Object[].class;
  }
  throw new AssertionError("Invalid table class: " + table + " "
      + table.getClass());
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:TableFunctionImpl.java


示例8: create

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
/** Creates a TableScanNode.
 *
 * <p>Tries various table SPIs, and negotiates with the table which filters
 * and projects it can implement. Adds to the Enumerable implementations of
 * any filters and projects that cannot be implemented by the table. */
static TableScanNode create(Compiler compiler, TableScan rel,
    ImmutableList<RexNode> filters, ImmutableIntList projects) {
  final RelOptTable relOptTable = rel.getTable();
  final ProjectableFilterableTable pfTable =
      relOptTable.unwrap(ProjectableFilterableTable.class);
  if (pfTable != null) {
    return createProjectableFilterable(compiler, rel, filters, projects,
        pfTable);
  }
  final FilterableTable filterableTable =
      relOptTable.unwrap(FilterableTable.class);
  if (filterableTable != null) {
    return createFilterable(compiler, rel, filters, projects,
        filterableTable);
  }
  final ScannableTable scannableTable =
      relOptTable.unwrap(ScannableTable.class);
  if (scannableTable != null) {
    return createScannable(compiler, rel, filters, projects,
        scannableTable);
  }
  //noinspection unchecked
  final Enumerable<Row> enumerable = relOptTable.unwrap(Enumerable.class);
  if (enumerable != null) {
    return createEnumerable(compiler, rel, enumerable, null, filters,
        projects);
  }
  final QueryableTable queryableTable =
      relOptTable.unwrap(QueryableTable.class);
  if (queryableTable != null) {
    return createQueryable(compiler, rel, filters, projects,
        queryableTable);
  }
  throw new AssertionError("cannot convert table " + relOptTable
      + " to enumerable");
}
 
开发者ID:apache,项目名称:calcite,代码行数:42,代码来源:TableScanNode.java


示例9: createScannable

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
private static TableScanNode createScannable(Compiler compiler, TableScan rel,
    ImmutableList<RexNode> filters, ImmutableIntList projects,
    ScannableTable scannableTable) {
  final Enumerable<Row> rowEnumerable =
      Enumerables.toRow(scannableTable.scan(compiler.getDataContext()));
  return createEnumerable(compiler, rel, rowEnumerable, null, filters,
      projects);
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:TableScanNode.java


示例10: generate2

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
public static ScannableTable generate2(
    @Parameter(name = "WIDTH") int width,
    @Parameter(name = "HEIGHT") int height,
    @Parameter(name = "SEED", optional = true) Integer seed) {
  return new MazeTable(
      String.format(Locale.ROOT, "generate2(w=%d, h=%d, s=%d)", width,
          height, seed));
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:Smalls.java


示例11: bind

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
@Override public Enumerable<Object[]> bind(DataContext dataContext) {
  return table.unwrap(ScannableTable.class).scan(dataContext);
}
 
开发者ID:apache,项目名称:calcite,代码行数:4,代码来源:DruidQuery.java


示例12: canHandle

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
public static boolean canHandle(RelOptTable table) {
  return table.unwrap(ScannableTable.class) != null
      || table.unwrap(FilterableTable.class) != null
      || table.unwrap(ProjectableFilterableTable.class) != null;
}
 
开发者ID:apache,项目名称:calcite,代码行数:6,代码来源:Bindables.java


示例13: bind

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
public Enumerable<Object[]> bind(DataContext dataContext) {
  // TODO: filterable and projectable
  return table.unwrap(ScannableTable.class).scan(dataContext);
}
 
开发者ID:apache,项目名称:calcite,代码行数:5,代码来源:Bindables.java


示例14: fibonacciTable

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
/** A function that generates the Fibonacci sequence.
 * Interesting because it has one column and no arguments. */
public static ScannableTable fibonacciTable() {
  return fibonacciTableWithLimit(-1L);
}
 
开发者ID:apache,项目名称:calcite,代码行数:6,代码来源:Smalls.java


示例15: generate

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
public static ScannableTable generate(int width, int height, int seed) {
  return new MazeTable(
      String.format(Locale.ROOT, "generate(w=%d, h=%d, s=%d)", width,
          height, seed));
}
 
开发者ID:apache,项目名称:calcite,代码行数:6,代码来源:Smalls.java


示例16: generate3

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
public static ScannableTable generate3(
    @Parameter(name = "FOO") String foo) {
  return new MazeTable(
      String.format(Locale.ROOT, "generate3(foo=%s)", foo));
}
 
开发者ID:apache,项目名称:calcite,代码行数:6,代码来源:Smalls.java


示例17: generate

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
/** Table function that generates a maze.
 *
 * <p>Called by reflection based on the definition of the user-defined
 * function in the schema.
 *
 * @param width Width of maze
 * @param height Height of maze
 * @param seed Random number seed, or -1 to create an unseeded random
 * @return Table that prints the maze in text form
 */
@SuppressWarnings("unused") // called via reflection
public static ScannableTable generate(int width, int height, int seed) {
  return new MazeTable(width, height, seed, false);
}
 
开发者ID:apache,项目名称:calcite,代码行数:15,代码来源:MazeTable.java


示例18: solve

import org.apache.calcite.schema.ScannableTable; //导入依赖的package包/类
/** Table function that generates a maze with a solution.
 *
 * <p>Called by reflection based on the definition of the user-defined
 * function in the schema.
 *
 * @param width Width of maze
 * @param height Height of maze
 * @param seed Random number seed, or -1 to create an unseeded random
 * @return Table that prints the maze in text form, with solution shown
 */
@SuppressWarnings("unused") // called via reflection
public static ScannableTable solve(int width, int height, int seed) {
  return new MazeTable(width, height, seed, true);
}
 
开发者ID:apache,项目名称:calcite,代码行数:15,代码来源:MazeTable.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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