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


Java NullDirection类代码示例

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


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

示例1: getNullOrderingFromString

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的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: filterSupportedNullDirections

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
/**
  * Disallows unsupported values for null ordering (provided by Calcite but not implemented by Dremio),
  * currently all values are supported.
  *
  * Provides a default value of UNSPECIFIED in the case of a null.
  *
  * @param nullDirection
  * @return - a sanitized direction value
  */
 private static NullDirection filterSupportedNullDirections(NullDirection nullDirection) {
   if ( null == nullDirection) {
     return NullDirection.UNSPECIFIED;
   }
   switch (nullDirection) {
     case LAST:
     case FIRST:
     case UNSPECIFIED:
       return nullDirection;
     default:
       throw new RuntimeException(
           "Internal error:  Unknown <null ordering> string (not "
               + "\"" + NullDirection.FIRST.name() + "\", "
               + "\"" + NullDirection.LAST.name() + "\", or "
               + "\"" + NullDirection.UNSPECIFIED.name() + "\" or null): "
               + "\"" + nullDirection + "\"" );
   }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:28,代码来源:Order.java

示例3: getNullOrderingFromString

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
@VisibleForTesting
public static NullDirection getNullOrderingFromString( String strNullOrdering ) {
  NullDirection nullDir = null;
  if (strNullOrdering != null) {
    nullDir = DRILL_TO_CALCITE_NULL_DIR_MAPPING.get(strNullOrdering.toUpperCase());
  }
  if (nullDir != null || strNullOrdering == null) {
    return filterDrillSupportedNullDirections(nullDir);
  } else {
    throw new DrillRuntimeException(
        "Internal error:  Unknown <null ordering> string (not "
            + "\"" + NULLS_FIRST + "\", "
            + "\"" + NULLS_LAST + "\", or "
            + "\"" + NULLS_UNSPECIFIED + "\" or null): "
            + "\"" + strNullOrdering + "\"" );
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:18,代码来源:Order.java

示例4: filterDrillSupportedNullDirections

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
/**
  * Disallows unsupported values for null ordering (provided by Calcite but not implemented by Drill),
  * currently all values are supported.
  *
  * Provides a default value of UNSPECIFIED in the case of a null.
  *
  * @param nullDirection
  * @return - a sanitized direction value
  */
 private static NullDirection filterDrillSupportedNullDirections(NullDirection nullDirection) {
   if ( null == nullDirection) {
     return NullDirection.UNSPECIFIED;
   }
   switch (nullDirection) {
     case LAST:
     case FIRST:
     case UNSPECIFIED:
       return nullDirection;
     default:
       throw new DrillRuntimeException(
           "Internal error:  Unknown <null ordering> string (not "
               + "\"" + NullDirection.FIRST.name() + "\", "
               + "\"" + NullDirection.LAST.name() + "\", or "
               + "\"" + NullDirection.UNSPECIFIED.name() + "\" or null): "
               + "\"" + nullDirection + "\"" );
   }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:28,代码来源:Order.java

示例5: visitGroupingAggregate

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
@Override
public PhysicalOperator visitGroupingAggregate(GroupingAggregate groupBy, Object value) throws OptimizerException {
  final List<Ordering> orderDefs = Lists.newArrayList();
  PhysicalOperator input = groupBy.getInput().accept(this, value);

  if (groupBy.getKeys().length > 0) {
    for(NamedExpression e : groupBy.getKeys()) {
      orderDefs.add(new Ordering(Direction.ASCENDING, e.getExpr(), NullDirection.FIRST));
    }
    input = new Sort(input, orderDefs, false);
  }

  final StreamingAggregate sa = new StreamingAggregate(input, groupBy.getKeys(), groupBy.getExprs(), 1.0f);
  return sa;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:BasicOptimizer.java

示例6: nullsSortHigh

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
/**
 * Reports whether NULL sorts high or low in this ordering.
 *
 * @return
 * {@code true}  if NULL sorts higher than any other value;
 * {@code false} if NULL sorts lower  than any other value
 */
public boolean nullsSortHigh() {
  final boolean nullsHigh;

  switch (nullOrdering) {

  case UNSPECIFIED:
    // Default:  NULL sorts high: like NULLS LAST if ASC, FIRST if DESC.
    nullsHigh = true;
    break;

  case FIRST:
    // FIRST: NULL sorts low with ASC, high with DESC.
    nullsHigh = Direction.DESCENDING == getDirection();
    break;

  case LAST:
    // LAST: NULL sorts high with ASC, low with DESC.
    nullsHigh = Direction.ASCENDING == getDirection();
    break;

  default:
    throw new DrillRuntimeException(
        "Unexpected " + NullDirection.class.getName() + " value other than "
        + NullDirection.FIRST + ", " + NullDirection.LAST + " or " + NullDirection.UNSPECIFIED + ": "
        + nullOrdering );
  }

  return nullsHigh;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:37,代码来源:Order.java

示例7: test_Ordering_roundTripAscAndNullsFirst

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
@Test
public void test_Ordering_roundTripAscAndNullsFirst() {
  Ordering src = new Ordering( Direction.ASCENDING, null, NullDirection.FIRST);
  Ordering reconstituted =
      new Ordering( (LogicalExpression) null, src.getOrder(), src.getNullDirection().toString() );
  assertThat( reconstituted.getDirection(), equalTo( RelFieldCollation.Direction.ASCENDING  ) );
  assertThat( reconstituted.getNullDirection(), equalTo( NullDirection.FIRST  ) );
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:OrderTest.java

示例8: test_Ordering_roundTripDescAndNullsLast

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
@Test
public void test_Ordering_roundTripDescAndNullsLast() {
  Ordering src = new Ordering( Direction.DESCENDING, null, NullDirection.LAST);
  Ordering reconstituted =
      new Ordering( (LogicalExpression) null, src.getOrder(), src.getNullDirection().toString() );
  assertThat( reconstituted.getDirection(), equalTo( RelFieldCollation.Direction.DESCENDING  ) );
  assertThat( reconstituted.getNullDirection(), equalTo( NullDirection.LAST  ) );
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:OrderTest.java

示例9: test_Ordering_roundTripDescAndNullsUnspecified

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
@Test
public void test_Ordering_roundTripDescAndNullsUnspecified() {
  Ordering src = new Ordering( Direction.DESCENDING, null, NullDirection.UNSPECIFIED);
  Ordering reconstituted =
      new Ordering( (LogicalExpression) null, src.getOrder(), src.getNullDirection().toString() );
  assertThat( reconstituted.getDirection(), equalTo( RelFieldCollation.Direction.DESCENDING  ) );
  assertThat( reconstituted.getNullDirection(), equalTo( NullDirection.UNSPECIFIED  ) );
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:OrderTest.java

示例10: testOrdering_nullStrings

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
@Test
public void testOrdering_nullStrings() {
  Ordering ordering = new Ordering( (LogicalExpression) null, null, null );
  assertThat( ordering.getDirection(), equalTo( RelFieldCollation.Direction.ASCENDING ) );
  assertThat( ordering.getNullDirection(), equalTo( RelFieldCollation.NullDirection.UNSPECIFIED ) );
  assertThat( ordering.getOrder(), equalTo( "ASC" ) );
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:8,代码来源:OrderTest.java

示例11: getNullOrderingFromString

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
private static NullDirection getNullOrderingFromString( String strNullOrdering ) {
  NullDirection nullDir = DREMIO_TO_CALCITE_NULL_DIR_MAPPING.get(strNullOrdering);
  if (nullDir != null || strNullOrdering == null) {
    return filterSupportedNullDirections(nullDir);
  } else {
    throw new IllegalArgumentException(
        "Internal error:  Unknown <null ordering> string (not "
            + "\"" + NullDirection.FIRST.name() + "\", "
            + "\"" + NullDirection.LAST.name() + "\", or "
            + "\"" + NullDirection.UNSPECIFIED.name() + "\" or null): "
            + "\"" + strNullOrdering + "\"" );
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:Order.java

示例12: nullsSortHigh

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
/**
 * Reports whether NULL sorts high or low in this ordering.
 *
 * @return
 * {@code true}  if NULL sorts higher than any other value;
 * {@code false} if NULL sorts lower  than any other value
 */
public boolean nullsSortHigh() {
  final boolean nullsHigh;

  switch (nullOrdering) {

  case UNSPECIFIED:
    // Default:  NULL sorts high: like NULLS LAST if ASC, FIRST if DESC.
    nullsHigh = true;
    break;

  case FIRST:
    // FIRST: NULL sorts low with ASC, high with DESC.
    nullsHigh = Direction.DESCENDING == getDirection();
    break;

  case LAST:
    // LAST: NULL sorts high with ASC, low with DESC.
    nullsHigh = Direction.ASCENDING == getDirection();
    break;

  default:
    throw new RuntimeException(
        "Unexpected " + NullDirection.class.getName() + " value other than "
        + NullDirection.FIRST + ", " + NullDirection.LAST + " or " + NullDirection.UNSPECIFIED + ": "
        + nullOrdering );
  }

  return nullsHigh;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:37,代码来源:Order.java

示例13: test_Ordering_roundTripAscAndNullsFirst

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
@Test
public void test_Ordering_roundTripAscAndNullsFirst() {
  Ordering src = new Ordering( Direction.ASCENDING, null, NullDirection.FIRST);
  Ordering reconstituted =
      new Ordering( src.getDirection(), (LogicalExpression) null, src.getNullDirection() );
  assertThat( reconstituted.getDirection(), equalTo( RelFieldCollation.Direction.ASCENDING  ) );
  assertThat( reconstituted.getNullDirection(), equalTo( NullDirection.FIRST  ) );
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:OrderTest.java

示例14: test_Ordering_roundTripDescAndNullsLast

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
@Test
public void test_Ordering_roundTripDescAndNullsLast() {
  Ordering src = new Ordering( Direction.DESCENDING, null, NullDirection.LAST);
  Ordering reconstituted =
      new Ordering( src.getDirection(), (LogicalExpression) null, src.getNullDirection() );
  assertThat( reconstituted.getDirection(), equalTo( RelFieldCollation.Direction.DESCENDING  ) );
  assertThat( reconstituted.getNullDirection(), equalTo( NullDirection.LAST  ) );
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:OrderTest.java

示例15: test_Ordering_roundTripDescAndNullsUnspecified

import org.apache.calcite.rel.RelFieldCollation.NullDirection; //导入依赖的package包/类
@Test
public void test_Ordering_roundTripDescAndNullsUnspecified() {
  Ordering src = new Ordering( Direction.DESCENDING, null, NullDirection.UNSPECIFIED);
  Ordering reconstituted =
      new Ordering( src.getDirection(), (LogicalExpression) null, src.getNullDirection() );
  assertThat( reconstituted.getDirection(), equalTo( RelFieldCollation.Direction.DESCENDING  ) );
  assertThat( reconstituted.getNullDirection(), equalTo( NullDirection.UNSPECIFIED  ) );
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:OrderTest.java


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