feat: update alter and drop statements (#94)

* feat: add UNIQUE keyword

* feat: support ifExist, addConstraint, dropConstraint and addUnique of alter table statement

* feat: support ifExist, addConstraint, dropConstraint and addUnique of alter table statement

* tests: add tests of alter statements

* docs: add comments for sql syntax

* build: optimize promote of build/antlr4

* ci: add max_old_space_size

* ci: add max_old_space_size

* ci: update tests script
This commit is contained in:
Ziv
2023-05-17 10:00:35 +08:00
committed by GitHub
parent 10645087de
commit fbee70cde5
15 changed files with 4341 additions and 3802 deletions

View File

@ -1 +1,3 @@
ALTER DATABASE tempDB SET ("key1"="value1");
ALTER DATABASE tempDB SET ("key1"="value1");
alter database db1 set ('key1' = 'value1','key2.a' = 'value2.a');

View File

@ -1,7 +1,15 @@
ALTER FUNCTION tempFunction AS 'SimpleUdf';
ALTER TEMPORARY FUNCTION IF EXISTS tempFunction AS 'SimpleUdf';
alter temporary function function1 as 'org.apache.flink.function.function1';
alter temporary function function1 as 'org.apache.flink.function.function1' language scala;
alter temporary system function function1 as 'org.apache.flink.function.function1';
alter temporary system function function1 as 'org.apache.flink.function.function1' language java;
ALTER TEMPORARY SYSTEM FUNCTION IF EXISTS tempFunction AS 'SimpleUdf';
ALTER TEMPORARY FUNCTION IF EXISTS tempFunction AS 'SimpleUdf';
ALTER FUNCTION myudf AS 'com.example.MyUdf' LANGUAGE PYTHON;

View File

@ -1,7 +1,65 @@
ALTER TABLE
Orders RENAME TO NewOrders;
-- Refer: https://github.com/apache/flink/blob/master/flink-table/flink-sql-parser/src/test/java/org/apache/flink/sql/parser/FlinkSqlParserImplTest.java#L2016
-- Just for simple alter table statements, it not include alter table columns statements
alter table
t1 rename to t2;
alter table
if exists t1 rename to t2;
alter table
c1.d1.t1 rename to t2;
alter table
if exists c1.d1.t1 rename to t2;
alter table
t1 rename a to b;
alter table
if exists t1 rename a to b;
alter table
if exists t1 rename a.x to a.y;
alter table
t1
set
('key1' = 'value1');
alter table
if exists t1
set
('key1' = 'value1');
alter table
t1
add
constraint ct1 primary key(a, b);
alter table
t1
add
constraint ct1 primary key(a, b) not enforced;
alter table
if exists t1
add
constraint ct1 primary key(a, b) not enforced;
alter table
t1
add
unique(a, b);
alter table
if exists t1
add
unique(a, b);
alter table
t1 drop constraint ct1;
alter table
if exists t1 drop constraint ct1;
ALTER TABLE
sample_table
SET
('key1' = 'value2');