private RelDataType sqlType(RelDataTypeFactory typeFactory, int dataType, int precision, int scale, String typeString) { SqlTypeName sqlTypeName = SqlTypeName.getNameForJdbcType(dataType); switch (sqlTypeName) { case ARRAY: RelDataType component = null; if (typeString != null && typeString.endsWith(" ARRAY")) { // E.g. hsqldb gives "INTEGER ARRAY", so we deduce the component type // "INTEGER". final String remaining = typeString.substring(0, typeString.length() - " ARRAY".length()); component = parseTypeString(typeFactory, remaining); } if (component == null) { component = typeFactory.createSqlType(SqlTypeName.ANY); } return typeFactory.createArrayType(component, -1); } if (precision >= 0 && scale >= 0 && sqlTypeName.allowsPrecScale(true, true)) { return typeFactory.createSqlType(sqlTypeName, precision, scale); } else if (precision >= 0 && sqlTypeName.allowsPrecNoScale()) { return typeFactory.createSqlType(sqlTypeName, precision); } else { assert sqlTypeName.allowsNoPrecNoScale(); return typeFactory.createSqlType(sqlTypeName); } }
private RelDataType zzz(int dataType, int precision, int scale) { SqlTypeName sqlTypeName = SqlTypeName.getNameForJdbcType(dataType); if (precision >= 0 && scale >= 0 && sqlTypeName.allowsPrecScale(true, true)) { return typeFactory.createSqlType(sqlTypeName, precision, scale); } else if (precision >= 0 && sqlTypeName.allowsPrecNoScale()) { return typeFactory.createSqlType(sqlTypeName, precision); } else { assert sqlTypeName.allowsNoPrecNoScale(); return typeFactory.createSqlType(sqlTypeName); } }
public RelDataType inferReturnType( SqlOperatorBinding opBinding) { // Here we know all the operands have the same type, // which has a size (precision), but not a scale. RelDataType ret = opBinding.getOperandType(0); SqlTypeName typeName = ret.getSqlTypeName(); assert typeName.allowsPrecNoScale() : "LiteralChain has impossible operand type " + typeName; int size = 0; for (RelDataType type : opBinding.collectOperandTypes()) { size += type.getPrecision(); assert type.getSqlTypeName().equals(typeName); } return opBinding.getTypeFactory().createSqlType(typeName, size); }
public RelDataType inferReturnType( SqlOperatorBinding opBinding) { // Here we know all the operands have the same type, // which has a size (precision), but not a scale. RelDataType ret = opBinding.getOperandType(0); SqlTypeName typeName = ret.getSqlTypeName(); assert typeName.allowsPrecNoScale() : "LiteralChain has impossible operand type " + typeName; int size = 0; for (RelDataType type : opBinding.collectOperandTypes()) { size += type.getPrecision(); assert (type.getSqlTypeName().equals(typeName)); } return opBinding.getTypeFactory().createSqlType(typeName, size); }
type = typeFactory.createSqlType(sqlTypeName, precision, scale); } else if (precision >= 0) { assert sqlTypeName.allowsPrecNoScale(); type = typeFactory.createSqlType(sqlTypeName, precision); } else {
type = typeFactory.createSqlType(sqlTypeName, precision, scale); } else if (precision >= 0) { assert (sqlTypeName.allowsPrecNoScale()); type = typeFactory.createSqlType(sqlTypeName, precision); } else {