Delta Lake MERGE INTO 声明

Delta Lake MERGE INTO statement

我正在尝试 运行 三角洲湖 MERGE INTO

MERGE INTO sessions
USING updates
ON sessions.sessionId = updates.sessionId
WHEN MATCHED THEN UPDATE *
WHEN NOT MATCHED THEN INSERT *

我收到 SQL 错误

ParseException: mismatched input 'MERGE' expecting {'(', 'SELECT', 'FROM', 'ADD', 'DESC', 'WITH', 'VALUES', 'CREATE', 'TABLE', 'INSERT', 'DELETE', 'DESCRIBE', 'EXPLAIN', 'SHOW', 'USE', 'DROP', 'ALTER', 'MAP', 'SET', 'RESET', 'START', 'COMMIT', 'ROLLBACK', 'REDUCE', 'REFRESH', 'CLEAR', 'CACHE', 'UNCACHE', 'DFS', 'TRUNCATE', 'ANALYZE', 'LIST', 'REVOKE', 'GRANT', 'LOCK', 'UNLOCK', 'MSCK', 'EXPORT', 'IMPORT', 'LOAD'}(line 2, pos 0)
== SQL ==
MERGE INTO sessions
^^^
USING updates
ON sessions.sessionId = updates.sessionId
WHEN MATCHED THEN UPDATE *
WHEN NOT MATCHED THEN INSERT *
"

我正在使用 io.delta:delta-core_2.11:0.6.1 我做错了什么?

谢谢

在 Delta Lake 文档的 Delta Lake 0.7.0. You also need to upgrade your Apache Spark to 3.0.0 and enable the integration with Apache Spark DataSourceV2 and Catalog APIs in order to use the new SQL support in Delta Lake 0.7.0. Please check instructions 中添加了 merge SQL 支持。