Ashutosh
Ashutosh

Reputation: 85

What is the maximum length limitation for VARCHAR type in Spark?

I am trying to find out the length limitation for Varchar type in Spark. Checked the datatype documentation page but limit is not mentioned here. https://spark.apache.org/docs/latest/sql-ref-datatypes.html As mentioned on above page

VarcharType(length): A variant of StringType which has a length limitation. Data writing will fail if the input string exceeds the length limitation. Note: this type can only be used in table schema, not functions/operators.

So what can be the maximum possible value of length here?

Upvotes: 1

Views: 3994

Answers (1)

Csisanyi
Csisanyi

Reputation: 885

According to this doc

https://spark.apache.org/docs/latest/api/java/org/apache/spark/sql/types/VarcharType.html

Varchar type in Spark takes a constructor parameter that is an int

My guess is 2147483647 is the max length

Upvotes: 3

Related Questions