Open chadheyne opened 5 years ago
From a SQL perspective, these operations should have different behavior for an invalid table:
information_schema.columns
should skip any invalid tables.SHOW COLUMNS
should fail with error, similar to querying from the table.The problem is that the latter is implemented as a rewrite against the former. This happens in ShowQueriesRewrite.Visitor#visitShowColumns
. The columns
table in turn calls ConnectorMetadata#listTableColumns
.
This is how to fix it:
visitShowColumns
to get the table handle and then ask for metadata about the handle. It will need to call AccessControl#filterColumns
which is currently done in MetadataListing#listTableColumns
.ConnectorMetadata#listTableColumns
to skip invalid tables. This has to be done at the connector level since that method returns all the columns at once.One question is if we should also call AccessControl#filterTables
. This happens today, but it seems to be more of a side effect of the implementation. The documentation for AccessControl#checkCanShowColumnsMetadata
only mentions AccessControl#filterColumns
.
I believe this is similar to https://github.com/prestodb/presto/pull/11847 and https://github.com/prestosql/presto/pull/568.
When I am running
The whole query fails with
This happens when the partition key is named the same as a column in the table.
This is the first ticket I've opened here so please let me know if I missed anything or if y'all need any more details.