本文整理汇总了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));
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}