malon64 commented on code in PR #41055:
URL: https://github.com/apache/superset/pull/41055#discussion_r3414643668
##########
superset/db_engine_specs/trino.py:
##########
@@ -631,3 +680,34 @@ def get_indexes(
return super().get_indexes(database, inspector, table)
except NoSuchTableError:
return []
+
+ @classmethod
+ def latest_partition(
+ cls,
+ database: Database,
+ table: Table,
+ show_first: bool = False,
+ indexes: list[dict[str, Any]] | None = None,
+ ) -> tuple[list[str], list[str] | None]:
+ """
+ Return the latest partition for a table.
+
+ Iceberg "$partitions" metadata fields are filtered out first, so we
+ never build a latest-partition query against them.
+
+ :param database: the database the query will be run against
+ :param table: the table instance
+ :param show_first: return the value for the first partitioning key when
+ there are several
+ :param indexes: the indexes associated with the table
+ :returns: the column names and the latest partition values
+ """
+ if indexes is None:
+ indexes = database.get_indexes(table)
+
+ return super().latest_partition(
+ database,
+ table,
+ show_first=show_first,
+ indexes=cls._filter_iceberg_partition_indexes(indexes),
+ )
Review Comment:
Fixed by memoizing the override with the same timeout as the base method, so
the index lookup and filtering only run on a cache miss — restoring the
original caching cadence.
--
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]