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


Java RelCollationImpl.of方法代码示例

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


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

示例1: convert

import org.apache.calcite.rel.RelCollationImpl; //导入方法依赖的package包/类
public static RelNode convert(Order order, ConversionContext context) throws InvalidRelException{

    // if there are compound expressions in the order by, we need to convert into projects on either side.
    RelNode input = context.toRel(order.getInput());
    List<String> fields = input.getRowType().getFieldNames();

    // build a map of field names to indices.
    Map<String, Integer> fieldMap = Maps.newHashMap();
    int i =0;
    for(String field : fields){
      fieldMap.put(field, i);
      i++;
    }

    List<RelFieldCollation> collations = Lists.newArrayList();

    for(Ordering o : order.getOrderings()){
      String fieldName = ExprHelper.getFieldName(o.getExpr());
      int fieldId = fieldMap.get(fieldName);
      RelFieldCollation c = new RelFieldCollation(fieldId, o.getDirection(), o.getNullDirection());
    }
    return new DrillSortRel(context.getCluster(), context.getLogicalTraits(), input, RelCollationImpl.of(collations));
  }
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:24,代码来源:DrillSortRel.java

示例2: convert

import org.apache.calcite.rel.RelCollationImpl; //导入方法依赖的package包/类
public static RelNode convert(Order order, ConversionContext context) throws InvalidRelException{

    // if there are compound expressions in the order by, we need to convert into projects on either side.
    RelNode input = context.toRel(order.getInput());
    List<String> fields = input.getRowType().getFieldNames();

    // build a map of field names to indices.
    Map<String, Integer> fieldMap = Maps.newHashMap();
    int i =0;
    for(String field : fields){
      fieldMap.put(field, i);
      i++;
    }

    List<RelFieldCollation> collations = Lists.newArrayList();

    for(Ordering o : order.getOrderings()){
      String fieldName = ExprHelper.getFieldName(o.getExpr());
      int fieldId = fieldMap.get(fieldName);
      RelFieldCollation c = new RelFieldCollation(fieldId, o.getDirection(), o.getNullDirection());
    }
    return new SortRel(context.getCluster(), context.getLogicalTraits(), input, RelCollationImpl.of(collations));
  }
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:24,代码来源:SortRel.java

示例3: getCollation

import org.apache.calcite.rel.RelCollationImpl; //导入方法依赖的package包/类
private RelCollation getCollation(List<Integer> keys){
  List<RelFieldCollation> fields = Lists.newArrayList();
  for (int key : keys) {
    fields.add(new RelFieldCollation(key));
  }
  return RelCollationImpl.of(fields);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:8,代码来源:WriterPrule.java

示例4: getCollation

import org.apache.calcite.rel.RelCollationImpl; //导入方法依赖的package包/类
private RelCollation getCollation(DrillAggregateRel rel){

    List<RelFieldCollation> fields = Lists.newArrayList();
    for (int group : BitSets.toIter(rel.getGroupSet())) {
      fields.add(new RelFieldCollation(group));
    }
    return RelCollationImpl.of(fields);
  }
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:StreamAggPrule.java

示例5: convertRelCollation

import org.apache.calcite.rel.RelCollationImpl; //导入方法依赖的package包/类
private RelCollation convertRelCollation(RelCollation src, Map<Integer, Integer> inToOut) {
  List<RelFieldCollation> newFields = Lists.newArrayList();

  for ( RelFieldCollation field : src.getFieldCollations()) {
    if (inToOut.containsKey(field.getFieldIndex())) {
      newFields.add(new RelFieldCollation(inToOut.get(field.getFieldIndex()), field.getDirection(), field.nullDirection));
    }
  }

  if (newFields.isEmpty()) {
    return RelCollationImpl.of();
  } else {
    return RelCollationImpl.of(newFields);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:ProjectPrule.java

示例6: getCollation

import org.apache.calcite.rel.RelCollationImpl; //导入方法依赖的package包/类
/**
 * Create a RelCollation that has partition-by as the leading keys followed by order-by keys
 * @param window The window specification
 * @return a RelCollation with {partition-by keys, order-by keys}
 */
private RelCollation getCollation(Window.Group window) {
  List<RelFieldCollation> fields = Lists.newArrayList();
  for (int group : BitSets.toIter(window.keys)) {
    fields.add(new RelFieldCollation(group));
  }

  for (RelFieldCollation field : window.orderKeys.getFieldCollations()) {
    fields.add(field);
  }

  return RelCollationImpl.of(fields);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:18,代码来源:WindowPrule.java

示例7: getCollation

import org.apache.calcite.rel.RelCollationImpl; //导入方法依赖的package包/类
private RelCollation getCollation(AggregateRel rel){

    List<RelFieldCollation> fields = Lists.newArrayList();
    for (int group = 0; group < rel.getGroupSet().cardinality(); group++) {
      fields.add(new RelFieldCollation(group));
    }
    return RelCollationImpl.of(fields);
  }
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:StreamAggPrule.java


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