File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
sql/hive/src/test/scala/org/apache/spark/sql/hive Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1431,4 +1431,26 @@ class StatisticsSuite extends StatisticsCollectionTestBase with TestHiveSingleto
1431
1431
assert(catalogStats.rowCount.isEmpty)
1432
1432
}
1433
1433
}
1434
+
1435
+ test(s " CTAS should update statistics if ${SQLConf .AUTO_SIZE_UPDATE_ENABLED .key} is enabled " ) {
1436
+ val tableName = " SPARK_23263"
1437
+ Seq (false , true ).foreach { isConverted =>
1438
+ Seq (false , true ).foreach { updateEnabled =>
1439
+ withSQLConf(
1440
+ SQLConf .AUTO_SIZE_UPDATE_ENABLED .key -> updateEnabled.toString,
1441
+ HiveUtils .CONVERT_METASTORE_PARQUET .key -> isConverted.toString) {
1442
+ withTable(tableName) {
1443
+ sql(s " CREATE TABLE $tableName STORED AS parquet AS SELECT 'a', 'b' " )
1444
+ val catalogTable = getCatalogTable(tableName)
1445
+ // Hive serde tables always update statistics by Hive metastore
1446
+ if (! isConverted || updateEnabled) {
1447
+ assert(catalogTable.stats.nonEmpty)
1448
+ } else {
1449
+ assert(catalogTable.stats.isEmpty)
1450
+ }
1451
+ }
1452
+ }
1453
+ }
1454
+ }
1455
+ }
1434
1456
}
You can’t perform that action at this time.
0 commit comments