/** * {@inheritDoc}T * * <p>The operator class for this function isn't resolved to the * correct class. This happens in the case of user defined * functions. Return the return type to be 'ANY', so we don't * fail. */ @Override public RelDataType inferReturnType( SqlOperatorBinding opBinding) { return new BasicSqlType(SqlTypeName.ANY); } }
public RelDataType createSqlType(SqlTypeName typeName) { assertBasic(typeName); RelDataType newType = new BasicSqlType(typeName); return canonize(newType); }
/** * Returns the type for a histogram function. It is either the actual * type or an an approximation to it. */ private RelDataType computeHistogramType(RelDataType type) { if (SqlTypeUtil.isExactNumeric(type) && (type.getSqlTypeName() != SqlTypeName.BIGINT)) { return new BasicSqlType(SqlTypeName.BIGINT); } else if ( SqlTypeUtil.isApproximateNumeric(type) && (type.getSqlTypeName() != SqlTypeName.DOUBLE)) { return new BasicSqlType(SqlTypeName.DOUBLE); } else { return type; } } }
/** * Returns the type for a histogram function. It is either the actual * type or an an approximation to it. */ private RelDataType computeHistogramType(RelDataType type) { if (SqlTypeUtil.isExactNumeric(type) && (type.getSqlTypeName() != SqlTypeName.BIGINT)) { return new BasicSqlType(SqlTypeName.BIGINT); } else if ( SqlTypeUtil.isApproximateNumeric(type) && (type.getSqlTypeName() != SqlTypeName.DOUBLE)) { return new BasicSqlType(SqlTypeName.DOUBLE); } else { return type; } } }
public RelDataType createSqlType( SqlTypeName typeName, int precision) { assertBasic(typeName); assert (precision >= 0) || (precision == RelDataType.PRECISION_NOT_SPECIFIED); RelDataType newType = new BasicSqlType(typeName, precision); newType = SqlTypeUtil.addCharsetAndCollation(newType, this); return canonize(newType); }
public RelDataType createSqlType( SqlTypeName typeName, int precision, int scale) { assertBasic(typeName); assert (precision >= 0) || (precision == RelDataType.PRECISION_NOT_SPECIFIED); RelDataType newType = new BasicSqlType(typeName, precision, scale); newType = SqlTypeUtil.addCharsetAndCollation(newType, this); return canonize(newType); }
public RelDataType createSqlType( SqlTypeName typeName, int precision, int scale) { assertBasic(typeName); assert (precision >= 0) || (precision == RelDataType.PRECISION_NOT_SPECIFIED); RelDataType newType = new BasicSqlType(typeName, precision, scale); newType = SqlTypeUtil.addCharsetAndCollation(newType, this); return canonize(newType); }
public RelDataType createSqlType(SqlTypeName typeName) { if (typeName.allowsPrec()) { return createSqlType(typeName, typeName.getDefaultPrecision()); } assertBasic(typeName); RelDataType newType = new BasicSqlType(typeName); return canonize(newType); }
public RelDataType toSql(RelDataType type) { if (type instanceof RelRecordType) { return createStructType( Lists.transform(type.getFieldList(), new Function<RelDataTypeField, RelDataType>() { public RelDataType apply(RelDataTypeField a0) { return toSql(a0.getType()); } }), type.getFieldNames()); } if (type instanceof JavaType) { return createTypeWithNullability( new BasicSqlType(type.getSqlTypeName()), type.isNullable()); } return type; }
public RelDataType createSqlType( SqlTypeName typeName, int precision) { if (typeName.allowsScale()) { return createSqlType(typeName, precision, typeName.getDefaultScale()); } assertBasic(typeName); assert (precision >= 0) || (precision == RelDataType.PRECISION_NOT_SPECIFIED); RelDataType newType = new BasicSqlType(typeName, precision); newType = SqlTypeUtil.addCharsetAndCollation(newType, this); return canonize(newType); }
public RelDataType toSql(RelDataType type) { if (type instanceof RelRecordType) { RelRecordType relRecordType = (RelRecordType) type; final List<RelDataTypeField> fields = relRecordType.getFieldList(); return createStructType( Functions.adapt( fields, new Function1<RelDataTypeField, Pair<String, RelDataType>>() { public Pair<String, RelDataType> apply( RelDataTypeField a0) { return Pair.of(a0.getName(), toSql(a0.getType())); } })); } if (type instanceof JavaType) { return createTypeWithNullability( new BasicSqlType(type.getSqlTypeName()), type.isNullable()); } return type; }