Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1431,4 +1431,26 @@ class StatisticsSuite extends StatisticsCollectionTestBase with TestHiveSingleto
assert(catalogStats.rowCount.isEmpty)
}
}

test(s"CTAS should update statistics if ${SQLConf.AUTO_SIZE_UPDATE_ENABLED.key} is enabled") {
val tableName = "SPARK_23263"
Seq(false, true).foreach { isConverted =>
Seq(false, true).foreach { updateEnabled =>
withSQLConf(
SQLConf.AUTO_SIZE_UPDATE_ENABLED.key -> updateEnabled.toString,
HiveUtils.CONVERT_METASTORE_PARQUET.key -> isConverted.toString) {
withTable(tableName) {
sql(s"CREATE TABLE $tableName STORED AS parquet AS SELECT 'a', 'b'")
val catalogTable = getCatalogTable(tableName)
// Hive serde tables always update statistics by Hive metastore
if (!isConverted || updateEnabled) {
assert(catalogTable.stats.nonEmpty)
} else {
assert(catalogTable.stats.isEmpty)
}
}
}
}
}
}
}