Skip to content

Commit 0a08b10

Browse files
avovchenkomgorbov
authored andcommitted
[MAPR-30536] Spark SQL queries on Map column fails after upgrade (apache#211)
1 parent 3013d51 commit 0a08b10

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.spark.sql.catalyst.analysis
1919

20+
import org.apache.spark.SparkContext
2021
import org.apache.spark.sql.AnalysisException
2122
import org.apache.spark.sql.catalyst.catalog.SimpleCatalogRelation
2223
import org.apache.spark.sql.catalyst.expressions._
@@ -387,10 +388,13 @@ trait CheckAnalysis extends PredicateHelper {
387388
// TODO: although map type is not orderable, technically map type should be able to be
388389
// used in equality comparison, remove this type check once we support it.
389390
case o if mapColumnInSetOperation(o).isDefined =>
390-
val mapCol = mapColumnInSetOperation(o).get
391-
failAnalysis("Cannot have map type columns in DataFrame which calls " +
392-
s"set operations(intersect, except, etc.), but the type of column ${mapCol.name} " +
393-
"is " + mapCol.dataType.simpleString)
391+
val conf = SparkContext.getOrCreate().getConf
392+
if(!conf.getBoolean("spark.sql.allow.distinct.map", false)) {
393+
val mapCol = mapColumnInSetOperation(o).get
394+
failAnalysis("Cannot have map type columns in DataFrame which calls " +
395+
s"set operations(intersect, except, etc.), but the type of column ${mapCol.name} " +
396+
"is " + mapCol.dataType.simpleString)
397+
}
394398

395399
case s: SimpleCatalogRelation =>
396400
failAnalysis(

0 commit comments

Comments
 (0)