本文整理汇总了Java中org.apache.calcite.plan.Convention类的典型用法代码示例。如果您正苦于以下问题:Java Convention类的具体用法?Java Convention怎么用?Java Convention使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Convention类属于org.apache.calcite.plan包,在下文中一共展示了Convention类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FilterRelBase
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
protected FilterRelBase(Convention convention, RelOptCluster cluster, RelTraitSet traits, RelNode child, RexNode condition) {
super(cluster, traits, child, condition);
assert getConvention() == convention;
// save the number of conjuncts that make up the filter condition such
// that repeated calls to the costing function can use the saved copy
conjunctions = RelOptUtil.conjunctions(condition);
numConjuncts = conjunctions.size();
// assert numConjuncts >= 1;
this.hasContains = ContainsRexVisitor.hasContainsCheckOrigin(this, this.getCondition(),-1);
boolean foundFlatten = false;
for (RexNode rex : this.getChildExps()) {
MoreRelOptUtil.FlattenRexVisitor visitor = new MoreRelOptUtil.FlattenRexVisitor();
if (rex.accept(visitor)) {
foundFlatten = true;
}
}
this.hasFlatten = foundFlatten;
}
示例2: ProjectRelBase
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
protected ProjectRelBase(Convention convention,
RelOptCluster cluster,
RelTraitSet traits,
RelNode child,
List<? extends RexNode> exps,
RelDataType rowType) {
super(cluster, traits, child, exps, rowType, Flags.BOXED);
assert getConvention() == convention;
nonSimpleFieldCount = this.getRowType().getFieldCount() - getSimpleFieldCount();
boolean foundContains = false;
int i = 0;
for (RexNode rex : this.getChildExps()) {
if (ContainsRexVisitor.hasContainsCheckOrigin(this, rex, i)) {
foundContains = true;
break;
}
i++;
}
this.hasContains = foundContains;
}
示例3: getRel
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
@Override
public RelNode getRel(final RelOptCluster cluster, final RelOptTable relOptTable, final ConversionContext.NamespaceConversionContext relContext) {
final DatasetConfig datasetConfig = relContext.getDatasetConfig();
BatchSchema schema = BatchSchema.fromDataset(datasetConfig);
return new OldScanCrel(cluster, new RelOptTableWrapper(datasetConfig.getFullPathList(), relOptTable),
cluster.traitSetOf(Convention.NONE),
BatchSchema.fromDataset(datasetConfig).toCalciteRecordType(cluster.getTypeFactory()),
new HBaseGroupScan(
ImpersonationUtil.getProcessUserName()/*impersonation not supported for HBASE*/,
this,
new HBaseScanSpec(datasetConfig.getName()),
OldAbstractGroupScan.ALL_COLUMNS,
schema,
datasetConfig.getFullPathList()
),
null,
OldScanRelBase.DEFAULT_ROW_COUNT_DISCOUNT
);
}
示例4: matches
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
@Override
public boolean matches(RelOptRuleCall call) {
Project topProject = call.rel(0);
Project bottomProject = call.rel(1);
// Make sure both projects be LogicalProject.
if (topProject.getTraitSet().getTrait(ConventionTraitDef.INSTANCE) != Convention.NONE ||
bottomProject.getTraitSet().getTrait(ConventionTraitDef.INSTANCE) != Convention.NONE) {
return false;
}
// We have a complex output type do not fire the merge project rule
if (checkComplexOutput(topProject) || checkComplexOutput(bottomProject)) {
return false;
}
return true;
}
示例5: CalcitePreparingStmt
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
public CalcitePreparingStmt(CalcitePrepareImpl prepare,
Context context,
CatalogReader catalogReader,
RelDataTypeFactory typeFactory,
CalciteSchema schema,
EnumerableRel.Prefer prefer,
RelOptPlanner planner,
Convention resultConvention,
SqlRexConvertletTable convertletTable) {
super(context, catalogReader, resultConvention);
this.prepare = prepare;
this.schema = schema;
this.prefer = prefer;
this.planner = planner;
this.typeFactory = typeFactory;
this.convertletTable = convertletTable;
this.rexBuilder = new RexBuilder(typeFactory);
}
示例6: create
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
/** Creates a LogicalProject, specifying row type rather than field names. */
public static LogicalProject create(final RelNode input,
final List<? extends RexNode> projects, RelDataType rowType) {
final RelOptCluster cluster = input.getCluster();
final RelMetadataQuery mq = cluster.getMetadataQuery();
final RelTraitSet traitSet =
cluster.traitSet().replace(Convention.NONE)
.replaceIfs(
RelCollationTraitDef.INSTANCE,
new Supplier<List<RelCollation>>() {
public List<RelCollation> get() {
return RelMdCollation.project(mq, input, projects);
}
});
return new LogicalProject(cluster, traitSet, input, projects, rowType);
}
示例7: create
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
public static LogicalCalc create(final RelNode input,
final RexProgram program) {
final RelOptCluster cluster = input.getCluster();
final RelMetadataQuery mq = cluster.getMetadataQuery();
final RelTraitSet traitSet = cluster.traitSet()
.replace(Convention.NONE)
.replaceIfs(RelCollationTraitDef.INSTANCE,
new Supplier<List<RelCollation>>() {
public List<RelCollation> get() {
return RelMdCollation.calc(mq, input, program);
}
})
.replaceIf(RelDistributionTraitDef.INSTANCE,
new Supplier<RelDistribution>() {
public RelDistribution get() {
return RelMdDistribution.calc(mq, input, program);
}
});
return new LogicalCalc(cluster, traitSet, input, program);
}
示例8: create
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
/** Creates a LogicalTableScan.
*
* @param cluster Cluster
* @param relOptTable Table
*/
public static LogicalTableScan create(RelOptCluster cluster,
final RelOptTable relOptTable) {
final Table table = relOptTable.unwrap(Table.class);
final RelTraitSet traitSet =
cluster.traitSetOf(Convention.NONE)
.replaceIfs(RelCollationTraitDef.INSTANCE,
new Supplier<List<RelCollation>>() {
public List<RelCollation> get() {
if (table != null) {
return table.getStatistic().getCollations();
}
return ImmutableList.of();
}
});
return new LogicalTableScan(cluster, traitSet, relOptTable);
}
示例9: CalcitePreparingStmt
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
CalcitePreparingStmt(CalcitePrepareImpl prepare,
Context context,
CatalogReader catalogReader,
RelDataTypeFactory typeFactory,
CalciteSchema schema,
EnumerableRel.Prefer prefer,
RelOptPlanner planner,
Convention resultConvention,
SqlRexConvertletTable convertletTable) {
super(context, catalogReader, resultConvention);
this.prepare = prepare;
this.schema = schema;
this.prefer = prefer;
this.planner = planner;
this.typeFactory = typeFactory;
this.convertletTable = convertletTable;
this.rexBuilder = new RexBuilder(typeFactory);
}
示例10: injectImportanceBoost
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
/**
* Finds RelSubsets in the plan that contain only rels of
* {@link Convention#NONE} and boosts their importance by 25%.
*/
private void injectImportanceBoost() {
final Set<RelSubset> requireBoost = new HashSet<>();
SUBSET_LOOP:
for (RelSubset subset : ruleQueue.subsetImportances.keySet()) {
for (RelNode rel : subset.getRels()) {
if (rel.getConvention() != Convention.NONE) {
continue SUBSET_LOOP;
}
}
requireBoost.add(subset);
}
ruleQueue.boostImportance(requireBoost, 1.25);
}
示例11: onMatch
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
public void onMatch(RelOptRuleCall call) {
LogicalProject rel = call.rel(0);
RelNode rawInput = call.rel(1);
RelNode input = convert(rawInput, PHYSICAL);
if (subsetHack && input instanceof RelSubset) {
RelSubset subset = (RelSubset) input;
for (RelNode child : subset.getRels()) {
// skip logical nodes
if (child.getTraitSet().getTrait(ConventionTraitDef.INSTANCE)
== Convention.NONE) {
continue;
} else {
RelTraitSet outcome = child.getTraitSet().replace(PHYSICAL);
call.transformTo(
new PhysProj(rel.getCluster(), outcome, convert(child, outcome),
rel.getChildExps(), rel.getRowType()));
}
}
} else {
call.transformTo(
PhysProj.create(input, rel.getChildExps(), rel.getRowType()));
}
}
示例12: DrillFilterRelBase
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
protected DrillFilterRelBase(Convention convention, RelOptCluster cluster, RelTraitSet traits, RelNode child, RexNode condition) {
super(cluster, traits, child, condition);
assert getConvention() == convention;
// save the number of conjuncts that make up the filter condition such
// that repeated calls to the costing function can use the saved copy
conjunctions = RelOptUtil.conjunctions(condition);
numConjuncts = conjunctions.size();
// assert numConjuncts >= 1;
}
示例13: OldScanCrel
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
public OldScanCrel(
RelOptCluster cluster,
RelOptTable relOptTable,
RelTraitSet traits,
RelDataType rowType,
GroupScan groupScan,
LayoutInfo layoutInfo,
double rowCountDiscount) {
super(cluster, traits, relOptTable, rowType, groupScan, rowCountDiscount);
this.layoutInfo = layoutInfo;
Preconditions.checkArgument(traits.getTrait(ConventionTraitDef.INSTANCE) == Convention.NONE);
}
示例14: register
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
public static void register(final Kryo kryo) {
final EnumSerializer enumSerializer = new EnumSerializer();
kryo.addDefaultSerializer(BindableConvention.class, enumSerializer);
kryo.addDefaultSerializer(EnumerableConvention.class, enumSerializer);
kryo.addDefaultSerializer(InterpretableConvention.class, enumSerializer);
kryo.addDefaultSerializer(Convention.Impl.class, ConventionSerializer.class);
kryo.addDefaultSerializer(RelDistributions.SINGLETON.getClass(), RelDistributionSerializer.class);
kryo.addDefaultSerializer(DistributionTrait.class, DistributionTraitSerializer.class);
kryo.addDefaultSerializer(RelCollation.class, RelCollationSerializer.class);
kryo.addDefaultSerializer(RelTraitSet.class, RelTraitSetSerializer.class);
}
示例15: read
import org.apache.calcite.plan.Convention; //导入依赖的package包/类
@Override
public T read(final Kryo kryo, final Input input, final Class<T> type) {
final boolean isNone = kryo.readObject(input, Boolean.class);
if (isNone) {
return (T)Convention.NONE;
}
final T result = super.read(kryo, input, type);
final T normalized = (T) result.getTraitDef().canonize(result);
kryo.reference(normalized);
return normalized;
}