lava-oushudb-dt-sql-parser/test/parser/hive/contextCollect/fixtures/common.sql
Hayden a99721162b
feat: collect entity (#265)
* feat: add text and word utils

* feat: add entity collector class

* refactor: rename SyntaxContextType to EntityContextType

* refactor: improve EntityCollector

* feat: improve mysql parser grammar

* feat: add mysql entity collector

* test: mysql entity collector tests

* feat: remove useless method

* feat: improve spark grammar file

* feat: add spark entity collector

* test: spark entity collector unit tests

* feat: remove useless code

* feat: add queryStatement label

* feat: add crateDatabaseStmt

* feat: add trino entity collector

* feat: rename trinosql to trino

* test: trino collect entity unit tests

* test: fix spark test

* feat(impala): support impale entity collector (#256)

* Feat/collect entity hive (#263)

* feat(hive): support hive collect entity

* feat(hive): update tableAllColumns

* feat: replace antlr4ts with antlr4ng

* feat(pgsql): pgsql collect entity (#268)

* feat(pgsql): pgsql collect entity

* feat(pgsql): optimize some name

---------

Co-authored-by: zhaoge <>

* feat: get word text by token.text

* feat: supprt collect db/function and add splitListener (#270)

* feat: supprt collect db/function and add splitListner

* feat: remove SplitListener interface in baseParser to use SplitListener in root

* fix(mysql): fix show create xxx not celloct as createXXXEntity type

* test: fix pgsql unit tests

* Feat/error recover predicate (#274)

* feat: optimize pgsql grammar

* feat: add sql parser base

* feat: apply SQLParserBase

* feat: add geAllEntities method

* test: test collect table when missing column

* feat: compose collect and suggestion (#276)

* feat: mark stmt which contain caret

* test: correct name of getAllEntities

* test: remove misscolumn unit tests

* test: add suggestionWithEntity tests

* feat: flink collect entity (#277)

* feat: improve flink sql parser

* feat: support flink entity collector

* test: flink entity collect unit test

* feat: move combine entities to parent class

---------

Co-authored-by: 霜序 <976060700@qq.com>
Co-authored-by: XCynthia <942884029@qq.com>
2024-03-26 14:28:27 +08:00

60 lines
1.6 KiB
SQL

CREATE TEMPORARY TABLE IF NOT EXISTS copy_table LIKE origin_table;
CREATE TEMPORARY EXTERNAL TABLE IF NOT EXISTS list_bucket_multiple (col1 STRING, col2 INT, col3 STRING) COMMENT 'this is a comment';
CREATE TABLE IF NOT EXISTS derived_table AS
SELECT
*
FROM
origin_table;
CREATE VIEW mydb.bro_view
AS SELECT * FROM mydb.sale_tbl;
CREATE VIEW mydb.task_view (
taskId COMMENT '任务id',
taskName COMMENT '任务名称',
taskRunTime COMMENT '任务运行时长'
)
COMMENT '一个任务信息视图'
TBLPROPERTIES(
'author'='hayden'
)
AS SELECT DISTINCT id, `name`, runtime
FROM task_tbl
WHERE type='day';
CREATE MATERIALIZED VIEW IF NOT EXISTS mydb.bro_view
DISABLE REWRITE
COMMENT '一个测试视图'
AS SELECT * FROM mydb.sale_tbl;
SELECT col1, col2 FROM table_name_1;
SELECT a.* FROM a JOIN b ON (a.id = b.id AND a.department = b.department);
FROM table_name_1 SELECT col1, col2;
FROM a JOIN b ON (a.id = b.id AND a.department = b.department) SELECT a.*;
INSERT INTO TABLE students(a,b,c)
VALUES ('fred flintstone', 35, 1.28), ('barney rubble', 32, 2.32);
INSERT INTO table_name PARTITION (country, state)
SELECT col1, col2,
CONCAT(country, '_', state) AS country_state
FROM source_table;
FROM page_view_stg pvs
INSERT OVERWRITE TABLE page_view PARTITION(dt='2008-06-08', country)
SELECT pvs.viewTime, pvs.userid, pvs.page_url, pvs.referrer_url, null, null, pvs.ip, pvs.cnt;
CREATE DATABASE mydb;
CREATE REMOTE DATABASE mydb;
SHOW LOCKS DATABASE db1;
CREATE FUNCTION base_analizer AS 'com.udf.BaseFieldUDF';
CREATE TEMPORARY FUNCTION flat_analizer AS 'com.udtf.EventJsonUDTF';