In spark data set I'm using createTableColumnTypes
for the database column data types to use instead of the defaults, when creating the table. It's working perfect for VARCHAR(n)
but if I'm using TEXT
it's throwing error. Code is written in Java
Dataset < Row > df = sqlContext.read()
.format("com.databricks.spark.csv")
.schema(sparkDataSchema)
.option("delimiter", dataDelimeter)
.option("header", true).option("quote", "\"")
.option("escape", "\"").load(paths.split(","));
df.write().option("truncate", true).mode(SaveMode.Overwrite).option("createTableColumnTypes", customSchema).jdbc(url, tableName, connectionProperties);
Error is given below
Exception in thread "main" org.apache.spark.sql.catalyst.parser.ParseException: DataType text is not supported.(line 1, pos 29)