You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2025/06/01 22:56:39 UTC

(spark) branch master updated: [SPARK-52363][SQL][TESTS] Analyzer NameScope test for nested struct fields inside map values

This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 8513b91c53b2 [SPARK-52363][SQL][TESTS] Analyzer NameScope test for nested struct fields inside map values
8513b91c53b2 is described below

commit 8513b91c53b2fd3692f773ab540c3e6715cce3c5
Author: dengziming <de...@bytedance.com>
AuthorDate: Mon Jun 2 07:56:27 2025 +0900

    [SPARK-52363][SQL][TESTS] Analyzer NameScope test for nested struct fields inside map values
    
    ### What changes were proposed in this pull request?
    This PR adds test coverage for resolving nested struct fields inside Map values which was missing in the original test suite.
    
    ### Why are the changes needed?
     The new test verifies that multi-part resolution like mapColumn['key'].nestedField works correctly, we already defined a field `col11MapWithStruct`, but we didn't test it properly.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    Unneeded
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #51059 from dengziming/SPARK-52363.
    
    Authored-by: dengziming <de...@bytedance.com>
    Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
 .../spark/sql/analysis/resolver/NameScopeSuite.scala    | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sql/core/src/test/scala/org/apache/spark/sql/analysis/resolver/NameScopeSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/analysis/resolver/NameScopeSuite.scala
index 5feecdb5b0a5..a937bc59b0a6 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/analysis/resolver/NameScopeSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/analysis/resolver/NameScopeSuite.scala
@@ -358,6 +358,23 @@ class NameScopeSuite extends PlanTest {
       )
     )
 
+    val matchedMapStructs = stack.resolveMultipartName(Seq("col11", "key", "field"))
+    assert(
+      matchedMapStructs == NameTarget(
+        candidates = Seq(
+          GetStructField(GetMapValue(col11MapWithStruct, Literal("key")), 0, Some("field"))),
+        aliasName = Some("field"),
+        output = Seq(
+          col8Struct,
+          col9NestedStruct,
+          col10Map,
+          col11MapWithStruct,
+          col12Array,
+          col13ArrayWithStruct
+        )
+      )
+    )
+
     var matchedArrays = stack.resolveMultipartName(Seq("col12", "element"))
     assert(
       matchedArrays == NameTarget(


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org