Java Code Examples for org.apache.calcite.rel.RelWriter#item()

The following examples show how to use org.apache.calcite.rel.RelWriter#item() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Values.java    From Bats with Apache License 2.0 6 votes vote down vote up
public RelWriter explainTerms(RelWriter pw) {
  // A little adapter just to get the tuples to come out
  // with curly brackets instead of square brackets.  Plus
  // more whitespace for readability.
  RelWriter relWriter = super.explainTerms(pw)
      // For rel digest, include the row type since a rendered
      // literal may leave the type ambiguous (e.g. "null").
      .itemIf("type", rowType,
          pw.getDetailLevel() == SqlExplainLevel.DIGEST_ATTRIBUTES)
      .itemIf("type", rowType.getFieldList(), pw.nest());
  if (pw.nest()) {
    pw.item("tuples", tuples);
  } else {
    pw.item("tuples",
        tuples.stream()
            .map(row -> row.stream()
                .map(lit -> lit.computeDigest(RexDigestIncludeType.NO_TYPE))
                .collect(Collectors.joining(", ", "{ ", " }")))
            .collect(Collectors.joining(", ", "[", "]")));
  }
  return relWriter;
}
 
Example 2
Source File: TableFunctionScan.java    From calcite with Apache License 2.0 5 votes vote down vote up
public RelWriter explainTerms(RelWriter pw) {
  super.explainTerms(pw);
  for (Ord<RelNode> ord : Ord.zip(inputs)) {
    pw.input("input#" + ord.i, ord.e);
  }
  pw.item("invocation", rexCall)
    .item("rowType", rowType);
  if (elementType != null) {
    pw.item("elementType", elementType);
  }
  return pw;
}
 
Example 3
Source File: ParquetScanPrel.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public RelWriter explainTerms(RelWriter pw) {
  pw = super.explainTerms(pw);
  if(filter != null){
    return pw.item("filters",  filter);
  }
  return pw;
}
 
Example 4
Source File: FilesystemScanDrel.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public RelWriter explainTerms(RelWriter pw) {
  pw = super.explainTerms(pw);
  if(filter != null){
    return pw.item("filters", filter);
  }
  return pw;
}
 
Example 5
Source File: Window.java    From calcite with Apache License 2.0 5 votes vote down vote up
public RelWriter explainTerms(RelWriter pw) {
  super.explainTerms(pw);
  for (Ord<Group> window : Ord.zip(groups)) {
    pw.item("window#" + window.i, window.e.toString());
  }
  return pw;
}
 
Example 6
Source File: HashToRandomExchangePrel.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public RelWriter explainTerms(RelWriter pw) {
  super.explainTerms(pw);
    for (Ord<DistributionField> ord : Ord.zip(fields)) {
      pw.item("dist" + ord.i, ord.e);
    }
  return pw;
}
 
Example 7
Source File: RelSubset.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Override public void explain(RelWriter pw) {
  // Not a typical implementation of "explain". We don't gather terms &
  // values to be printed later. We actually do the work.
  pw.item("subset", toString());
  final AbstractRelNode input =
      (AbstractRelNode) Util.first(getBest(), getOriginal());
  if (input == null) {
    return;
  }
  input.explainTerms(pw);
  pw.done(input);
}
 
Example 8
Source File: Aggregate.java    From calcite with Apache License 2.0 5 votes vote down vote up
public RelWriter explainTerms(RelWriter pw) {
  // We skip the "groups" element if it is a singleton of "group".
  super.explainTerms(pw)
      .item("group", groupSet)
      .itemIf("groups", groupSets, getGroupType() != Group.SIMPLE)
      .itemIf("aggs", aggCalls, pw.nest());
  if (!pw.nest()) {
    for (Ord<AggregateCall> ord : Ord.zip(aggCalls)) {
      pw.item(Util.first(ord.e.name, "agg#" + ord.i), ord.e);
    }
  }
  return pw;
}
 
Example 9
Source File: HashToRandomExchangePrel.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Override
public RelWriter explainTerms(RelWriter pw) {
  super.explainTerms(pw);
    for (Ord<DistributionField> ord : Ord.zip(fields)) {
      pw.item("dist" + ord.i, ord.e);
    }
  return pw;
}
 
Example 10
Source File: RangePartitionExchangePrel.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Override
public RelWriter explainTerms(RelWriter pw) {
  super.explainTerms(pw);
    for (Ord<DistributionField> ord : Ord.zip(fields)) {
      pw.item("dist" + ord.i, ord.e);
    }
  return pw;
}
 
Example 11
Source File: AbstractConverter.java    From Bats with Apache License 2.0 5 votes vote down vote up
public RelWriter explainTerms(RelWriter pw) {
  super.explainTerms(pw);
  for (RelTrait trait : traitSet) {
    pw.item(trait.getTraitDef().getSimpleName(), trait);
  }
  return pw;
}
 
Example 12
Source File: AbstractConverter.java    From calcite with Apache License 2.0 5 votes vote down vote up
public RelWriter explainTerms(RelWriter pw) {
  super.explainTerms(pw);
  for (RelTrait trait : traitSet) {
    pw.item(trait.getTraitDef().getSimpleName(), trait);
  }
  return pw;
}
 
Example 13
Source File: TableFunctionScan.java    From Bats with Apache License 2.0 5 votes vote down vote up
public RelWriter explainTerms(RelWriter pw) {
  super.explainTerms(pw);
  for (Ord<RelNode> ord : Ord.zip(inputs)) {
    pw.input("input#" + ord.i, ord.e);
  }
  pw.item("invocation", rexCall)
    .item("rowType", rowType);
  if (elementType != null) {
    pw.item("elementType", elementType);
  }
  return pw;
}
 
Example 14
Source File: Aggregate.java    From Bats with Apache License 2.0 5 votes vote down vote up
public RelWriter explainTerms(RelWriter pw) {
  // We skip the "groups" element if it is a singleton of "group".
  super.explainTerms(pw)
      .item("group", groupSet)
      .itemIf("groups", groupSets, getGroupType() != Group.SIMPLE)
      .itemIf("indicator", indicator, indicator)
      .itemIf("aggs", aggCalls, pw.nest());
  if (!pw.nest()) {
    for (Ord<AggregateCall> ord : Ord.zip(aggCalls)) {
      pw.item(Util.first(ord.e.name, "agg#" + ord.i), ord.e);
    }
  }
  return pw;
}
 
Example 15
Source File: Window.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Override
public RelWriter explainTerms(RelWriter pw) {
    super.explainTerms(pw);
    for (Ord<Group> window : Ord.zip(groups)) {
        pw.item("window#" + window.i, window.e.toString());
    }
    return pw;
}
 
Example 16
Source File: EnumerableBatchNestedLoopJoin.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Override public RelWriter explainTerms(RelWriter pw) {
  super.explainTerms(pw);
  return pw.item("batchSize", variablesSet.size());
}
 
Example 17
Source File: EmptyRel.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public RelWriter explainTerms(RelWriter pw) {
  return pw.item("schema", schema.toString());
}
 
Example 18
Source File: EmptyPrel.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public RelWriter explainTerms(RelWriter pw) {
  return pw.item("schema", schema.toString());
}
 
Example 19
Source File: TableSpool.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Override public RelWriter explainTerms(RelWriter pw) {
  super.explainTerms(pw);
  return pw.item("table", table.getQualifiedName());
}
 
Example 20
Source File: HiveRulesFactory.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public RelWriter explainTerms(RelWriter pw) {
  pw = super.explainTerms(pw);
  pw = pw.item("mode", readerType.name());
  return pw.itemIf("filters", filter, filter != null);
}