2019-06-21 00:14:54 -04:00
|
|
|
/*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
|
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Hand picked from https://druid.apache.org/docs/latest/querying/sql.html
|
|
|
|
|
2024-10-21 14:38:19 -04:00
|
|
|
export const SQL_KEYWORDS = [
|
2019-06-21 00:14:54 -04:00
|
|
|
'EXPLAIN PLAN FOR',
|
|
|
|
'WITH',
|
|
|
|
'AS',
|
|
|
|
'SELECT',
|
|
|
|
'ALL',
|
|
|
|
'DISTINCT',
|
|
|
|
'FROM',
|
|
|
|
'WHERE',
|
|
|
|
'GROUP BY',
|
2020-07-24 01:45:01 -04:00
|
|
|
'CUBE',
|
|
|
|
'ROLLUP',
|
|
|
|
'GROUPING SETS',
|
2019-06-21 00:14:54 -04:00
|
|
|
'HAVING',
|
|
|
|
'ORDER BY',
|
|
|
|
'ASC',
|
|
|
|
'DESC',
|
|
|
|
'LIMIT',
|
2020-10-30 22:02:44 -04:00
|
|
|
'OFFSET',
|
2019-06-21 19:52:33 -04:00
|
|
|
'UNION ALL',
|
2020-04-16 20:51:59 -04:00
|
|
|
'JOIN',
|
|
|
|
'LEFT',
|
|
|
|
'INNER',
|
|
|
|
'ON',
|
|
|
|
'RIGHT',
|
|
|
|
'OUTER',
|
2020-06-30 15:46:50 -04:00
|
|
|
'FULL',
|
2021-04-19 17:36:53 -04:00
|
|
|
'CROSS',
|
2021-06-04 12:29:00 -04:00
|
|
|
'USING',
|
2024-06-21 21:33:15 -04:00
|
|
|
'NATURAL',
|
2021-06-04 12:29:00 -04:00
|
|
|
'FETCH',
|
|
|
|
'FIRST',
|
|
|
|
'NEXT',
|
|
|
|
'ROW',
|
|
|
|
'ROWS',
|
|
|
|
'ONLY',
|
2021-12-07 13:16:16 -05:00
|
|
|
'VALUES',
|
2022-08-24 19:17:12 -04:00
|
|
|
'PARTITIONED BY',
|
|
|
|
'CLUSTERED BY',
|
|
|
|
'TIME',
|
|
|
|
'INSERT INTO',
|
|
|
|
'REPLACE INTO',
|
|
|
|
'OVERWRITE',
|
2022-08-25 11:18:21 -04:00
|
|
|
'RETURNING',
|
2022-12-07 00:21:49 -05:00
|
|
|
'OVER',
|
|
|
|
'PARTITION BY',
|
|
|
|
'WINDOW',
|
2023-01-26 00:23:18 -05:00
|
|
|
'RANGE',
|
|
|
|
'PRECEDING',
|
|
|
|
'FOLLOWING',
|
2024-06-21 21:33:15 -04:00
|
|
|
'CURRENT',
|
|
|
|
'UNBOUNDED',
|
2023-01-26 00:23:18 -05:00
|
|
|
'EXTEND',
|
2024-02-07 09:14:25 -05:00
|
|
|
'PIVOT',
|
|
|
|
'UNPIVOT',
|
2019-06-21 00:14:54 -04:00
|
|
|
];
|
|
|
|
|
2024-10-21 14:38:19 -04:00
|
|
|
export const SQL_EXPRESSION_PARTS = [
|
2019-06-21 00:14:54 -04:00
|
|
|
'FILTER',
|
|
|
|
'END',
|
|
|
|
'ELSE',
|
|
|
|
'WHEN',
|
2020-07-24 01:45:01 -04:00
|
|
|
'THEN',
|
2019-06-21 00:14:54 -04:00
|
|
|
'CASE',
|
|
|
|
'OR',
|
|
|
|
'AND',
|
|
|
|
'NOT',
|
|
|
|
'IN',
|
2020-09-11 22:42:50 -04:00
|
|
|
'ANY',
|
|
|
|
'SOME',
|
2019-06-21 00:14:54 -04:00
|
|
|
'IS',
|
|
|
|
'TO',
|
|
|
|
'BETWEEN',
|
2020-07-24 01:45:01 -04:00
|
|
|
'SYMMETRIC',
|
2019-06-21 00:14:54 -04:00
|
|
|
'LIKE',
|
2020-07-24 01:45:01 -04:00
|
|
|
'SIMILAR',
|
2019-06-21 00:14:54 -04:00
|
|
|
'ESCAPE',
|
|
|
|
'BOTH',
|
|
|
|
'LEADING',
|
|
|
|
'TRAILING',
|
|
|
|
'EPOCH',
|
|
|
|
'SECOND',
|
|
|
|
'MINUTE',
|
|
|
|
'HOUR',
|
|
|
|
'DAY',
|
|
|
|
'DOW',
|
|
|
|
'DOY',
|
|
|
|
'WEEK',
|
|
|
|
'MONTH',
|
|
|
|
'QUARTER',
|
|
|
|
'YEAR',
|
|
|
|
'TIMESTAMP',
|
2019-06-21 19:52:33 -04:00
|
|
|
'INTERVAL',
|
2024-02-26 14:28:25 -05:00
|
|
|
'CSV',
|
2019-06-21 00:14:54 -04:00
|
|
|
];
|
|
|
|
|
2024-10-21 14:38:19 -04:00
|
|
|
export const SQL_CONSTANTS = ['NULL', 'FALSE', 'TRUE'];
|
2019-06-21 00:14:54 -04:00
|
|
|
|
2024-10-21 14:38:19 -04:00
|
|
|
export const SQL_DYNAMICS = [
|
2019-09-03 15:13:57 -04:00
|
|
|
'CURRENT_TIMESTAMP',
|
|
|
|
'CURRENT_DATE',
|
|
|
|
'LOCALTIME',
|
|
|
|
'LOCALTIMESTAMP',
|
|
|
|
'CURRENT_TIME',
|
|
|
|
];
|