org.apache.calcite.util.Util.unexpected()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(166)

本文整理了Java中org.apache.calcite.util.Util.unexpected()方法的一些代码示例,展示了Util.unexpected()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.unexpected()方法的具体详情如下:
包路径:org.apache.calcite.util.Util
类名称:Util
方法名:unexpected

Util.unexpected介绍

[英]Returns an exception indicating that we didn't expect to find this enumeration here.
[中]返回一个异常,表明我们不希望在此处找到此枚举。

代码示例

代码示例来源:origin: apache/flink

public void validateWindow(
  SqlNode windowOrId,
  SqlValidatorScope scope,
  SqlCall call) {
  // Enable nested aggregates with window aggregates (OVER operator)
  inWindow = true;
  final SqlWindow targetWindow;
  switch (windowOrId.getKind()) {
    case IDENTIFIER:
      // Just verify the window exists in this query.  It will validate
      // when the definition is processed
      targetWindow = getWindowByName((SqlIdentifier) windowOrId, scope);
      break;
    case WINDOW:
      targetWindow = (SqlWindow) windowOrId;
      break;
    default:
      throw Util.unexpected(windowOrId.getKind());
  }
  assert targetWindow.getWindowCall() == null;
  targetWindow.setWindowCall(call);
  targetWindow.validate(this, scope);
  targetWindow.setWindowCall(null);
  call.validate(this, scope);
  validateAggregateParams(call, null, scope);
  // Disable nested aggregates post validation
  inWindow = false;
}

代码示例来源:origin: apache/flink

throw Util.unexpected(conditionType);
throw Util.unexpected(joinType);

代码示例来源:origin: apache/flink

throw Util.unexpected(node.getKind());

代码示例来源:origin: apache/flink

throw Util.unexpected(kind);
throw Util.unexpected(kind);

代码示例来源:origin: apache/hive

aggCallMapping, inputExprs);
default:
 throw Util.unexpected(kind);

代码示例来源:origin: Qihoo360/Quicksql

/**
 * Returns a numeric literal's value as a {@link BigDecimal}.
 */
public BigDecimal bigDecimalValue() {
 switch (typeName) {
 case DECIMAL:
 case DOUBLE:
  return (BigDecimal) value;
 default:
  throw Util.unexpected(typeName);
 }
}

代码示例来源:origin: org.apache.calcite/calcite-core

/**
 * Returns a numeric literal's value as a {@link BigDecimal}.
 */
public BigDecimal bigDecimalValue() {
 switch (typeName) {
 case DECIMAL:
 case DOUBLE:
  return (BigDecimal) value;
 default:
  throw Util.unexpected(typeName);
 }
}

代码示例来源:origin: org.apache.calcite/calcite-core

private static JoinRelType convertJoinType(JoinType joinType) {
 switch (joinType) {
 case COMMA:
 case INNER:
 case CROSS:
  return JoinRelType.INNER;
 case FULL:
  return JoinRelType.FULL;
 case LEFT:
  return JoinRelType.LEFT;
 case RIGHT:
  return JoinRelType.RIGHT;
 default:
  throw Util.unexpected(joinType);
 }
}

代码示例来源:origin: Qihoo360/Quicksql

private static JoinRelType convertJoinType(JoinType joinType) {
 switch (joinType) {
 case COMMA:
 case INNER:
 case CROSS:
  return JoinRelType.INNER;
 case FULL:
  return JoinRelType.FULL;
 case LEFT:
  return JoinRelType.LEFT;
 case RIGHT:
  return JoinRelType.RIGHT;
 default:
  throw Util.unexpected(joinType);
 }
}

代码示例来源:origin: org.apache.kylin/atopcalcite

private static JoinRelType convertJoinType(JoinType joinType) {
 switch (joinType) {
 case COMMA:
 case INNER:
 case CROSS:
  return JoinRelType.INNER;
 case FULL:
  return JoinRelType.FULL;
 case LEFT:
  return JoinRelType.LEFT;
 case RIGHT:
  return JoinRelType.RIGHT;
 default:
  throw Util.unexpected(joinType);
 }
}

代码示例来源:origin: org.apache.flink/flink-table_2.10

private static JoinRelType convertJoinType(JoinType joinType) {
  switch (joinType) {
    case COMMA:
    case INNER:
    case CROSS:
      return JoinRelType.INNER;
    case FULL:
      return JoinRelType.FULL;
    case LEFT:
      return JoinRelType.LEFT;
    case RIGHT:
      return JoinRelType.RIGHT;
    default:
      throw Util.unexpected(joinType);
  }
}

代码示例来源:origin: Qihoo360/Quicksql

private SqlTypeName toVar(RelDataType type) {
  final SqlTypeName sqlTypeName = type.getSqlTypeName();
  switch (sqlTypeName) {
  case CHAR:
   return SqlTypeName.VARCHAR;
  case BINARY:
   return SqlTypeName.VARBINARY;
  case ANY:
   return SqlTypeName.ANY;
  default:
   throw Util.unexpected(sqlTypeName);
  }
 }
};

代码示例来源:origin: org.apache.calcite/calcite-core

private SqlTypeName toVar(RelDataType type) {
  final SqlTypeName sqlTypeName = type.getSqlTypeName();
  switch (sqlTypeName) {
  case CHAR:
   return SqlTypeName.VARCHAR;
  case BINARY:
   return SqlTypeName.VARBINARY;
  case ANY:
   return SqlTypeName.ANY;
  default:
   throw Util.unexpected(sqlTypeName);
  }
 }
};

代码示例来源:origin: org.apache.calcite/calcite-core

public boolean matches(RelOptRuleCall call) {
 LogicalJoin join = call.rel(0);
 switch (join.getJoinType()) {
 case INNER:
 case LEFT:
  return true;
 case FULL:
 case RIGHT:
  return false;
 default:
  throw Util.unexpected(join.getJoinType());
 }
}

代码示例来源:origin: Qihoo360/Quicksql

public boolean matches(RelOptRuleCall call) {
 LogicalJoin join = call.rel(0);
 switch (join.getJoinType()) {
 case INNER:
 case LEFT:
  return true;
 case FULL:
 case RIGHT:
  return false;
 default:
  throw Util.unexpected(join.getJoinType());
 }
}

代码示例来源:origin: Qihoo360/Quicksql

/**
 * Returns the maximum value of an integral type, as a long value
 */
public static long maxValue(RelDataType type) {
 assert SqlTypeUtil.isIntType(type);
 switch (type.getSqlTypeName()) {
 case TINYINT:
  return Byte.MAX_VALUE;
 case SMALLINT:
  return Short.MAX_VALUE;
 case INTEGER:
  return Integer.MAX_VALUE;
 case BIGINT:
  return Long.MAX_VALUE;
 default:
  throw Util.unexpected(type.getSqlTypeName());
 }
}

代码示例来源:origin: com.alibaba.blink/flink-sql-parser

private SqlTreeNode convertSetOp(SqlCall call) {
  final SqlTreeNode left = convertQueryRecursive(call.operand(0));
  final SqlTreeNode right = convertQueryRecursive(call.operand(1));
  switch (call.getKind()) {
    case UNION:
      return SqlTreeNodes.union(call.getParserPosition(), ImmutableList.of(left, right));
    case INTERSECT:
      throw Util.unexpected(call.getKind());
    case EXCEPT:
      throw Util.unexpected(call.getKind());
    default:
      throw Util.unexpected(call.getKind());
  }
}

代码示例来源:origin: Qihoo360/Quicksql

private Calendar timestampValue(RexLiteral timeLiteral) {
 switch (timeLiteral.getTypeName()) {
 case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
  final TimeZone tz = TimeZone.getTimeZone(this.timeZone);
  return Util.calendar(
    SqlFunctions.timestampWithLocalTimeZoneToTimestamp(
      timeLiteral.getValueAs(Long.class), tz));
 case TIMESTAMP:
  return Util.calendar(timeLiteral.getValueAs(Long.class));
 case DATE:
  // Cast date to timestamp with local time zone
  final DateString d = timeLiteral.getValueAs(DateString.class);
  return Util.calendar(d.getMillisSinceEpoch());
 default:
  throw Util.unexpected(timeLiteral.getTypeName());
 }
}

代码示例来源:origin: org.apache.calcite/calcite-core

private Calendar timestampValue(RexLiteral timeLiteral) {
 switch (timeLiteral.getTypeName()) {
 case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
  final TimeZone tz = TimeZone.getTimeZone(this.timeZone);
  return Util.calendar(
    SqlFunctions.timestampWithLocalTimeZoneToTimestamp(
      timeLiteral.getValueAs(Long.class), tz));
 case TIMESTAMP:
  return Util.calendar(timeLiteral.getValueAs(Long.class));
 case DATE:
  // Cast date to timestamp with local time zone
  final DateString d = timeLiteral.getValueAs(DateString.class);
  return Util.calendar(d.getMillisSinceEpoch());
 default:
  throw Util.unexpected(timeLiteral.getTypeName());
 }
}

代码示例来源:origin: org.apache.calcite/calcite-core

private Range<Calendar> ceilRange(TimeUnitRange timeUnit, SqlKind comparison,
  Calendar c) {
 final Calendar ceil = ceil(c, timeUnit);
 boolean boundary = ceil.equals(c);
 switch (comparison) {
 case EQUALS:
  return Range.openClosed(boundary ? decrement(ceil, timeUnit) : ceil, ceil);
 case LESS_THAN:
  return Range.atMost(decrement(ceil, timeUnit));
 case LESS_THAN_OR_EQUAL:
  return boundary ? Range.atMost(ceil) : Range.atMost(decrement(ceil, timeUnit));
 case GREATER_THAN:
  return boundary ? Range.greaterThan(ceil) : Range.greaterThan(decrement(ceil, timeUnit));
 case GREATER_THAN_OR_EQUAL:
  return Range.greaterThan(decrement(ceil, timeUnit));
 default:
  throw Util.unexpected(comparison);
 }
}

相关文章