- 
                Notifications
    
You must be signed in to change notification settings  - Fork 28.9k
 
[SPARK-50541][SQL] Describe Table As JSON #49139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Closed
      
      
    
                
     Closed
            
            
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    
              
                    MaxGekk
  
              
              requested changes
              
                  
                    Dec 11, 2024 
                  
              
              
            
            
        
          
                sql/api/src/main/scala/org/apache/spark/sql/types/DataType.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
      
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
        
          
                sql/api/src/main/scala/org/apache/spark/sql/types/DataType.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
      
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
        
          
                sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
      
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
        
          
                sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
      
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
        
          
                sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
      
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
        
          
                sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
      
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
        
          
                sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
      
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
        
          
                sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
          
            Show resolved
            Hide resolved
        
      
              
                    MaxGekk
  
              
              reviewed
              
                  
                    Dec 17, 2024 
                  
              
              
            
            
        
          
                sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
      
              
                    srielau
  
              
              reviewed
              
                  
                    Jan 4, 2025 
                  
              
              
            
            
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Jan 6, 2025 
                  
              
              
            
            
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Jan 6, 2025 
                  
              
              
            
            
        
          
                sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
      
              
                    srielau
  
              
              reviewed
              
                  
                    Jan 6, 2025 
                  
              
              
            
            
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Jan 7, 2025 
                  
              
              
            
            
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Jan 7, 2025 
                  
              
              
            
            
              
                    cloud-fan
  
              
              reviewed
              
                  
                    Jan 7, 2025 
                  
              
              
            
            
        
          
                sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | 
           thanks, merging to master!  | 
    
        
          
                sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DescribeTableSuite.scala
          
            Show resolved
            Hide resolved
        
      
    
  dongjoon-hyun 
      added a commit
      that referenced
      this pull request
    
      Jan 7, 2025 
    
    
      
  
    
      
    
  
…rd-coded version strings ### What changes were proposed in this pull request? This is a follow-up to use `SPARK_VERSION` instead of hard-coded version strings. - #49139 ### Why are the changes needed? Hard-coded version strings will cause unit test failures from next week during Apache Spark 4.0.0 RC and maintenance releases like 4.0.1-SNAPSHOT. **BEFORE** ``` $ git grep 'created_by = Some("Spark ' sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DescribeTableSuite.scala: created_by = Some("Spark 4.0.0-SNAPSHOT"), sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DescribeTableSuite.scala: created_by = Some("Spark 4.0.0-SNAPSHOT"), sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DescribeTableSuite.scala: created_by = Some("Spark 4.0.0-SNAPSHOT"), sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DescribeTableSuite.scala: created_by = Some("Spark 4.0.0-SNAPSHOT"), sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DescribeTableSuite.scala: created_by = Some("Spark 4.0.0-SNAPSHOT"), ``` **AFTER** ``` $ git grep 'created_by = Some("Spark ' $ ``` ### Does this PR introduce _any_ user-facing change? No, this is a test-case fix. ### How was this patch tested? Pass the CIs and check manually. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #49401 from dongjoon-hyun/SPARK-50541. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
    
  dongjoon-hyun 
      pushed a commit
      that referenced
      this pull request
    
      Jan 15, 2025 
    
    
      
  
    
      
    
  
### What changes were proposed in this pull request? This is a follow-up of #49139 to use v2 command to simplify the code. Now we only need one logical plan and all the implementation is centralized to that logical plan, no need to touch other analyzer/planner rules. ### Why are the changes needed? code simplification ### Does this PR introduce _any_ user-facing change? no, this feature is not released yet. ### How was this patch tested? update tests ### Was this patch authored or co-authored using generative AI tooling? no Closes #49466 from cloud-fan/as-json. Authored-by: Wenchen Fan <wenchen@databricks.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
What changes were proposed in this pull request?
Support
DESCRIBE TABLE ... [AS JSON]to optionally display table metadata in JSON format.SQL Ref Spec:
{ DESC | DESCRIBE } [ TABLE ] [ EXTENDED | FORMATTED ] table_name { [ PARTITION clause ] | [ column_name ] } [ AS JSON ]
Output:
json_metadata: String
Why are the changes needed?
The Spark SQL command
DESCRIBE TABLEdisplays table metadata in a DataFrame format geared toward human consumption. This format causes parsing challenges, e.g. if fields contain special characters or the format changes as new features are added.The new
AS JSONoption would return the table metadata as a JSON string that supports parsing via machine, while being extensible with a minimized risk of breaking changes. It is not meant to be human-readable.Does this PR introduce any user-facing change?
Yes, this provides a new option to display DESCRIBE TABLE metadata in JSON format. See below (and updated golden files) for the JSON output schema:
How was this patch tested?
describe.sqlDescribeTableParserSuite.scala,DescribeTableSuite.scala,PlanResolutionSuite.scalaWas this patch authored or co-authored using generative AI tooling?