File tree Expand file tree Collapse file tree 5 files changed +98
-2
lines changed
main/scala/org/apache/spark/sql/execution/command
scala/org/apache/spark/sql Expand file tree Collapse file tree 5 files changed +98
-2
lines changed Original file line number Diff line number Diff line change @@ -189,8 +189,9 @@ case class DescribeDatabaseCommand(
189
189
Row (" Catalog Name" , SESSION_CATALOG_NAME ) ::
190
190
Row (" Database Name" , dbMetadata.name) ::
191
191
Row (" Comment" , dbMetadata.description) ::
192
- Row (" Location" , CatalogUtils .URIToString (dbMetadata.locationUri))::
193
- Row (" Owner" , allDbProperties.getOrElse(PROP_OWNER , " " )) :: Nil
192
+ Row (" Location" , CatalogUtils .URIToString (dbMetadata.locationUri)) ::
193
+ Row (" Owner" , allDbProperties.getOrElse(PROP_OWNER , " " )) ::
194
+ allDbProperties.get(PROP_COLLATION ).map(Row (" Collation" , _)).toList
194
195
195
196
if (extended) {
196
197
val properties = allDbProperties -- CatalogV2Util .NAMESPACE_RESERVED_PROPERTIES
Original file line number Diff line number Diff line change @@ -213,6 +213,41 @@ org.apache.spark.sql.catalyst.parser.ParseException
213
213
}
214
214
215
215
216
+ -- !query
217
+ DROP SCHEMA IF EXISTS test_schema
218
+ -- !query analysis
219
+ DropNamespace true, false
220
+ +- ResolvedNamespace V2SessionCatalog(spark_catalog), [test_schema]
221
+
222
+
223
+ -- !query
224
+ CREATE SCHEMA test_schema DEFAULT COLLATION UNICODE
225
+ -- !query analysis
226
+ CreateNamespace false, [collation=UNICODE]
227
+ +- ResolvedNamespace V2SessionCatalog(spark_catalog), [test_schema]
228
+
229
+
230
+ -- !query
231
+ DESCRIBE SCHEMA EXTENDED test_schema
232
+ -- !query analysis
233
+ DescribeNamespace true, [info_name#x, info_value#x]
234
+ +- ResolvedNamespace V2SessionCatalog(spark_catalog), [test_schema]
235
+
236
+
237
+ -- !query
238
+ ALTER SCHEMA test_schema DEFAULT COLLATION UTF8_LCASE
239
+ -- !query analysis
240
+ SetNamespaceCollationCommand UTF8_LCASE
241
+ +- ResolvedNamespace V2SessionCatalog(spark_catalog), [test_schema]
242
+
243
+
244
+ -- !query
245
+ DESCRIBE SCHEMA EXTENDED test_schema
246
+ -- !query analysis
247
+ DescribeNamespace true, [info_name#x, info_value#x]
248
+ +- ResolvedNamespace V2SessionCatalog(spark_catalog), [test_schema]
249
+
250
+
216
251
-- !query
217
252
DESC temp_v
218
253
-- !query analysis
Original file line number Diff line number Diff line change @@ -64,6 +64,13 @@ DESC t PARTITION (c='Us');
64
64
-- ParseException: PARTITION specification is incomplete
65
65
DESC t PARTITION (c= ' Us' , d);
66
66
67
+ -- DESC SCHEMA
68
+ DROP SCHEMA IF EXISTS test_schema;
69
+ CREATE SCHEMA test_schema DEFAULT COLLATION UNICODE;
70
+ DESCRIBE SCHEMA EXTENDED test_schema;
71
+ ALTER SCHEMA test_schema DEFAULT COLLATION UTF8_LCASE;
72
+ DESCRIBE SCHEMA EXTENDED test_schema;
73
+
67
74
-- DESC Temp View
68
75
69
76
DESC temp_v;
Original file line number Diff line number Diff line change @@ -453,6 +453,58 @@ org.apache.spark.sql.catalyst.parser.ParseException
453
453
}
454
454
455
455
456
+ -- !query
457
+ DROP SCHEMA IF EXISTS test_schema
458
+ -- !query schema
459
+ struct<>
460
+ -- !query output
461
+
462
+
463
+
464
+ -- !query
465
+ CREATE SCHEMA test_schema DEFAULT COLLATION UNICODE
466
+ -- !query schema
467
+ struct<>
468
+ -- !query output
469
+
470
+
471
+
472
+ -- !query
473
+ DESCRIBE SCHEMA EXTENDED test_schema
474
+ -- !query schema
475
+ struct<info_name:string,info_value:string>
476
+ -- !query output
477
+ Catalog Name spark_catalog
478
+ Collation UNICODE
479
+ Comment
480
+ Location [not included in comparison]/{warehouse_dir}/test_schema.db
481
+ Namespace Name test_schema
482
+ Owner [not included in comparison]
483
+ Properties
484
+
485
+
486
+ -- !query
487
+ ALTER SCHEMA test_schema DEFAULT COLLATION UTF8_LCASE
488
+ -- !query schema
489
+ struct<>
490
+ -- !query output
491
+
492
+
493
+
494
+ -- !query
495
+ DESCRIBE SCHEMA EXTENDED test_schema
496
+ -- !query schema
497
+ struct<info_name:string,info_value:string>
498
+ -- !query output
499
+ Catalog Name spark_catalog
500
+ Collation UTF8_LCASE
501
+ Comment
502
+ Location [not included in comparison]/{warehouse_dir}/test_schema.db
503
+ Namespace Name test_schema
504
+ Owner [not included in comparison]
505
+ Properties
506
+
507
+
456
508
-- !query
457
509
DESC temp_v
458
510
-- !query schema
Original file line number Diff line number Diff line change @@ -156,6 +156,7 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession with SQLHelper
156
156
// SPARK-39564: don't print out serde to avoid introducing complicated and error-prone
157
157
// regex magic.
158
158
.set(" spark.test.noSerdeInExplain" , " true" )
159
+ .set(SQLConf .SCHEMA_LEVEL_COLLATIONS_ENABLED , true )
159
160
160
161
// SPARK-32106 Since we add SQL test 'transform.sql' will use `cat` command,
161
162
// here we need to ignore it.
You can’t perform that action at this time.
0 commit comments