本文整理汇总了Java中org.apache.calcite.rel.type.RelDataType.isNullable方法的典型用法代码示例。如果您正苦于以下问题:Java RelDataType.isNullable方法的具体用法?Java RelDataType.isNullable怎么用?Java RelDataType.isNullable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.rel.type.RelDataType
的用法示例。
在下文中一共展示了RelDataType.isNullable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inferReturnType
import org.apache.calcite.rel.type.RelDataType; //导入方法依赖的package包/类
@Override
public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
final RelDataTypeFactory factory = opBinding.getTypeFactory();
boolean isNullable = true;
int precision = 0;
for(RelDataType relDataType : opBinding.collectOperandTypes()) {
if(!relDataType.isNullable()) {
isNullable = false;
}
// If the underlying columns cannot offer information regarding the precision (i.e., the length) of the VarChar,
// Dremio uses the largest to represent it
if(relDataType.getPrecision() == TypeHelper.VARCHAR_DEFAULT_CAST_LEN
|| relDataType.getPrecision() == RelDataType.PRECISION_NOT_SPECIFIED) {
precision = TypeHelper.VARCHAR_DEFAULT_CAST_LEN;
} else {
precision += relDataType.getPrecision();
}
}
return factory.createTypeWithNullability(
factory.createSqlType(SqlTypeName.VARCHAR, precision),
isNullable);
}
示例2: FieldType
import org.apache.calcite.rel.type.RelDataType; //导入方法依赖的package包/类
public FieldType(String name, RelDataType dataType) {
this.name = name;
this.type = dataType.getSqlTypeName();
Integer p = null;
Integer s = null;
Integer fractionalSecondPrecision = null;
switch (dataType.getSqlTypeName()) {
case CHAR:
case BINARY:
case VARBINARY:
case VARCHAR:
p = dataType.getPrecision();
break;
case DECIMAL:
p = dataType.getPrecision();
s = dataType.getScale();
break;
case INTERVAL_YEAR_MONTH:
case INTERVAL_DAY_TIME:
p = dataType.getIntervalQualifier().getStartPrecisionPreservingDefault();
default:
break;
}
this.precision = p;
this.scale = s;
this.intervalQualifier = dataType.getIntervalQualifier();
this.isNullable = dataType.isNullable();
}
示例3: FieldType
import org.apache.calcite.rel.type.RelDataType; //导入方法依赖的package包/类
public FieldType(String name, RelDataType dataType) {
this.name = name;
this.type = dataType.getSqlTypeName();
Integer p = null;
Integer s = null;
switch (dataType.getSqlTypeName()) {
case CHAR:
case BINARY:
case VARBINARY:
case VARCHAR:
p = dataType.getPrecision();
break;
case DECIMAL:
p = dataType.getPrecision();
s = dataType.getScale();
break;
case TIME:
case TIMESTAMP:
p = dataType.getPrecision();
break;
case INTERVAL_YEAR:
case INTERVAL_YEAR_MONTH:
case INTERVAL_MONTH:
case INTERVAL_DAY:
case INTERVAL_DAY_HOUR:
case INTERVAL_DAY_MINUTE:
case INTERVAL_DAY_SECOND:
case INTERVAL_HOUR:
case INTERVAL_HOUR_MINUTE:
case INTERVAL_HOUR_SECOND:
case INTERVAL_MINUTE:
case INTERVAL_MINUTE_SECOND:
case INTERVAL_SECOND:
p = dataType.getIntervalQualifier().getStartPrecisionPreservingDefault();
default:
break;
}
this.precision = p;
this.scale = s;
this.intervalQualifier = dataType.getIntervalQualifier();
this.isNullable = dataType.isNullable();
}