HyukjinKwon commented on code in PR #47791: URL: https://github.com/apache/spark/pull/47791#discussion_r1721099770
########## sql/core/src/test/scala/org/apache/spark/sql/InlineTableParsingImprovementsSuite.scala: ########## @@ -226,4 +287,72 @@ class InlineTableParsingImprovementsSuite extends QueryTest with SharedSparkSess } } } + + test("Value list in subquery") { Review Comment: Let's add a JIRA prefix in the test title ```suggestion test("SPARK-49269: Value list in subquery") { ``` ########## sql/core/src/test/scala/org/apache/spark/sql/InlineTableParsingImprovementsSuite.scala: ########## @@ -226,4 +287,72 @@ class InlineTableParsingImprovementsSuite extends QueryTest with SharedSparkSess } } } + + test("Value list in subquery") { + var firstDF: Option[DataFrame] = None + val flagVals = Seq(true, false) + flagVals.foreach { eagerEvalOfUnresolvedInlineTableEnabled => + // Set the feature flag for the InsertIntoValues improvement. + withSQLConf(SQLConf.EAGER_EVAL_OF_UNRESOLVED_INLINE_TABLE_ENABLED.key -> + eagerEvalOfUnresolvedInlineTableEnabled.toString) { + + // Generate a subquery with a VALUES clause. + val sqlStatement = s"SELECT * FROM ($generateValuesWithComplexExpressions)" + + // Parse the SQL statement. + val plan = parser.parsePlan(sqlStatement) + + // Traverse the plan and check for the presence of appropriate nodes depending on the + // feature flag. + if (eagerEvalOfUnresolvedInlineTableEnabled) { + assert(traversePlanAndCheckForNodeType(plan, classOf[LocalRelation])) + } else { + assert(traversePlanAndCheckForNodeType(plan, classOf[UnresolvedInlineTable])) + } + + val res = spark.sql(sqlStatement) + + // Check that both insertions will produce equivalent tables. + if (flagVals.head == eagerEvalOfUnresolvedInlineTableEnabled) { + firstDF = Some(res) + } else { + checkAnswer(res, firstDF.get) + } + } + } + } + + test("Value list in projection list subquery") { Review Comment: here too -- 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