File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
sql/hive/src/test/scala/org/apache/spark/sql/hive Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -591,4 +591,22 @@ class MetastoreDataSourcesSuite extends QueryTest with BeforeAndAfterEach {
591591 setConf(SQLConf .PARQUET_USE_DATA_SOURCE_API , originalUseDataSource)
592592 }
593593 }
594+
595+ test(" SPARK-6024 wide schema support" ) {
596+ val schema = StructType ((1 to 1000 ).map(i => StructField (s " c_ ${i}" , StringType , true )))
597+ assert(
598+ schema.json.size > conf.schemaStringLengthThreshold,
599+ " To correctly test the fix of SPARK-6024, the value of " +
600+ s " spark.sql.sources.schemaStringLengthThreshold needs to be less than ${schema.json.size}" )
601+ // Manually create a metastore data source table.
602+ catalog.createDataSourceTable(
603+ tableName = " wide_schema" ,
604+ userSpecifiedSchema = Some (schema),
605+ provider = " json" ,
606+ options = Map (" path" -> " just a dummy path" ),
607+ isExternal = false )
608+
609+ val actualSchema = table(" wide_schema" ).schema
610+ assert(schema === actualSchema)
611+ }
594612}
You can’t perform that action at this time.
0 commit comments