This is an automated email from the ASF dual-hosted git repository. jingzhang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push: new 36660cce32e [FLINK-26681][hive] Support sql end with ";" for Hive dialect 36660cce32e is described below commit 36660cce32e7dbacf9b2408c6d65d8fc9c7c2c93 Author: luoyuxia <luoyu...@alibaba-inc.com> AuthorDate: Wed Mar 16 11:48:01 2022 +0800 [FLINK-26681][hive] Support sql end with ";" for Hive dialect This closes #19105 --- .../planner/delegation/hive/parse/HiveASTParser.g | 4 ++-- .../flink-sql-client/src/test/resources/sql/set.q | 28 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/parse/HiveASTParser.g b/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/parse/HiveASTParser.g index a9fedc6b504..367d4b21cca 100644 --- a/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/parse/HiveASTParser.g +++ b/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/parse/HiveASTParser.g @@ -732,8 +732,8 @@ catch (RecognitionException e) { // starting rule statement - : explainStatement EOF - | execStatement EOF + : explainStatement SEMICOLON? EOF + | execStatement SEMICOLON? EOF ; explainStatement diff --git a/flink-table/flink-sql-client/src/test/resources/sql/set.q b/flink-table/flink-sql-client/src/test/resources/sql/set.q index 5d214ef1759..5768953d401 100644 --- a/flink-table/flink-sql-client/src/test/resources/sql/set.q +++ b/flink-table/flink-sql-client/src/test/resources/sql/set.q @@ -16,10 +16,25 @@ # limitations under the License. # test set a configuration +SET 'sql-client.execution.result-mode' = 'tableau'; +[INFO] Session property has been set. +!info + SET 'table.sql-dialect' = 'hive'; [INFO] Session property has been set. !info +create catalog hivecatalog with ( + 'type' = 'hive-test', + 'hive-version' = '2.3.4' +); +[INFO] Execute statement succeed. +!info + +use catalog hivecatalog; +[INFO] Execute statement succeed. +!info + # test create a hive table to verify the configuration works CREATE TABLE hive_table ( product_id STRING, @@ -28,7 +43,7 @@ CREATE TABLE hive_table ( pv_count BIGINT, like_count BIGINT, comment_count BIGINT, - update_time TIMESTAMP(3), + update_time TIMESTAMP, update_user STRING ) PARTITIONED BY (pt_year STRING, pt_month STRING, pt_day STRING) TBLPROPERTIES ( 'streaming-source.enable' = 'true' @@ -36,6 +51,16 @@ CREATE TABLE hive_table ( [INFO] Execute statement succeed. !info +# test "ctas" only supported in Hive Dialect +CREATE TABLE foo as select 1; ++-------------------------+ +| hivecatalog.default.foo | ++-------------------------+ +| -1 | ++-------------------------+ +1 row in set +!ok + # list the configured configuration set; 'execution.attached' = 'true' @@ -47,6 +72,7 @@ set; 'pipeline.classpaths' = '' 'pipeline.jars' = '' 'rest.port' = '$VAR_REST_PORT' +'sql-client.execution.result-mode' = 'tableau' 'table.exec.legacy-cast-behaviour' = 'DISABLED' 'table.sql-dialect' = 'hive' !ok