cloud-fan commented on code in PR #45805: URL: https://github.com/apache/spark/pull/45805#discussion_r1556871731
########## sql/core/src/test/scala/org/apache/spark/sql/VariantSuite.scala: ########## @@ -298,4 +300,28 @@ class VariantSuite extends QueryTest with SharedSparkSession { } assert(ex.getErrorClass == "DATATYPE_MISMATCH.INVALID_ORDERING_TYPE") } + + test("variant_explode") { + def check(input: String, expected: Seq[Row]): Unit = { + withView("v") { + Seq(input).toDF("json").createOrReplaceTempView("v") + checkAnswer(sql("select pos, key, to_json(value) from v, " + + "lateral variant_explode(parse_json(json))"), expected) + val expectedOuter = if (expected.isEmpty) Seq(Row(null, null, null)) else expected + checkAnswer(sql("select pos, key, to_json(value) from v, " + + "lateral variant_explode_outer(parse_json(json))"), expectedOuter) + } + } + + Seq("true", "false").foreach { codegenEnabled => + withSQLConf(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> codegenEnabled) { + check(null, Nil) + check("1", Nil) Review Comment: oh, this is not a cast, this is exploding the input variant "1". The working example is listed below: `{"a": [1, 2, 3], "b": true}` -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org