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


Java RelFieldCollation.NullDirection方法代码示例

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


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

示例1: getNullOrderingFromString

import org.apache.calcite.rel.RelFieldCollation; //导入方法依赖的package包/类
private static NullDirection getNullOrderingFromString( String strNullOrdering ) {
   final RelFieldCollation.NullDirection nullOrdering;
   if ( null == strNullOrdering ) {
     nullOrdering = NullDirection.UNSPECIFIED;
   }
   else {
     try {
       nullOrdering = NullDirection.valueOf( strNullOrdering );
     }
     catch ( IllegalArgumentException e ) {
       throw new DrillRuntimeException(
           "Internal error:  Unknown <null ordering> string (not "
           + "\"" + NullDirection.FIRST.name() + "\", "
           + "\"" + NullDirection.LAST.name() + "\", or "
           + "\"" + NullDirection.UNSPECIFIED.name() + "\" or null): "
           + "\"" + strNullOrdering + "\"" );
     }
   }
   return nullOrdering;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:21,代码来源:Order.java

示例2: defaultNullDirection

import org.apache.calcite.rel.RelFieldCollation; //导入方法依赖的package包/类
/** Returns whether NULL values are sorted first or last, in this dialect,
 * in an ORDER BY item of a given direction. */
public RelFieldCollation.NullDirection defaultNullDirection(
    RelFieldCollation.Direction direction) {
  switch (direction) {
  case ASCENDING:
  case STRICTLY_ASCENDING:
    return getNullCollation().last(false)
        ? RelFieldCollation.NullDirection.LAST
        : RelFieldCollation.NullDirection.FIRST;
  case DESCENDING:
  case STRICTLY_DESCENDING:
    return getNullCollation().last(true)
        ? RelFieldCollation.NullDirection.LAST
        : RelFieldCollation.NullDirection.FIRST;
  default:
    return RelFieldCollation.NullDirection.UNSPECIFIED;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:20,代码来源:SqlDialect.java

示例3: collation

import org.apache.calcite.rel.RelFieldCollation; //导入方法依赖的package包/类
private static RelFieldCollation collation(RexNode node,
    RelFieldCollation.Direction direction,
    RelFieldCollation.NullDirection nullDirection, List<RexNode> extraNodes) {
  switch (node.getKind()) {
  case INPUT_REF:
    return new RelFieldCollation(((RexInputRef) node).getIndex(), direction,
        Util.first(nullDirection, direction.defaultNullDirection()));
  case DESCENDING:
    return collation(((RexCall) node).getOperands().get(0),
        RelFieldCollation.Direction.DESCENDING,
        nullDirection, extraNodes);
  case NULLS_FIRST:
    return collation(((RexCall) node).getOperands().get(0), direction,
        RelFieldCollation.NullDirection.FIRST, extraNodes);
  case NULLS_LAST:
    return collation(((RexCall) node).getOperands().get(0), direction,
        RelFieldCollation.NullDirection.LAST, extraNodes);
  default:
    final int fieldIndex = extraNodes.size();
    extraNodes.add(node);
    return new RelFieldCollation(fieldIndex, direction,
        Util.first(nullDirection, direction.defaultNullDirection()));
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:RelBuilder.java

示例4: BeamSortRel

import org.apache.calcite.rel.RelFieldCollation; //导入方法依赖的package包/类
public BeamSortRel(
    RelOptCluster cluster,
    RelTraitSet traits,
    RelNode child,
    RelCollation collation,
    RexNode offset,
    RexNode fetch) {
  super(cluster, traits, child, collation, offset, fetch);

  List<RexNode> fieldExps = getChildExps();
  RelCollationImpl collationImpl = (RelCollationImpl) collation;
  List<RelFieldCollation> collations = collationImpl.getFieldCollations();
  for (int i = 0; i < fieldExps.size(); i++) {
    RexNode fieldExp = fieldExps.get(i);
    RexInputRef inputRef = (RexInputRef) fieldExp;
    fieldIndices.add(inputRef.getIndex());
    orientation.add(collations.get(i).getDirection() == RelFieldCollation.Direction.ASCENDING);

    RelFieldCollation.NullDirection rawNullDirection = collations.get(i).nullDirection;
    if (rawNullDirection == RelFieldCollation.NullDirection.UNSPECIFIED) {
      rawNullDirection = collations.get(i).getDirection().defaultNullDirection();
    }
    nullsFirst.add(rawNullDirection == RelFieldCollation.NullDirection.FIRST);
  }

  if (fetch == null) {
    throw new UnsupportedOperationException("ORDER BY without a LIMIT is not supported!");
  }

  RexLiteral fetchLiteral = (RexLiteral) fetch;
  count = ((BigDecimal) fetchLiteral.getValue()).intValue();

  if (offset != null) {
    RexLiteral offsetLiteral = (RexLiteral) offset;
    startIndex = ((BigDecimal) offsetLiteral.getValue()).intValue();
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:38,代码来源:BeamSortRel.java

示例5: toFieldCollation

import org.apache.calcite.rel.RelFieldCollation; //导入方法依赖的package包/类
public RelFieldCollation toFieldCollation(Map<String, Object> map) {
  final Integer field = (Integer) map.get("field");
  final RelFieldCollation.Direction direction =
      Util.enumVal(RelFieldCollation.Direction.class,
          (String) map.get("direction"));
  final RelFieldCollation.NullDirection nullDirection =
      Util.enumVal(RelFieldCollation.NullDirection.class,
          (String) map.get("nulls"));
  return new RelFieldCollation(field, direction, nullDirection);
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:RelJson.java

示例6: getNullDirection

import org.apache.calcite.rel.RelFieldCollation; //导入方法依赖的package包/类
public RelFieldCollation.NullDirection getNullDirection() {
  return right.contains(SqlKind.NULLS_LAST)
      ? RelFieldCollation.NullDirection.LAST
      : right.contains(SqlKind.NULLS_FIRST)
          ? RelFieldCollation.NullDirection.FIRST
          : getDirection().defaultNullDirection();
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:RexFieldCollation.java

示例7: ordering

import org.apache.calcite.rel.RelFieldCollation; //导入方法依赖的package包/类
protected Order.Ordering ordering(String expression, RelFieldCollation.Direction direction, RelFieldCollation.NullDirection nullDirection) {
  return new Order.Ordering(direction, parseExpr(expression), nullDirection);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:4,代码来源:BaseTestOperator.java

示例8: convertOrderItem

import org.apache.calcite.rel.RelFieldCollation; //导入方法依赖的package包/类
protected RelFieldCollation convertOrderItem(
	SqlSelect select,
	SqlNode orderItem, List<SqlNode> extraExprs,
	RelFieldCollation.Direction direction,
	RelFieldCollation.NullDirection nullDirection) {
	assert select != null;
	// Handle DESC keyword, e.g. 'select a, b from t order by a desc'.
	switch (orderItem.getKind()) {
		case DESCENDING:
			return convertOrderItem(
				select,
				((SqlCall) orderItem).operand(0),
				extraExprs,
				RelFieldCollation.Direction.DESCENDING,
				nullDirection);
		case NULLS_FIRST:
			return convertOrderItem(
				select,
				((SqlCall) orderItem).operand(0),
				extraExprs,
				direction,
				RelFieldCollation.NullDirection.FIRST);
		case NULLS_LAST:
			return convertOrderItem(
				select,
				((SqlCall) orderItem).operand(0),
				extraExprs,
				direction,
				RelFieldCollation.NullDirection.LAST);
	}

	SqlNode converted = validator.expandOrderExpr(select, orderItem);

	switch (nullDirection) {
		case UNSPECIFIED:
			nullDirection = validator.getDefaultNullCollation().last(desc(direction))
				? RelFieldCollation.NullDirection.LAST
				: RelFieldCollation.NullDirection.FIRST;
	}

	// Scan the select list and order exprs for an identical expression.
	final SelectScope selectScope = validator.getRawSelectScope(select);
	int ordinal = -1;
	for (SqlNode selectItem : selectScope.getExpandedSelectList()) {
		++ordinal;
		if (converted.equalsDeep(stripAs(selectItem), Litmus.IGNORE)) {
			return new RelFieldCollation(ordinal, direction, nullDirection);
		}
	}

	for (SqlNode extraExpr : extraExprs) {
		++ordinal;
		if (converted.equalsDeep(extraExpr, Litmus.IGNORE)) {
			return new RelFieldCollation(ordinal, direction, nullDirection);
		}
	}

	// TODO:  handle collation sequence
	// TODO: flag expressions as non-standard

	extraExprs.add(converted);
	return new RelFieldCollation(ordinal + 1, direction, nullDirection);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:64,代码来源:SqlToRelConverter.java

示例9: convertOrderItem

import org.apache.calcite.rel.RelFieldCollation; //导入方法依赖的package包/类
protected RelFieldCollation convertOrderItem(
        SqlSelect select,
        SqlNode orderItem, List<SqlNode> extraExprs,
        RelFieldCollation.Direction direction,
        RelFieldCollation.NullDirection nullDirection) {
  assert select != null;
  // Handle DESC keyword, e.g. 'select a, b from t order by a desc'.
  switch (orderItem.getKind()) {
  case DESCENDING:
    return convertOrderItem(
        select,
        ((SqlCall) orderItem).operand(0),
        extraExprs,
        RelFieldCollation.Direction.DESCENDING,
        nullDirection);
  case NULLS_FIRST:
    return convertOrderItem(
        select,
        ((SqlCall) orderItem).operand(0),
        extraExprs,
        direction,
        RelFieldCollation.NullDirection.FIRST);
  case NULLS_LAST:
    return convertOrderItem(
        select,
        ((SqlCall) orderItem).operand(0),
        extraExprs,
        direction,
        RelFieldCollation.NullDirection.LAST);
  }

  SqlNode converted = validator.expandOrderExpr(select, orderItem);

  switch (nullDirection) {
  case UNSPECIFIED:
    nullDirection = validator.getDefaultNullCollation().last(desc(direction))
        ? RelFieldCollation.NullDirection.LAST
        : RelFieldCollation.NullDirection.FIRST;
  }

  // Scan the select list and order exprs for an identical expression.
  final SelectScope selectScope = validator.getRawSelectScope(select);
  int ordinal = -1;
  for (SqlNode selectItem : selectScope.getExpandedSelectList()) {
    ++ordinal;
    if (converted.equalsDeep(stripAs(selectItem), Litmus.IGNORE)) {
      return new RelFieldCollation(ordinal, direction, nullDirection);
    }
  }

  for (SqlNode extraExpr : extraExprs) {
    ++ordinal;
    if (converted.equalsDeep(extraExpr, Litmus.IGNORE)) {
      return new RelFieldCollation(ordinal, direction, nullDirection);
    }
  }

  // TODO:  handle collation sequence
  // TODO: flag expressions as non-standard

  extraExprs.add(converted);
  return new RelFieldCollation(ordinal + 1, direction, nullDirection);
}
 
开发者ID:apache,项目名称:kylin,代码行数:64,代码来源:SqlToRelConverter.java

示例10: convertOrderItem

import org.apache.calcite.rel.RelFieldCollation; //导入方法依赖的package包/类
protected RelFieldCollation convertOrderItem(
    SqlSelect select,
    SqlNode orderItem, List<SqlNode> extraExprs,
    RelFieldCollation.Direction direction,
    RelFieldCollation.NullDirection nullDirection) {
  assert select != null;
  // Handle DESC keyword, e.g. 'select a, b from t order by a desc'.
  switch (orderItem.getKind()) {
  case DESCENDING:
    return convertOrderItem(
        select,
        ((SqlCall) orderItem).operand(0),
        extraExprs,
        RelFieldCollation.Direction.DESCENDING,
        nullDirection);
  case NULLS_FIRST:
    return convertOrderItem(
        select,
        ((SqlCall) orderItem).operand(0),
        extraExprs,
        direction,
        RelFieldCollation.NullDirection.FIRST);
  case NULLS_LAST:
    return convertOrderItem(
        select,
        ((SqlCall) orderItem).operand(0),
        extraExprs,
        direction,
        RelFieldCollation.NullDirection.LAST);
  }

  SqlNode converted = validator.expandOrderExpr(select, orderItem);

  switch (nullDirection) {
  case UNSPECIFIED:
    nullDirection = validator.getDefaultNullCollation().last(desc(direction))
        ? RelFieldCollation.NullDirection.LAST
        : RelFieldCollation.NullDirection.FIRST;
  }

  // Scan the select list and order exprs for an identical expression.
  final SelectScope selectScope = validator.getRawSelectScope(select);
  int ordinal = -1;
  for (SqlNode selectItem : selectScope.getExpandedSelectList()) {
    ++ordinal;
    if (converted.equalsDeep(stripAs(selectItem), Litmus.IGNORE)) {
      return new RelFieldCollation(ordinal, direction, nullDirection);
    }
  }

  for (SqlNode extraExpr : extraExprs) {
    ++ordinal;
    if (converted.equalsDeep(extraExpr, Litmus.IGNORE)) {
      return new RelFieldCollation(ordinal, direction, nullDirection);
    }
  }

  // TODO:  handle collation sequence
  // TODO: flag expressions as non-standard

  extraExprs.add(converted);
  return new RelFieldCollation(ordinal + 1, direction, nullDirection);
}
 
开发者ID:apache,项目名称:calcite,代码行数:64,代码来源:SqlToRelConverter.java


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