Skip to content

Commit

Permalink
Allow hive pushdown filter for Analyze on partitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Karteekmurthys authored and aditi-pandit committed Oct 10, 2023
1 parent 2436043 commit 4583949
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,6 @@ private static String getColumnName(ConnectorSession session, HiveMetadata metad
protected boolean isPushdownFilterSupported(ConnectorSession session, TableHandle tableHandle)
{
checkArgument(tableHandle.getConnectorHandle() instanceof HiveTableHandle, "pushdownFilter is never supported on a non-hive TableHandle");
if (((HiveTableHandle) tableHandle.getConnectorHandle()).getAnalyzePartitionValues().isPresent()) {
return false;
}

boolean pushdownFilterEnabled = HiveSessionProperties.isPushdownFilterEnabled(session);
if (pushdownFilterEnabled) {
HiveStorageFormat hiveStorageFormat = getHiveStorageFormat(getMetadata(tableHandle).getTableMetadata(session, tableHandle.getConnectorHandle()).getProperties());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,13 @@ public void testAnalyzeStats()
"('regionkey', NULL, 5.0, 0.0, NULL, '0', '4')," +
"('nationkey', NULL, 25.0, 0.0, NULL, '0', '24')," +
"(NULL, NULL, NULL, NULL, 25.0, NULL, NULL))");
// @TODO Add test for Analyze on table partitions. Refer: https://github.com/prestodb/presto/issues/20232
assertUpdate(String.format("ANALYZE %s WITH (partitions = ARRAY[ARRAY['0','0'],ARRAY['4', '11']])", tmpTableName), 2);
assertQuery(String.format("SHOW STATS for (SELECT * FROM %s where regionkey=4 and nationkey=11)", tmpTableName),
"SELECT * FROM (VALUES" +
"('name', 8.0, 1.0, 0.0, NULL, NULL, NULL)," +
"('regionkey', NULL, 1.0, 0.0, NULL, '4', '4')," +
"('nationkey', NULL, 1.0, 0.0, NULL, '11', '11')," +
"(NULL, NULL, NULL, NULL, 1.0, NULL, NULL))");
}
finally {
dropTableIfExists(tmpTableName);
Expand Down

0 comments on commit 4583949

Please sign in to comment.