DROP STREAMING TABLE
描述
DROP STREAMING TABLE
语句用于删除一个指定的流表的元数据。
语法
DROP STREAMING TABLE [ IF EXISTS ] streaming_table_identifier
Parameter
IF EXISTS
如果指定,当流表不存在时不会出现异常。
streaming_table_identifier
指定要删除的流表名称。流表名称可以用数据库名称限定。
语法:
[ data_base_name. ] view_name
。
示例
-- 假设存在一个流表 `employeeStreaming`。
DROP STREAMING TABLE employeeStreaming;
-- 假设在数据库 `userdb` 中存在一个流表 `employeeStreaming`。
DROP STREAMING TABLE userdb.employeeStreaming;
-- 假设不存在流表 `employeeStreaming`。
-- 抛出异常
DROP STREAMING TABLE employeeStreaming;
Error happens in sql: DROP STREAMING TABLE employeeStreaming
org.apache.spark.sql.catalyst.analysis.NoSuchTableException: [TABLE_OR_VIEW_NOT_FOUND] The table or view `spark_catalog`.`default`.`employeeStreaming` cannot be found.
-- 假设不存在流表 `employeeStreaming`,并使用 IF EXISTS。
-- 此时不会抛出异常
DROP STREAMING TABLE IF EXISTS employeeStreaming;