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

Java RelOptTableImpl类代码示例

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

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



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

示例1: createModify

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
/** Creates a relational expression to modify a table or modifiable view. */
private RelNode createModify(RelOptTable targetTable, RelNode source) {
	final ModifiableTable modifiableTable =
		targetTable.unwrap(ModifiableTable.class);
	if (modifiableTable != null) {
		return modifiableTable.toModificationRel(cluster, targetTable,
			catalogReader, source, LogicalTableModify.Operation.INSERT, null,
			null, false);
	}
	final ModifiableView modifiableView =
		targetTable.unwrap(ModifiableView.class);
	if (modifiableView != null) {
		final Table delegateTable = modifiableView.getTable();
		final RelDataType delegateRowType = delegateTable.getRowType(typeFactory);
		final RelOptTable delegateRelOptTable =
			RelOptTableImpl.create(null, delegateRowType, delegateTable,
				modifiableView.getTablePath());
		final RelNode newSource =
			createSource(targetTable, source, modifiableView, delegateRowType);
		return createModify(delegateRelOptTable, newSource);
	}
	return LogicalTableModify.create(targetTable, catalogReader, source,
		LogicalTableModify.Operation.INSERT, null, null, false);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:SqlToRelConverter.java


示例2: createNewTableScanFromSelection

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
private TableScan createNewTableScanFromSelection(EnumerableTableScan oldScan, List<String> newFiles, String cacheFileRoot,
    boolean wasAllPartitionsPruned, MetadataContext metaContext) {
  final RelOptTableImpl t = (RelOptTableImpl) oldScan.getTable();
  final FormatSelection formatSelection = (FormatSelection) table.getSelection();
  final FileSelection newFileSelection = new FileSelection(null, newFiles, getBaseTableLocation(),
          cacheFileRoot, wasAllPartitionsPruned, formatSelection.getSelection().getDirStatus());
  newFileSelection.setMetaContext(metaContext);
  final FormatSelection newFormatSelection = new FormatSelection(formatSelection.getFormat(), newFileSelection);
  final DrillTranslatableTable newTable = new DrillTranslatableTable(
          new DynamicDrillTable(table.getPlugin(), table.getStorageEngineName(),
          table.getUserName(),
          newFormatSelection));
  final RelOptTableImpl newOptTableImpl = RelOptTableImpl.create(t.getRelOptSchema(), t.getRowType(), newTable);

  // return an EnumerableTableScan with fileSelection being part of digest of TableScan node.
  return DirPrunedEnumerableTableScan.create(oldScan.getCluster(), newOptTableImpl, newFileSelection.toString());
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:18,代码来源:FileSystemPartitionDescriptor.java


示例3: populateMaterializationsAndLattice

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
private void populateMaterializationsAndLattice(
    QuarkMaterializeCluster.RelOptPlannerHolder plannerHolder,
    CalciteSchema rootSchema) {
  if (materializations == null) {
    materializations =
        MaterializationService.instance().query(rootSchema);
  }
  Materializer materializer = new Materializer(materializations);

  materializer.populateMaterializations(context.getPrepareContext(), plannerHolder);

  List<CalciteSchema.LatticeEntry> lattices = Schemas.getLatticeEntries(rootSchema);

  for (CalciteSchema.LatticeEntry lattice : lattices) {
    final CalciteSchema.TableEntry starTable = lattice.getStarTable();
    final JavaTypeFactory typeFactory = context.getTypeFactory();
    final RelOptTableImpl starRelOptTable =
        RelOptTableImpl.create(catalogReader,
            starTable.getTable().getRowType(typeFactory), starTable, null);
    plannerHolder.getPlanner().addLattice(
        new RelOptLattice(lattice.getLattice(), starRelOptTable));
  }
}
 
开发者ID:qubole,项目名称:quark,代码行数:24,代码来源:SqlWorker.java


示例4: createModify

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
/** Creates a relational expression to modify a table or modifiable view. */
private RelNode createModify(RelOptTable targetTable, RelNode source) {
  final ModifiableTable modifiableTable =
      targetTable.unwrap(ModifiableTable.class);
  if (modifiableTable != null) {
    return modifiableTable.toModificationRel(cluster, targetTable,
        catalogReader, source, LogicalTableModify.Operation.INSERT, null,
        null, false);
  }
  final ModifiableView modifiableView =
      targetTable.unwrap(ModifiableView.class);
  if (modifiableView != null) {
    final Table delegateTable = modifiableView.getTable();
    final RelDataType delegateRowType = delegateTable.getRowType(typeFactory);
    final RelOptTable delegateRelOptTable =
        RelOptTableImpl.create(null, delegateRowType, delegateTable,
            modifiableView.getTablePath());
    final RelNode newSource =
        createSource(targetTable, source, modifiableView, delegateRowType);
    return createModify(delegateRelOptTable, newSource);
  }
  return LogicalTableModify.create(targetTable, catalogReader, source,
      LogicalTableModify.Operation.INSERT, null, null, false);
}
 
开发者ID:apache,项目名称:kylin,代码行数:25,代码来源:SqlToRelConverter.java


示例5: onMatch

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
@Override public void onMatch(RelOptRuleCall call) {
  final Delta delta = call.rel(0);
  final TableScan scan = call.rel(1);
  final RelOptCluster cluster = delta.getCluster();
  final RelOptTable relOptTable = scan.getTable();
  final StreamableTable streamableTable =
      relOptTable.unwrap(StreamableTable.class);
  if (streamableTable != null) {
    final Table table1 = streamableTable.stream();
    final RelOptTable relOptTable2 =
        RelOptTableImpl.create(relOptTable.getRelOptSchema(),
            relOptTable.getRowType(), table1,
            ImmutableList.<String>builder()
                .addAll(relOptTable.getQualifiedName())
                .add("(STREAM)").build());
    final LogicalTableScan newScan =
        LogicalTableScan.create(cluster, relOptTable2);
    call.transformTo(newScan);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:21,代码来源:StreamRules.java


示例6: createModify

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
/** Creates a relational expression to modify a table or modifiable view. */
private RelNode createModify(RelOptTable targetTable, RelNode source) {
  final ModifiableTable modifiableTable =
      targetTable.unwrap(ModifiableTable.class);
  if (modifiableTable != null
      && modifiableTable == targetTable.unwrap(Table.class)) {
    return modifiableTable.toModificationRel(cluster, targetTable,
        catalogReader, source, LogicalTableModify.Operation.INSERT, null,
        null, false);
  }
  final ModifiableView modifiableView =
      targetTable.unwrap(ModifiableView.class);
  if (modifiableView != null) {
    final Table delegateTable = modifiableView.getTable();
    final RelDataType delegateRowType = delegateTable.getRowType(typeFactory);
    final RelOptTable delegateRelOptTable =
        RelOptTableImpl.create(null, delegateRowType, delegateTable,
            modifiableView.getTablePath());
    final RelNode newSource =
        createSource(targetTable, source, modifiableView, delegateRowType);
    return createModify(delegateRelOptTable, newSource);
  }
  return LogicalTableModify.create(targetTable, catalogReader, source,
      LogicalTableModify.Operation.INSERT, null, null, false);
}
 
开发者ID:apache,项目名称:calcite,代码行数:26,代码来源:SqlToRelConverter.java


示例7: copyOf

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
public RelOptTable copyOf(RelOptTable table) {
  if (table instanceof RelOptTableWrapper) {
    final RelOptTableWrapper wrapper = (RelOptTableWrapper) table;
    return new RelOptTableWrapper(
      wrapper.getQualifiedName(),
      copyOf(wrapper.getRelOptTable())
    );
  } else if (table instanceof RelOptTableImpl) {
    final RelOptTableImpl impl = (RelOptTableImpl) table;
    return impl.copy(copyOf(impl.getRowType())); // this won't copy the RelOptSchema
  }
  notSupported(table);
  return table;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:15,代码来源:CopyWithCluster.java


示例8: read

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
@Override
public RelOptNamespaceTable read(final Kryo kryo, final Input input, final Class<RelOptNamespaceTable> type) {
  final List<String> path = kryo.readObject(input, ArrayList.class);
  final RelOptTableImpl relOptTable = catalog.getTable(path);
  if(relOptTable == null){
    throw new IllegalStateException("Unable to retrieve table: " + new NamespaceKey(path));
  }
  NamespaceTable namespace = relOptTable.unwrap(NamespaceTable.class);
  return new RelOptNamespaceTable(namespace, cluster);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:RelOptNamespaceTableSerializer.java


示例9: read

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
@Override
public TableMetadata read(final Kryo kryo, final Input input, final Class<TableMetadata> type) {
  final List<String> path = kryo.readObject(input, ArrayList.class);
  final RelOptTableImpl relOptTable = catalog.getTable(path);
  NamespaceTable namespace = relOptTable.unwrap(NamespaceTable.class);
  return namespace.getDataset();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:8,代码来源:TableMetadataSerializer.java


示例10: getTable

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
/**
 * If schema is not indicated (only one element in the list) or schema is default temporary workspace,
 * we need to check among session temporary tables in default temporary workspace first.
 * If temporary table is found and temporary tables usage is allowed, its table instance will be returned,
 * otherwise search will be conducted in original workspace.
 *
 * @param names list of schema and table names, table name is always the last element
 * @return table instance, null otherwise
 * @throws UserException if temporary tables usage is disallowed
 */
@Override
public RelOptTableImpl getTable(final List<String> names) {
  RelOptTableImpl temporaryTable = null;

  if (mightBeTemporaryTable(names, session.getDefaultSchemaPath(), drillConfig)) {
    String temporaryTableName = session.resolveTemporaryTableName(names.get(names.size() - 1));
    if (temporaryTableName != null) {
      List<String> temporaryNames = Lists.newArrayList(temporarySchema, temporaryTableName);
      temporaryTable = super.getTable(temporaryNames);
    }
  }
  if (temporaryTable != null) {
    if (allowTemporaryTables) {
      return temporaryTable;
    }
    throw UserException
        .validationError()
        .message("Temporary tables usage is disallowed. Used temporary table name: %s.", names)
        .build(logger);
  }

  RelOptTableImpl table = super.getTable(names);

  // Check the schema and throw a valid SchemaNotFound exception instead of TableNotFound exception.
  if (table == null) {
    isValidSchema(names);
  }

  return table;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:41,代码来源:SqlConverter.java


示例11: QuarkViewTable

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
public QuarkViewTable(QuarkSchema schema,
                      String name,
                      RelOptTableImpl relOptTable,
                      QuarkTable backupTable,
                      CalciteSchema tableSchema) {
  super(schema, name, backupTable.getColumns());
  this.backUpRelOptTable = relOptTable;
  this.backupTable = backupTable;
  this.backupTableSchema = tableSchema;
}
 
开发者ID:qubole,项目名称:quark,代码行数:11,代码来源:QuarkViewTable.java


示例12: QuarkTileTable

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
public QuarkTileTable(QuarkTile quarkTile, CalciteCatalogReader calciteCatalogReader,
                      RelDataType relDataType, Path path, QuarkTable backingTable) {
  this.quarkTile = quarkTile;
  this.backingTable = backingTable;
  this.relOptTable = RelOptTableImpl.create(
      calciteCatalogReader,
      relDataType,
      this,
      path);
}
 
开发者ID:qubole,项目名称:quark,代码行数:11,代码来源:QuarkTileTable.java


示例13: toRel

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
public RelNode toRel(final RelOptTable table) {
  final RelNode scan = table.toRel(createToRelContext());

  final InitializerExpressionFactory ief =
      Util.first(table.unwrap(InitializerExpressionFactory.class),
          NullInitializerExpressionFactory.INSTANCE);

  // Lazily create a blackboard that contains all non-generated columns.
  final Supplier<Blackboard> bb = new Supplier<Blackboard>() {
    public Blackboard get() {
      RexNode sourceRef = rexBuilder.makeRangeReference(scan);
      return createInsertBlackboard(table, sourceRef,
          table.getRowType().getFieldNames());
    }
  };

  int virtualCount = 0;
  final List<RexNode> list = new ArrayList<>();
  for (RelDataTypeField f : table.getRowType().getFieldList()) {
    final ColumnStrategy strategy =
        ief.generationStrategy(table, f.getIndex());
    switch (strategy) {
    case VIRTUAL:
      list.add(ief.newColumnDefaultValue(table, f.getIndex(), bb.get()));
      ++virtualCount;
      break;
    default:
      list.add(
          rexBuilder.makeInputRef(scan,
              RelOptTableImpl.realOrdinal(table, f.getIndex())));
    }
  }
  if (virtualCount > 0) {
    relBuilder.push(scan);
    relBuilder.project(list);
    return relBuilder.build();
  }
  return scan;
}
 
开发者ID:apache,项目名称:calcite,代码行数:40,代码来源:SqlToRelConverter.java


示例14: getJdbcTable

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
static JdbcTable getJdbcTable(RelNode originalRel) {
	return (JdbcTable) get(RelOptTableImpl.class, originalRel.getTable(), "table");
}
 
开发者ID:tzolov,项目名称:calcite-sql-rewriter,代码行数:4,代码来源:JdbcTableUtils.java


示例15: write

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
@Override
public void write(final Kryo kryo, final Output output, final RelOptTableImpl relOptTable) {
  final List<String> path = relOptTable.getQualifiedName();
  kryo.writeObject(output, path);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:6,代码来源:RelOptTableImplSerializer.java


示例16: read

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
@Override
public RelOptTableImpl read(final Kryo kryo, final Input input, final Class<RelOptTableImpl> type) {
  final List<String> path = kryo.readObject(input, ArrayList.class);
  final RelOptTableImpl relOptTable = catalog.getTable(path);
  return relOptTable;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:7,代码来源:RelOptTableImplSerializer.java


示例17: resolve_

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
private void resolve_(final CalciteSchema rootSchema, List<String> names,
    List<String> schemaNames, SqlNameMatcher nameMatcher, Path path,
    Resolved resolved) {
  final List<String> concat = ImmutableList.<String>builder()
      .addAll(schemaNames).addAll(names).build();
  CalciteSchema schema = rootSchema;
  SqlValidatorNamespace namespace = null;
  List<String> remainingNames = concat;
  for (String schemaName : concat) {
    if (schema == rootSchema
        && nameMatcher.matches(schemaName, schema.name)) {
      remainingNames = Util.skip(remainingNames);
      continue;
    }
    final CalciteSchema subSchema =
        schema.getSubSchema(schemaName, nameMatcher.isCaseSensitive());
    if (subSchema != null) {
      path = path.plus(null, -1, subSchema.name, StructKind.NONE);
      remainingNames = Util.skip(remainingNames);
      schema = subSchema;
      namespace = new SchemaNamespace(validator,
          ImmutableList.copyOf(path.stepNames()));
      continue;
    }
    CalciteSchema.TableEntry entry =
        schema.getTable(schemaName, nameMatcher.isCaseSensitive());
    if (entry == null) {
      entry = schema.getTableBasedOnNullaryFunction(schemaName,
          nameMatcher.isCaseSensitive());
    }
    if (entry != null) {
      path = path.plus(null, -1, entry.name, StructKind.NONE);
      remainingNames = Util.skip(remainingNames);
      final Table table = entry.getTable();
      SqlValidatorTable table2 = null;
      if (table instanceof Wrapper) {
        table2 = ((Wrapper) table).unwrap(Prepare.PreparingTable.class);
      }
      if (table2 == null) {
        final RelOptSchema relOptSchema =
            validator.catalogReader.unwrap(RelOptSchema.class);
        final RelDataType rowType = table.getRowType(validator.typeFactory);
        table2 = RelOptTableImpl.create(relOptSchema, rowType, entry, null);
      }
      namespace = new TableNamespace(validator, table2);
      resolved.found(namespace, false, this, path, remainingNames);
      return;
    }
    // neither sub-schema nor table
    if (namespace != null
        && !remainingNames.equals(names)) {
      resolved.found(namespace, false, this, path, remainingNames);
    }
    return;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:57,代码来源:EmptyScope.java


示例18: getColumnStrategies

import org.apache.calcite.prepare.RelOptTableImpl; //导入依赖的package包/类
public List<ColumnStrategy> getColumnStrategies() {
  return RelOptTableImpl.columnStrategies(this);
}
 
开发者ID:apache,项目名称:calcite,代码行数:4,代码来源:RelOptAbstractTable.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ScalarStyle类代码示例发布时间:2022-05-23
下一篇:
Java FRETypeMismatchException类代码示例发布时间: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