org.apache.calcite.rex.RexDynamicParam Java Examples

The following examples show how to use org.apache.calcite.rex.RexDynamicParam. 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: RexToLixTranslator.java    From calcite with Apache License 2.0 6 votes vote down vote up
@Override public Result visitDynamicParam(RexDynamicParam dynamicParam) {
  final Pair<RexNode, Type> key = Pair.of(dynamicParam, currentStorageType);
  if (rexWithStorageTypeResultMap.containsKey(key)) {
    return rexWithStorageTypeResultMap.get(key);
  }
  final Type storageType = currentStorageType != null
      ? currentStorageType : typeFactory.getJavaClass(dynamicParam.getType());
  final Expression valueExpression = EnumUtils.convert(
      Expressions.call(root, BuiltInMethod.DATA_CONTEXT_GET.method,
          Expressions.constant("?" + dynamicParam.getIndex())),
      storageType);
  final ParameterExpression valueVariable =
      Expressions.parameter(valueExpression.getType(), list.newName("value_dynamic_param"));
  list.add(Expressions.declare(Modifier.FINAL, valueVariable, valueExpression));
  final ParameterExpression isNullVariable =
      Expressions.parameter(Boolean.TYPE, list.newName("isNull_dynamic_param"));
  list.add(Expressions.declare(Modifier.FINAL, isNullVariable, checkNull(valueVariable)));
  final Result result = new Result(isNullVariable, valueVariable);
  rexWithStorageTypeResultMap.put(key, result);
  return result;
}
 
Example #2
Source File: CalcRelSplitter.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitDynamicParam(RexDynamicParam dynamicParam) {
    if (!relType.canImplement(dynamicParam)) {
        throw CannotImplement.INSTANCE;
    }
    return null;
}
 
Example #3
Source File: EnumerableLimit.java    From calcite with Apache License 2.0 5 votes vote down vote up
private static Expression getExpression(RexNode offset) {
  if (offset instanceof RexDynamicParam) {
    final RexDynamicParam param = (RexDynamicParam) offset;
    return Expressions.convert_(
        Expressions.call(DataContext.ROOT,
            BuiltInMethod.DATA_CONTEXT_GET.method,
            Expressions.constant("?" + param.getIndex())),
        Integer.class);
  } else {
    return Expressions.constant(RexLiteral.intValue(offset));
  }
}
 
Example #4
Source File: RexToExpr.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public LogicalExpression visitDynamicParam(RexDynamicParam dynamicParam) {
  return doUnknown(dynamicParam);
}
 
Example #5
Source File: RewriteCombineBinaryOperators.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public RexNode visitDynamicParam(RexDynamicParam dynamicParam) {
  return dynamicParam;
}
 
Example #6
Source File: FlattenVisitors.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Boolean visitDynamicParam(RexDynamicParam dynamicParam) {
  return doUnknown(dynamicParam);
}
 
Example #7
Source File: FlattenVisitors.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Void visitDynamicParam(RexDynamicParam dynamicParam) {
  return doUnknown(dynamicParam);
}
 
Example #8
Source File: RexVisitorComplexExprSplitter.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public RexNode visitDynamicParam(RexDynamicParam dynamicParam) {
  return dynamicParam;
}
 
Example #9
Source File: ProjectRelBase.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Boolean visitDynamicParam(RexDynamicParam dynamicParam) {
  return doUnknown(dynamicParam);
}
 
Example #10
Source File: MoreRelOptUtil.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Boolean visitDynamicParam(RexDynamicParam dynamicParam) {
  return false;
}
 
Example #11
Source File: MoreRelOptUtil.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Boolean visitDynamicParam(RexDynamicParam dynamicParam) {
  return false;
}
 
Example #12
Source File: ExpressionConverter.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public SearchQuery visitDynamicParam(RexDynamicParam dynamicParam) {
  return null;
}
 
Example #13
Source File: ORCFindRelevantFilters.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public RexNode visitDynamicParam(RexDynamicParam dynamicParam) {
  return null;
}
 
Example #14
Source File: ORCSearchArgumentGenerator.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Object visitDynamicParam(RexDynamicParam dynamicParam) {
  throw new IllegalArgumentException("this shouldn't be part of the input expression: " + dynamicParam);
}
 
Example #15
Source File: PredicateAnalyzer.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Expression visitDynamicParam(RexDynamicParam dynamicParam) {
  return super.visitDynamicParam(dynamicParam);
}
 
Example #16
Source File: ElasticSourceNameFinder.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public List<List<String>> visitDynamicParam(RexDynamicParam dynamicParam) {
  return visitUnknown(dynamicParam);
}
 
Example #17
Source File: ProjectAnalyzer.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public FunctionRender visitDynamicParam(RexDynamicParam dynamicParam) {
  return visitUnknown(dynamicParam);
}
 
Example #18
Source File: TupleFilterVisitor.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public TupleFilter visitDynamicParam(RexDynamicParam dynamicParam) {
    String name = dynamicParam.getName();
    TupleFilter filter = new DynamicTupleFilter(name);
    return filter;
}
 
Example #19
Source File: ReduceExpressionsRule.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Override public Void visitDynamicParam(RexDynamicParam dynamicParam) {
  return pushVariable();
}
 
Example #20
Source File: CalcRelSplitter.java    From calcite with Apache License 2.0 4 votes vote down vote up
public Void visitDynamicParam(RexDynamicParam dynamicParam) {
  if (!relType.canImplement(dynamicParam)) {
    throw CannotImplement.INSTANCE;
  }
  return null;
}
 
Example #21
Source File: RewriteAsBinaryOperators.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public RexNode visitDynamicParam(RexDynamicParam dynamicParam) {
  return dynamicParam;
}
 
Example #22
Source File: RexFactoryImpl.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public RexDynamicParam makeDynamicParam(RelDataType type, int index) {
    return new RexDynamicParamImpl(type, index);
}
 
Example #23
Source File: SimpleRexRemap.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public RexNode visitDynamicParam(RexDynamicParam dynamicParam) {
    return dynamicParam;
}
 
Example #24
Source File: RexToExpression.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public LogicalExpression visitDynamicParam(RexDynamicParam dynamicParam) {
  return addExprToRexs(super.visitDynamicParam(dynamicParam), dynamicParam);
}
 
Example #25
Source File: IndexableExprMarker.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public Boolean visitDynamicParam(RexDynamicParam dynamicParam) {
    return false;
}
 
Example #26
Source File: FindFiltersForCollation.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public Boolean visitDynamicParam(RexDynamicParam dynamicParam) {
  return false;
}
 
Example #27
Source File: FindPartitionConditions.java    From Bats with Apache License 2.0 4 votes vote down vote up
public Void visitDynamicParam(RexDynamicParam dynamicParam) {
  return pushVariable();
}
 
Example #28
Source File: RewriteAsBinaryOperators.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public RexNode visitDynamicParam(RexDynamicParam dynamicParam) {
  return dynamicParam;
}
 
Example #29
Source File: RewriteCombineBinaryOperators.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public RexNode visitDynamicParam(RexDynamicParam dynamicParam) {
  return dynamicParam;
}
 
Example #30
Source File: DrillOptiq.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public LogicalExpression visitDynamicParam(RexDynamicParam dynamicParam) {
  return doUnknown(dynamicParam);
}