uros-b commented on code in PR #59835:
URL: https://github.com/apache/spark/pull/59835#discussion_r4391676384


##########
sql/core/src/test/resources/sql-tests/results/show-commands.sql.out:
##########
@@ -0,0 +1,156 @@
+-- Automatically generated by SQLQueryTestSuite
+-- !query
+SHOW CATALOGS
+-- !query schema
+struct<catalog:string>
+-- !query output
+spark_catalog
+
+
+-- !query
+SHOW CURRENT NAMESPACE
+-- !query schema
+struct<catalog:string,namespace:string>
+-- !query output
+spark_catalog  default
+
+
+-- !query
+CREATE DATABASE show_commands_db
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+USE show_commands_db
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW CURRENT DATABASE
+-- !query schema
+struct<catalog:string,namespace:string>
+-- !query output
+spark_catalog  show_commands_db
+
+
+-- !query
+SET CATALOG 'testcat'
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW CURRENT NAMESPACE
+-- !query schema
+struct<catalog:string,namespace:string>
+-- !query output
+testcat
+
+
+-- !query
+SHOW CATALOGS
+-- !query schema
+struct<catalog:string>
+-- !query output
+spark_catalog
+testcat
+
+
+-- !query
+SHOW CATALOGS LIKE 'TEST*'
+-- !query schema
+struct<catalog:string>
+-- !query output
+testcat
+
+
+-- !query
+SHOW CATALOGS 'non_existing_catalog_pattern'
+-- !query schema
+struct<catalog:string>
+-- !query output
+
+
+
+-- !query
+CREATE NAMESPACE testcat.show_commands_ns.`inner.ns`
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+USE testcat.show_commands_ns.`inner.ns`
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW CURRENT SCHEMA
+-- !query schema
+struct<catalog:string,namespace:string>
+-- !query output
+testcat        show_commands_ns.`inner.ns`
+
+
+-- !query
+USE spark_catalog.default
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP NAMESPACE testcat.show_commands_ns.`inner.ns`
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP DATABASE show_commands_db
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW COLLATIONS LIKE 'utf8_*|en_USA'
+-- !query schema
+struct<NAME:string,LANGUAGE:string,COUNTRY:string,ACCENT_SENSITIVITY:string,CASE_SENSITIVITY:string,PAD_ATTRIBUTE:string,ICU_VERSION:string>
+-- !query output
+UTF8_BINARY    NULL    NULL    ACCENT_SENSITIVE        CASE_SENSITIVE  NO_PAD  
NULL
+UTF8_BINARY_RTRIM      NULL    NULL    ACCENT_SENSITIVE        CASE_SENSITIVE  
RTRIM   NULL
+UTF8_LCASE     NULL    NULL    ACCENT_SENSITIVE        CASE_INSENSITIVE        
NO_PAD  NULL
+UTF8_LCASE_RTRIM       NULL    NULL    ACCENT_SENSITIVE        
CASE_INSENSITIVE        RTRIM   NULL
+en_USA English United States   ACCENT_SENSITIVE        CASE_SENSITIVE  NO_PAD  
78.3.0.0
+
+
+-- !query
+SHOW COLLATIONS 'UTF8_BINARY'
+-- !query schema
+struct<NAME:string,LANGUAGE:string,COUNTRY:string,ACCENT_SENSITIVITY:string,CASE_SENSITIVITY:string,PAD_ATTRIBUTE:string,ICU_VERSION:string>
+-- !query output
+UTF8_BINARY    NULL    NULL    ACCENT_SENSITIVE        CASE_SENSITIVE  NO_PAD  
NULL
+
+
+-- !query
+SHOW COLLATIONS LIKE 'non_existing_collation_pattern'

Review Comment:
   utf8_* is the stable selection: UTF8_BINARY / UTF8_BINARY_RTRIM / UTF8_LCASE 
/ UTF8_LCASE_RTRIM all have NULL ICU_VERSION. Keep:
   
     SHOW COLLATIONS LIKE 'utf8_*';
     SHOW COLLATIONS 'UTF8_BINARY';
     SHOW COLLATIONS LIKE 'non_existing_collation_pattern';
   
   That still covers the schema, LIKE wildcards, the optional LIKE, exact 
match, no matches, and the analyzed ShowCollationsCommand nodes. ICU locale 
rows belong in CollationSuite / DataSourceV2SQLSuite, which do not pin the 
version.



##########
sql/core/src/test/resources/sql-tests/results/show-commands.sql.out:
##########
@@ -0,0 +1,156 @@
+-- Automatically generated by SQLQueryTestSuite
+-- !query
+SHOW CATALOGS
+-- !query schema
+struct<catalog:string>
+-- !query output
+spark_catalog
+
+
+-- !query
+SHOW CURRENT NAMESPACE
+-- !query schema
+struct<catalog:string,namespace:string>
+-- !query output
+spark_catalog  default
+
+
+-- !query
+CREATE DATABASE show_commands_db
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+USE show_commands_db
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW CURRENT DATABASE
+-- !query schema
+struct<catalog:string,namespace:string>
+-- !query output
+spark_catalog  show_commands_db
+
+
+-- !query
+SET CATALOG 'testcat'
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW CURRENT NAMESPACE
+-- !query schema
+struct<catalog:string,namespace:string>
+-- !query output
+testcat
+
+
+-- !query
+SHOW CATALOGS
+-- !query schema
+struct<catalog:string>
+-- !query output
+spark_catalog
+testcat
+
+
+-- !query
+SHOW CATALOGS LIKE 'TEST*'
+-- !query schema
+struct<catalog:string>
+-- !query output
+testcat
+
+
+-- !query
+SHOW CATALOGS 'non_existing_catalog_pattern'
+-- !query schema
+struct<catalog:string>
+-- !query output
+
+
+
+-- !query
+CREATE NAMESPACE testcat.show_commands_ns.`inner.ns`
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+USE testcat.show_commands_ns.`inner.ns`
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW CURRENT SCHEMA
+-- !query schema
+struct<catalog:string,namespace:string>
+-- !query output
+testcat        show_commands_ns.`inner.ns`
+
+
+-- !query
+USE spark_catalog.default
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP NAMESPACE testcat.show_commands_ns.`inner.ns`
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP DATABASE show_commands_db
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW COLLATIONS LIKE 'utf8_*|en_USA'
+-- !query schema
+struct<NAME:string,LANGUAGE:string,COUNTRY:string,ACCENT_SENSITIVITY:string,CASE_SENSITIVITY:string,PAD_ATTRIBUTE:string,ICU_VERSION:string>
+-- !query output
+UTF8_BINARY    NULL    NULL    ACCENT_SENSITIVE        CASE_SENSITIVE  NO_PAD  
NULL
+UTF8_BINARY_RTRIM      NULL    NULL    ACCENT_SENSITIVE        CASE_SENSITIVE  
RTRIM   NULL
+UTF8_LCASE     NULL    NULL    ACCENT_SENSITIVE        CASE_INSENSITIVE        
NO_PAD  NULL
+UTF8_LCASE_RTRIM       NULL    NULL    ACCENT_SENSITIVE        
CASE_INSENSITIVE        RTRIM   NULL
+en_USA English United States   ACCENT_SENSITIVE        CASE_SENSITIVE  NO_PAD  
78.3.0.0

Review Comment:
   Please do not snapshot an ICU collation in the SQL golden.
   
   SHOW COLLATIONS LIKE 'utf8_*|en_USA' writes:
   
     en_USA  English United States ... 78.3.0.0
   
   That comes from CollationSpecICU.buildCollationMeta, which stores 
VersionInfo.ICU_VERSION.toString() (currently "78.3.0.0"), not the major.minor 
"78.3" used as Collation.version. CollationSuite / the collations() TVF tests 
already bind ICU_VERSION at runtime so they survive icu4j bumps. This would be 
the first sql-tests golden that does not. Spark's icu4j.version is 78.3 today; 
the SHOW COLLATIONS docs examples still say 78.2. Every ICU upgrade will fail 
SQLQueryTestSuite until someone regenerates this file. LANGUAGE/COUNTRY are ICU 
display names, so they can move 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to