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


Java Util.unexpected方法代码示例

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


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

示例1: convertJoinType

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:SqlToRelConverter.java

示例2: convertSetOp

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Converts a set operation (UNION, INTERSECT, MINUS) into relational
 * expressions.
 *
 * @param call Call to set operator
 * @return Relational expression
 */
protected RelNode convertSetOp(SqlCall call) {
	final RelNode left =
		convertQueryRecursive(call.operand(0), false, null).project();
	final RelNode right =
		convertQueryRecursive(call.operand(1), false, null).project();
	switch (call.getKind()) {
		case UNION:
			return LogicalUnion.create(ImmutableList.of(left, right), all(call));

		case INTERSECT:
			return LogicalIntersect.create(ImmutableList.of(left, right), all(call));

		case EXCEPT:
			return LogicalMinus.create(ImmutableList.of(left, right), all(call));

		default:
			throw Util.unexpected(call.getKind());
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:SqlToRelConverter.java

示例3: convertJoinType

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
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);
  }
}
 
开发者ID:apache,项目名称:kylin,代码行数:17,代码来源:SqlToRelConverter.java

示例4: convertSetOp

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Converts a set operation (UNION, INTERSECT, MINUS) into relational
 * expressions.
 *
 * @param call Call to set operator
 * @return Relational expression
 */
protected RelNode convertSetOp(SqlCall call) {
  final RelNode left =
      convertQueryRecursive(call.operand(0), false, null).project();
  final RelNode right =
      convertQueryRecursive(call.operand(1), false, null).project();
  switch (call.getKind()) {
  case UNION:
    return LogicalUnion.create(ImmutableList.of(left, right), all(call));

  case INTERSECT:
    return LogicalIntersect.create(ImmutableList.of(left, right), all(call));

  case EXCEPT:
    return LogicalMinus.create(ImmutableList.of(left, right), all(call));

  default:
    throw Util.unexpected(call.getKind());
  }
}
 
开发者ID:apache,项目名称:kylin,代码行数:27,代码来源:SqlToRelConverter.java

示例5: dateTimeLiteral

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private RexLiteral dateTimeLiteral(RexBuilder rexBuilder, Calendar calendar,
    RexNode operand) {
  final TimestampString ts;
  final int p;
  switch (operand.getType().getSqlTypeName()) {
  case TIMESTAMP:
    ts = TimestampString.fromCalendarFields(calendar);
    p = operand.getType().getPrecision();
    return rexBuilder.makeTimestampLiteral(ts, p);
  case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
    ts = TimestampString.fromCalendarFields(calendar);
    final TimeZone tz = TimeZone.getTimeZone(this.timeZone);
    final TimestampString localTs =
        new TimestampWithTimeZoneString(ts, tz)
            .withTimeZone(DateTimeUtils.UTC_ZONE)
            .getLocalTimestampString();
    p = operand.getType().getPrecision();
    return rexBuilder.makeTimestampWithLocalTimeZoneLiteral(localTs, p);
  case DATE:
    final DateString d = DateString.fromCalendarFields(calendar);
    return rexBuilder.makeDateLiteral(d);
  default:
    throw Util.unexpected(operand.getType().getSqlTypeName());
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:26,代码来源:DateRangeRules.java

示例6: timestampValue

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
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());
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:18,代码来源:DateRangeRules.java

示例7: floorRange

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private Range<Calendar> floorRange(TimeUnitRange timeUnit, SqlKind comparison,
    Calendar c) {
  Calendar floor = floor(c, timeUnit);
  boolean boundary = floor.equals(c);
  switch (comparison) {
  case EQUALS:
    return Range.closedOpen(floor, boundary ? increment(floor, timeUnit) : floor);
  case LESS_THAN:
    return boundary ? Range.lessThan(floor) : Range.lessThan(increment(floor, timeUnit));
  case LESS_THAN_OR_EQUAL:
    return Range.lessThan(increment(floor, timeUnit));
  case GREATER_THAN:
    return Range.atLeast(increment(floor, timeUnit));
  case GREATER_THAN_OR_EQUAL:
    return boundary ? Range.atLeast(floor) : Range.atLeast(increment(floor, timeUnit));
  default:
    throw Util.unexpected(comparison);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:20,代码来源:DateRangeRules.java

示例8: ceilRange

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
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);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:20,代码来源:DateRangeRules.java

示例9: getFactor

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private static long getFactor(TimeUnit unit) {
  switch (unit) {
  case DAY:
    return 1L;
  case HOUR:
    return TimeUnit.DAY.multiplier.longValue();
  case MINUTE:
    return TimeUnit.HOUR.multiplier.longValue();
  case SECOND:
    return TimeUnit.MINUTE.multiplier.longValue();
  case MONTH:
    return TimeUnit.YEAR.multiplier.longValue();
  case QUARTER:
    return TimeUnit.YEAR.multiplier.longValue();
  case YEAR:
  case DECADE:
  case CENTURY:
  case MILLENNIUM:
    return 1L;
  default:
    throw Util.unexpected(unit);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:24,代码来源:RexImpTable.java

示例10: validate

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
public final void validate(RelDataType targetRowType) {
  switch (status) {
  case UNVALIDATED:
    try {
      status = SqlValidatorImpl.Status.IN_PROGRESS;
      Preconditions.checkArgument(rowType == null,
          "Namespace.rowType must be null before validate has been called");
      RelDataType type = validateImpl(targetRowType);
      Preconditions.checkArgument(type != null,
          "validateImpl() returned null");
      setType(type);
    } finally {
      status = SqlValidatorImpl.Status.VALID;
    }
    break;
  case IN_PROGRESS:
    throw new AssertionError("Cycle detected during type-checking");
  case VALID:
    break;
  default:
    throw Util.unexpected(status);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:24,代码来源:AbstractNamespace.java

示例11: intValue

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Returns the integer value of this literal.
 *
 * @param exact Whether the value has to be exact. If true, and the literal
 *              is a fraction (e.g. 3.14), throws. If false, discards the
 *              fractional part of the value.
 * @return Integer value of this literal
 */
public int intValue(boolean exact) {
  switch (typeName) {
  case DECIMAL:
  case DOUBLE:
    BigDecimal bd = (BigDecimal) value;
    if (exact) {
      try {
        return bd.intValueExact();
      } catch (ArithmeticException e) {
        throw SqlUtil.newContextException(getParserPosition(),
            RESOURCE.numberLiteralOutOfRange(bd.toString()));
      }
    } else {
      return bd.intValue();
    }
  default:
    throw Util.unexpected(typeName);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:28,代码来源:SqlLiteral.java

示例12: longValue

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Returns the long value of this literal.
 *
 * @param exact Whether the value has to be exact. If true, and the literal
 *              is a fraction (e.g. 3.14), throws. If false, discards the
 *              fractional part of the value.
 * @return Long value of this literal
 */
public long longValue(boolean exact) {
  switch (typeName) {
  case DECIMAL:
  case DOUBLE:
    BigDecimal bd = (BigDecimal) value;
    if (exact) {
      try {
        return bd.longValueExact();
      } catch (ArithmeticException e) {
        throw SqlUtil.newContextException(getParserPosition(),
            RESOURCE.numberLiteralOutOfRange(bd.toString()));
      }
    } else {
      return bd.longValue();
    }
  default:
    throw Util.unexpected(typeName);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:28,代码来源:SqlLiteral.java

示例13: createDmlRowType

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Creates the row type descriptor for the result of a DML operation, which
 * is a single column named ROWCOUNT of type BIGINT for INSERT;
 * a single column named PLAN for EXPLAIN.
 *
 * @param kind        Kind of node
 * @param typeFactory factory to use for creating type descriptor
 * @return created type
 */
public static RelDataType createDmlRowType(
    SqlKind kind,
    RelDataTypeFactory typeFactory) {
  switch (kind) {
  case INSERT:
  case DELETE:
  case UPDATE:
    return typeFactory.createStructType(
        ImmutableList.of(
            Pair.of(AvaticaConnection.ROWCOUNT_COLUMN_NAME,
                typeFactory.createSqlType(SqlTypeName.BIGINT))));
  case EXPLAIN:
    return typeFactory.createStructType(
        ImmutableList.of(
            Pair.of(AvaticaConnection.PLAN_COLUMN_NAME,
                typeFactory.createSqlType(
                    SqlTypeName.VARCHAR,
                    RelDataType.PRECISION_NOT_SPECIFIED))));
  default:
    throw Util.unexpected(kind);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:32,代码来源:RelOptUtil.java

示例14: convertJoinCondition

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private RexNode convertJoinCondition(Blackboard bb,
	SqlValidatorNamespace leftNamespace,
	SqlValidatorNamespace rightNamespace,
	SqlNode condition,
	JoinConditionType conditionType,
	RelNode leftRel,
	RelNode rightRel) {
	if (condition == null) {
		return rexBuilder.makeLiteral(true);
	}
	bb.setRoot(ImmutableList.of(leftRel, rightRel));
	replaceSubQueries(bb, condition, RelOptUtil.Logic.UNKNOWN_AS_FALSE);
	switch (conditionType) {
		case ON:
			bb.setRoot(ImmutableList.of(leftRel, rightRel));
			return bb.convertExpression(condition);
		case USING:
			final SqlNodeList list = (SqlNodeList) condition;
			final List<String> nameList = new ArrayList<>();
			for (SqlNode columnName : list) {
				final SqlIdentifier id = (SqlIdentifier) columnName;
				String name = id.getSimple();
				nameList.add(name);
			}
			return convertUsing(leftNamespace, rightNamespace, nameList);
		default:
			throw Util.unexpected(conditionType);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:30,代码来源:SqlToRelConverter.java

示例15: convertJoinCondition

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private RexNode convertJoinCondition(Blackboard bb,
                                     SqlValidatorNamespace leftNamespace,
                                     SqlValidatorNamespace rightNamespace,
                                     SqlNode condition,
                                     JoinConditionType conditionType,
                                     RelNode leftRel,
                                     RelNode rightRel) {
  if (condition == null) {
    return rexBuilder.makeLiteral(true);
  }
  bb.setRoot(ImmutableList.of(leftRel, rightRel));
  replaceSubQueries(bb, condition, RelOptUtil.Logic.UNKNOWN_AS_FALSE);
  switch (conditionType) {
  case ON:
    bb.setRoot(ImmutableList.of(leftRel, rightRel));
    return bb.convertExpression(condition);
  case USING:
    final SqlNodeList list = (SqlNodeList) condition;
    final List<String> nameList = new ArrayList<>();
    for (SqlNode columnName : list) {
      final SqlIdentifier id = (SqlIdentifier) columnName;
      String name = id.getSimple();
      nameList.add(name);
    }
    return convertUsing(leftNamespace, rightNamespace, nameList);
  default:
    throw Util.unexpected(conditionType);
  }
}
 
开发者ID:apache,项目名称:kylin,代码行数:30,代码来源:SqlToRelConverter.java


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