-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: hive complete data types' check and unit tests (#160)
* feat: add Authorization SQL and update syntax file * test: hive complete data types' check and unit tests * feat: hive add syntax complete automaticlly * feat: update hive's syntax complete feat:update hive's syntax complete --------- Co-authored-by: zhaoge <>
- Loading branch information
Showing
7 changed files
with
162 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import HiveSQL from '../../../../src/parser/hive'; | ||
import { readSQL } from '../../../helper'; | ||
|
||
const parser = new HiveSQL(); | ||
|
||
const features = { | ||
dataTypes: readSQL(__dirname, 'dataTypes.sql'), | ||
}; | ||
|
||
describe('HiveSQL Check Data Types Tests', () => { | ||
features.dataTypes.forEach((dataType) => { | ||
it(dataType, () => { | ||
expect(parser.validate(dataType).length).toBe(0); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
-- TINYINT | ||
-- | SMALLINT | ||
-- | INT | ||
-- | BIGINT | ||
-- | BOOLEAN | ||
-- | FLOAT | ||
-- | DOUBLE | ||
-- | DOUBLE PRECISION -- (Note: Available in Hive 2.2.0 and later) | ||
-- | STRING | ||
-- | BINARY -- (Note: Available in Hive 0.8.0 and later) | ||
-- | TIMESTAMP -- (Note: Available in Hive 0.8.0 and later) | ||
-- | DECIMAL -- (Note: Available in Hive 0.11.0 and later) | ||
-- | DECIMAL(precision, scale) -- (Note: Available in Hive 0.13.0 and later) | ||
-- | DATE -- (Note: Available in Hive 0.12.0 and later) | ||
-- | VARCHAR -- (Note: Available in Hive 0.12.0 and later) | ||
-- | CHAR -- (Note: Available in Hive 0.13.0 and later) | ||
-- | ARRAY<data_type> (Note: negative values and non-constant expressions are allowed as of Hive 0.14.) | ||
-- | MAP<primitive_type, data_type> (Note: negative values and non-constant expressions are allowed as of Hive 0.14.) | ||
-- | STRUCT<col_name : data_type [COMMENT col_comment], ...> | ||
-- | UNIONTYPE<data_type, data_type, ...> (Note: Only available starting with Hive 0.7.0.) | ||
CREATE TABLE test_table ( | ||
viewTime INT, | ||
userid BIGINT, | ||
page_url STRING, | ||
age TINYINT, | ||
instance FLOAT, | ||
isAduit BOOLEAN, | ||
score DOUBLE, | ||
aver DOUBLE PRECISION, | ||
somename BINARY, | ||
someid DECIMAL, | ||
birth TIMESTAMP, | ||
schooldt DATE, | ||
someint SMALLINT, | ||
colvarchar VARCHAR(1), | ||
colchar CHAR(2), | ||
coldecil DECIMAL(3,4), | ||
list ARRAY <STRING>, | ||
realmap MAP <STRING, DATE>, | ||
realstruct STRUCT<col_name: STRING>, | ||
collast UNIONTYPE <DOUBLE, STRING> | ||
); | ||
|
||
-- INTERVAL | ||
UPDATE tablenames SET birthdt=INTERVAL '1-2' YEAR TO MONTH; |