Starting from 1.11.0, Flink allows users to write SQL statements in Hive syntax when Hive dialect is used. By providing compatibility with Hive syntax, we aim to improve the interoperability with Hive and reduce the scenarios when users need to switch between Flink and Hive in order to execute different statements. For details, see Apache Flink Hive Dialect.
Flink currently supports two SQL dialects: default and hive. You need to switch to Hive dialect before you can write in Hive syntax. The following describes how to set dialect with SQL Client.
Also notice that you can dynamically switch dialect for each statement you execute. There's no need to restart a session to use a different dialect.
SQL dialect can be specified via the table.sql-dialect property.
1 | set table.sql-dialect=hive; |
While all Hive versions support the same syntax, whether a specific feature is available still depends on the Hive version you use.
For example, updating database location is only supported in Hive-2.4.0 or later.