Skip to content

Commit 578de9e

Browse files
committed
commit
Signed-off-by: weimingdiit <weimingdiit@gmail.com>
1 parent fe7ed93 commit 578de9e

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

spark-extension-shims-spark/src/test/scala/org/apache/auron/AuronFunctionSuite.scala

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,20 @@ class AuronFunctionSuite extends AuronQueryTest with BaseAuronSQLSuite {
358358
|insert into t1 values
359359
| (array(named_struct('k', 'a', 'v', 1), named_struct('k', cast(null as string), 'v', 2)))
360360
|""".stripMargin)
361+
val df = sql("select map_from_entries(c1) from t1")
361362
val err = intercept[Exception] {
362-
sql("select map_from_entries(c1) from t1").collect()
363+
df.collect()
363364
}
364-
assert(err.getMessage.contains("null map keys"))
365+
val plan = stripAQEPlan(df.queryExecution.executedPlan)
366+
plan
367+
.collectFirst { case op if !isNativeOrPassThrough(op) => op }
368+
.foreach { op =>
369+
fail(s"""
370+
|Found non-native operator: ${op.nodeName}
371+
|plan:
372+
|${plan}""".stripMargin)
373+
}
374+
assert(err.getMessage.toLowerCase.contains("null map key"))
365375
}
366376
}
367377

@@ -372,10 +382,20 @@ class AuronFunctionSuite extends AuronQueryTest with BaseAuronSQLSuite {
372382
|insert into t1 values
373383
| (array(named_struct('k', 'a', 'v', 1), named_struct('k', 'a', 'v', 2)))
374384
|""".stripMargin)
385+
val df = sql("select map_from_entries(c1) from t1")
375386
val err = intercept[Exception] {
376-
sql("select map_from_entries(c1) from t1").collect()
387+
df.collect()
377388
}
378-
assert(err.getMessage.contains("duplicate key"))
389+
val plan = stripAQEPlan(df.queryExecution.executedPlan)
390+
plan
391+
.collectFirst { case op if !isNativeOrPassThrough(op) => op }
392+
.foreach { op =>
393+
fail(s"""
394+
|Found non-native operator: ${op.nodeName}
395+
|plan:
396+
|${plan}""".stripMargin)
397+
}
398+
assert(err.getMessage.toLowerCase.contains("duplicate key"))
379399
}
380400
}
381401

spark-extension/src/main/scala/org/apache/spark/sql/auron/NativeConverters.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ object NativeConverters extends Logging {
10981098
buildExtScalarFunction(
10991099
"Spark_MapFromEntries",
11001100
e.child :: Literal
1101-
.create(SQLConf.get.getConf(SQLConf.MAP_KEY_DEDUP_POLICY), StringType) :: Nil,
1101+
.create(SQLConf.get.getConf(SQLConf.MAP_KEY_DEDUP_POLICY).toString, StringType) :: Nil,
11021102
e.dataType)
11031103
case e: MapConcat => buildExtScalarFunction("Spark_MapConcat", e.children, e.dataType)
11041104

0 commit comments

Comments
 (0)