本文整理汇总了Java中org.apache.calcite.rel.RelFieldCollation.NullDirection.UNSPECIFIED属性的典型用法代码示例。如果您正苦于以下问题:Java NullDirection.UNSPECIFIED属性的具体用法?Java NullDirection.UNSPECIFIED怎么用?Java NullDirection.UNSPECIFIED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.calcite.rel.RelFieldCollation.NullDirection
的用法示例。
在下文中一共展示了NullDirection.UNSPECIFIED属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNullOrderingFromString
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;
}
示例2: filterSupportedNullDirections
/**
* 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 + "\"" );
}
}
示例3: filterDrillSupportedNullDirections
/**
* 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 + "\"" );
}
}
示例4: nullsSortHigh
/**
* 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;
}
示例5: test_Ordering_roundTripDescAndNullsUnspecified
@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 ) );
}
示例6: nullsSortHigh
/**
* 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;
}
示例7: test_Ordering_roundTripDescAndNullsUnspecified
@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 ) );
}