Timo Theusner created FLINK-41528:
-------------------------------------
Summary: Make DROP MATERIALIZED TABLE IF EXISTS skip a table or
view at the path
Key: FLINK-41528
URL: https://issues.apache.org/jira/browse/FLINK-41528
Project: Flink
Issue Type: Improvement
Components: Table SQL / Planner
Reporter: Timo Theusner
{{DROP MATERIALIZED TABLE IF EXISTS t}} fails with "Table 't' is not a
materialized table, ..." when {{t}} is a regular table or view.
{{DefaultMaterializedTableExecutor#callDropMaterializedTableOperation}} checks
{{Catalog#tableExists}}, which is true for any kind of object, and
{{getCatalogMaterializedTable}} then rejects the kind. The statement should
treat an object of the wrong kind as absent and do nothing, as {{DROP TABLE IF
EXISTS}}, {{DROP VIEW IF EXISTS}} and
{{TableEnvironment#dropMaterializedTable}} (FLINK-41215) do.
Proposed Changes
* Replace the {{Catalog#tableExists}} check in
{{callDropMaterializedTableOperation}} with
{{CatalogManager#getUnresolvedTable}}, and return OK under {{IF EXISTS}} when
no object or a non-materialized object is found
* Leave {{getCatalogMaterializedTable}} on {{getTableOrError}}, so a temporary
table or view that shadows a materialized table still fails instead of being
skipped
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)