fix: #295 #297 optimize impala data types suggestion and create table (#296)

* fix: #295 impala data types suggestion

* fix: #297 impala create table with STRUCT
This commit is contained in:
琉易
2024-04-21 12:10:36 +08:00
committed by GitHub
parent fa30fe9253
commit 31b57a494b
13 changed files with 5738 additions and 5248 deletions

View File

@ -7,3 +7,5 @@ DROP ;
INSERT ;
SHOW ;
CREATE TABLE t1 (id );

View File

@ -109,4 +109,38 @@ describe('Impala SQL Token Suggestion', () => {
'CURRENT',
]);
});
test('Create table with column dataType', () => {
const pos: CaretPosition = {
lineNumber: 11,
column: 21,
};
const suggestion = impala.getSuggestionAtCaretPosition(
commentOtherLine(tokenSql, pos.lineNumber),
pos
)?.keywords;
const dataTypes = [
'INT',
'BINARY',
'BIGINT',
'BOOLEAN',
'CHAR',
'DATE',
'DECIMAL',
'DOUBLE',
'INT',
'MAP',
'REAL',
'SMALLINT',
'FLOAT',
'STRING',
'STRUCT',
'TIMESTAMP',
'TINYINT',
'VARCHAR',
'COMPLEX',
];
expect(dataTypes.every((dataType) => suggestion.includes(dataType))).toBe(true);
});
});

View File

@ -183,3 +183,32 @@ CREATE TABLE fk(id INT, col1 INT, col2 STRING, PRIMARY KEY(id),
CREATE TABLE new_Table like old_table;
CREATE TABLE new_Table like old_table partitioned by (year int) SORT BY (last_name, state);
CREATE TABLE IF NOT EXISTS t1 (id INT);
CREATE TABLE IF NOT EXISTS t1 (
id1 INT,
id2 BINARY,
id3 BIGINT,
id4 BOOLEAN,
id5 CHAR(4),
id6 DATE,
id7 DECIMAL(38, 0),
id8 DOUBLE,
id9 INT,
id10 MAP<INT, DOUBLE>,
id11 REAL,
id12 SMALLINT,
id13 FLOAT,
id14 STRING,
id15 STRUCT,
id16 TIMESTAMP,
id17 TINYINT,
id18 VARCHAR(256),
id19 COMPLEX,
id19 ARRAY<INT>
);
CREATE TABLE IF NOT EXISTS t1 (
id INT,
person STRUCT<first_name: STRING, last_name: VARCHAR(256)>
) PARTITIONED BY (student STRUCT<id: INT, name: VARCHAR(256), height: STRING, cost: DECIMAL(38, 0)>);