physinet commented on code in PR #36545: URL: https://github.com/apache/spark/pull/36545#discussion_r874781396
########## python/docs/source/migration_guide/pyspark_3.3_to_3.4.rst: ########## @@ -0,0 +1,23 @@ +.. Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + + +================================= +Upgrading from PySpark 3.3 to 3.4 +================================= + +* In Spark 3.4, the schema of an array column is inferred by merging the schemas of all elements in the array. To restore the previous behavior where the schema is only inferred from the first element, set the spark configuration as follows: ``{"spark.sql.pyspark.legacy.inferArrayTypeFromFirstElement.enabled": True}``. Review Comment: [7cde786](https://github.com/apache/spark/commit/7cde786d3cf40e6cfbfbd42cff513d94b2003c06) ########## sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala: ########## @@ -3758,6 +3758,15 @@ object SQLConf { .booleanConf .createWithDefault(false) + val LEGACY_INFER_ARRAY_TYPE_FROM_FIRST_ELEMENT = + buildConf("spark.sql.pyspark.legacy.inferArrayTypeFromFirstElement.enabled") + .doc("PySpark's SparkSession.createDataFrame infers the element type of an array from all " + + "values in the array by default. If this config is set to true, it restores the legacy " + + "behavior of only inferring the type from the first array element.") + .version("3.3.0") Review Comment: [969557f](https://github.com/apache/spark/pull/36545/commits/969557fde1157239e8c5ac912e8ca7b0606f0d6a) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
