in thriftserver/session/src/main/java/org/apache/livy/thriftserver/session/SparkUtils.java [113:149]
public static int toJavaSQLType(org.apache.spark.sql.types.DataType type) {
if (type instanceof NullType) {
return Types.NULL;
} else if (type instanceof BooleanType) {
return Types.BOOLEAN;
} else if (type instanceof ByteType) {
return Types.TINYINT;
} else if (type instanceof ShortType) {
return Types.SMALLINT;
} else if (type instanceof IntegerType) {
return Types.INTEGER;
} else if (type instanceof LongType) {
return Types.BIGINT;
} else if (type instanceof FloatType) {
return Types.FLOAT;
} else if (type instanceof DoubleType) {
return Types.DOUBLE;
} else if (type instanceof StringType) {
return Types.VARCHAR;
} else if (type instanceof DecimalType) {
return Types.DECIMAL;
} else if (type instanceof DateType) {
return Types.DATE;
} else if (type instanceof TimestampType) {
return Types.TIMESTAMP;
} else if (type instanceof BinaryType) {
return Types.BINARY;
} else if (type instanceof ArrayType) {
return Types.ARRAY;
} else if (type instanceof MapType) {
return Types.JAVA_OBJECT;
} else if (type instanceof StructType) {
return Types.STRUCT;
} else {
return Types.OTHER;
}
}