本文整理汇总了Java中org.apache.calcite.sql.type.SqlTypeName.DOUBLE属性的典型用法代码示例。如果您正苦于以下问题:Java SqlTypeName.DOUBLE属性的具体用法?Java SqlTypeName.DOUBLE怎么用?Java SqlTypeName.DOUBLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.calcite.sql.type.SqlTypeName
的用法示例。
在下文中一共展示了SqlTypeName.DOUBLE属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inferReturnType
@Override
public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
final RelDataTypeFactory factory = opBinding.getTypeFactory();
SqlTypeName typeToCastTo = null;
if (opBinding instanceof SqlCallBinding) {
SqlCallBinding sqlCallBinding = (SqlCallBinding) opBinding;
if (sqlCallBinding.operand(1).getKind() == SqlKind.LITERAL) {
String type = null;
try {
SqlLiteral sqlLiteral = (SqlLiteral) sqlCallBinding.operand(1);
type = ((NlsString) sqlLiteral.getValue()).getValue();
switch(type) {
case "JSON":
typeToCastTo = SqlTypeName.ANY;
break;
case "UTF8":
case "UTF16":
typeToCastTo = SqlTypeName.VARCHAR;
break;
case "BOOLEAN_BYTE":
typeToCastTo = SqlTypeName.BOOLEAN;
break;
case "TINYINT_BE":
case "TINYINT":
typeToCastTo = SqlTypeName.TINYINT;
break;
case "SMALLINT_BE":
case "SMALLINT":
typeToCastTo = SqlTypeName.SMALLINT;
break;
case "INT_BE":
case "INT":
case "INT_HADOOPV":
typeToCastTo = SqlTypeName.INTEGER;
break;
case "BIGINT_BE":
case "BIGINT":
case "BIGINT_HADOOPV":
typeToCastTo = SqlTypeName.BIGINT;
break;
case "FLOAT":
typeToCastTo = SqlTypeName.FLOAT;
break;
case "DOUBLE":
typeToCastTo = SqlTypeName.DOUBLE;
break;
case "DATE_EPOCH_BE":
case "DATE_EPOCH":
typeToCastTo = SqlTypeName.DATE;
break;
case "TIME_EPOCH_BE":
case "TIME_EPOCH":
typeToCastTo = SqlTypeName.TIME;
break;
case "TIMESTAMP_EPOCH":
case "TIMESTAMP_IMPALA":
typeToCastTo = SqlTypeName.TIMESTAMP;
break;
default:
typeToCastTo = SqlTypeName.ANY;
break;
}
} catch (final ClassCastException e) {
logger.debug("Failed to parse string for convert_from()");
}
}
}
if (typeToCastTo == null) {
typeToCastTo = SqlTypeName.ANY;
}
return factory.createTypeWithNullability(
factory.createSqlType(typeToCastTo),
true);
}