当前位置: 首页>>代码示例>>Java>>正文


Java RelBuilder.call方法代码示例

本文整理汇总了Java中org.apache.calcite.tools.RelBuilder.call方法的典型用法代码示例。如果您正苦于以下问题:Java RelBuilder.call方法的具体用法?Java RelBuilder.call怎么用?Java RelBuilder.call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.tools.RelBuilder的用法示例。


在下文中一共展示了RelBuilder.call方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluate

import org.apache.calcite.tools.RelBuilder; //导入方法依赖的package包/类
/**
 * Evaluates a {@link NumericHaving}.
 *
 * @param having  The NumericHaving filter to be evaluated.
 * @param builder  The RelBuilder used with Calcite to make queries.
 * @param apiToFieldMapper  A function to get the aliased aggregation's name from the metric name.
 *
 * @return the equivalent {@link RexNode} to be used in a sql query.
 */
public RexNode evaluate(NumericHaving having, RelBuilder builder, ApiToFieldMapper apiToFieldMapper) {
    Having.DefaultHavingType havingType = (Having.DefaultHavingType) having.getType();
    SqlOperator operator = null;
    switch (havingType) {
        case EQUAL_TO:
            operator = SqlStdOperatorTable.EQUALS;
            break;
        case LESS_THAN:
            operator = SqlStdOperatorTable.LESS_THAN;
            break;
        case GREATER_THAN:
            operator = SqlStdOperatorTable.GREATER_THAN;
            break;
    }
    return builder.call(
            operator,
            builder.field(apiToFieldMapper.apply(having.getAggregation())),
            builder.literal(having.getValue())
    );
}
 
开发者ID:yahoo,项目名称:fili,代码行数:30,代码来源:HavingEvaluator.java

示例2: listEvaluate

import org.apache.calcite.tools.RelBuilder; //导入方法依赖的package包/类
/**
 * Evaluates a {@link MultiClauseHaving} filter by performing it's operation over a list of other havings.
 *
 * @param multiClauseHaving  The MultiClauseHaving filter to be evaluated.
 * @param operator  The operator to be performed over the inner clauses of this having filter.
 * @param builder  The RelBuilder used with Calcite to make queries.
 * @param apiToFieldMapper  A function to get the aliased aggregation's name from the metric name.
 *
 * @return the equivalent {@link RexNode} to be used in a sql query.
 */
public RexNode listEvaluate(
        MultiClauseHaving multiClauseHaving,
        SqlOperator operator,
        RelBuilder builder,
        ApiToFieldMapper apiToFieldMapper
) {
    List<RexNode> rexNodes = multiClauseHaving.getHavings()
            .stream()
            .map(having -> dispatcher.invoke(having, builder, apiToFieldMapper))
            .collect(Collectors.toList());

    return builder.call(
            operator,
            rexNodes
    );
}
 
开发者ID:yahoo,项目名称:fili,代码行数:27,代码来源:HavingEvaluator.java

示例3: listEvaluate

import org.apache.calcite.tools.RelBuilder; //导入方法依赖的package包/类
/**
 * Evaluates a complex filter by performing a {@link SqlOperator} over a list of dimensions.
 *
 * @param complexFilter  A complexFilter to be evaluated.
 * @param operator  The sql operator to be applied to a complexFilter's fields.
 * @param builder  The RelBuilder used to build queries with Calcite.
 * @param apiToFieldMapper  A function to get the aliased aggregation's name from the metric name.
 *
 * @return a RexNode containing an equivalent filter to the one given.
 */
private RexNode listEvaluate(
        ComplexFilter complexFilter,
        SqlOperator operator,
        RelBuilder builder,
        ApiToFieldMapper apiToFieldMapper
) {
    List<RexNode> rexNodes = complexFilter.getFields()
            .stream()
            .map(filter -> dispatcher.invoke(filter, builder, apiToFieldMapper))
            .collect(Collectors.toList());

    return builder.call(
            operator,
            rexNodes
    );
}
 
开发者ID:yahoo,项目名称:fili,代码行数:27,代码来源:FilterEvaluator.java

示例4: testBadType

import org.apache.calcite.tools.RelBuilder; //导入方法依赖的package包/类
@Test public void testBadType() {
  final RelBuilder builder = RelBuilder.create(config().build());
  try {
    builder.scan("EMP");
    RexNode call = builder.call(SqlStdOperatorTable.PLUS,
        builder.field(1),
        builder.field(3));
    fail("expected error, got " + call);
  } catch (IllegalArgumentException e) {
    assertThat(e.getMessage(),
        is("cannot derive type: +; "
            + "operands: [$1: VARCHAR(10), $3: SMALLINT]"));
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:15,代码来源:RelBuilderTest.java

示例5: evaluate

import org.apache.calcite.tools.RelBuilder; //导入方法依赖的package包/类
/**
 * Evaluates a regular expression filter.
 *
 * @param regexFilter  A regexFilter to be evaluated.
 * @param builder  The RelBuilder used to build queries with Calcite.
 * @param apiToFieldMapper  A function to get the aliased aggregation's name from the metric name.
 *
 * @return a RexNode containing an equivalent filter to the one given.
 */
public RexNode evaluate(
        RegularExpressionFilter regexFilter,
        RelBuilder builder,
        ApiToFieldMapper apiToFieldMapper
) {
    // todo test this
    String apiName = regexFilter.getDimension().getApiName();
    return builder.call(
            SqlStdOperatorTable.LIKE,
            builder.field(apiToFieldMapper.apply(apiName)),
            builder.literal(regexFilter.getPattern().toString())
    );
}
 
开发者ID:yahoo,项目名称:fili,代码行数:23,代码来源:FilterEvaluator.java


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