john-bodley commented on code in PR #22435:
URL: https://github.com/apache/superset/pull/22435#discussion_r1050272617
##########
superset/db_engine_specs/presto.py:
##########
@@ -958,21 +1155,24 @@ def extra_table_metadata(
indexes = database.get_indexes(table_name, schema_name)
if indexes:
- cols = indexes[0].get("column_names", [])
- full_table_name = table_name
- if schema_name and "." not in table_name:
- full_table_name = "{}.{}".format(schema_name, table_name)
- pql = cls._partition_query(full_table_name, database)
col_names, latest_parts = cls.latest_partition(
table_name, schema_name, database, show_first=True
)
if not latest_parts:
latest_parts = tuple([None] * len(col_names))
+
metadata["partitions"] = {
- "cols": cols,
+ "cols": sorted(indexes[0].get("column_names", [])),
Review Comment:
This is the same logic as before, though now it's inlined. The `sorted(...)`
is to aid with testing.
##########
superset/db_engine_specs/trino.py:
##########
@@ -83,11 +83,34 @@ def extra_table_metadata(
indexes = database.get_indexes(table_name, schema_name)
if indexes:
- partitions_columns = []
- for index in indexes:
- if index.get("name") == "partition":
- partitions_columns += index.get("column_names", [])
- metadata["partitions"] = {"cols": partitions_columns}
+ col_names, latest_parts = cls.latest_partition(
+ table_name, schema_name, database, show_first=True
+ )
+
+ if not latest_parts:
+ latest_parts = tuple([None] * len(col_names))
+
+ metadata["partitions"] = {
+ "cols": sorted(
Review Comment:
Very similar logic to before except the list is deduped and then sorted to
aid with testing.
##########
superset/db_engine_specs/presto.py:
##########
@@ -311,6 +311,203 @@ def get_function_names(cls, database: Database) ->
List[str]:
"""
return database.get_df("SHOW FUNCTIONS")["Function"].tolist()
+ @classmethod
Review Comment:
This entire block was simply moved from `PrestoEngineSpec` to
`PrestoBaseEngineSpec`.
--
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]