From 6cf6a95cc976a5a67baf526a18b2270cc879e77d Mon Sep 17 00:00:00 2001 From: taozhi8833998 Date: Fri, 29 Nov 2024 08:52:31 +0800 Subject: [PATCH] fix: support real type in athena --- pegjs/athena.pegjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pegjs/athena.pegjs b/pegjs/athena.pegjs index 08f6efa7..a5a3f68e 100644 --- a/pegjs/athena.pegjs +++ b/pegjs/athena.pegjs @@ -2469,6 +2469,7 @@ KW_MEDIUMTEXT = "MEDIUMTEXT"i !ident_start { return 'MEDIUMTEXT'; } KW_LONGTEXT = "LONGTEXT"i !ident_start { return 'LONGTEXT'; } KW_BIGINT = "BIGINT"i !ident_start { return 'BIGINT'; } KW_FLOAT = "FLOAT"i !ident_start { return 'FLOAT'; } +KW_REAL = "REAL"i !ident_start { return 'REAL'; } KW_DOUBLE = "DOUBLE"i !ident_start { return 'DOUBLE'; } KW_DATE = "DATE"i !ident_start { return 'DATE'; } KW_DATETIME = "DATETIME"i !ident_start { return 'DATETIME'; } @@ -2802,9 +2803,9 @@ numeric_type_suffix return result } numeric_type - = t:(KW_NUMERIC / KW_DECIMAL / KW_INT / KW_INTEGER / KW_SMALLINT / KW_TINYINT / KW_BIGINT / KW_FLOAT / KW_DOUBLE) __ LPAREN __ l:[0-9]+ __ r:(COMMA __ [0-9]+)? __ RPAREN __ s:numeric_type_suffix? { return { dataType: t, length: parseInt(l.join(''), 10), scale: r && parseInt(r[2].join(''), 10), parentheses: true, suffix: s }; } - / t:(KW_NUMERIC / KW_DECIMAL / KW_INT / KW_INTEGER / KW_SMALLINT / KW_TINYINT / KW_BIGINT / KW_FLOAT / KW_DOUBLE)l:[0-9]+ __ s:numeric_type_suffix? { return { dataType: t, length: parseInt(l.join(''), 10), suffix: s }; } - / t:(KW_NUMERIC / KW_DECIMAL / KW_INT / KW_INTEGER / KW_SMALLINT / KW_TINYINT / KW_BIGINT / KW_FLOAT / KW_DOUBLE) __ s:numeric_type_suffix? __{ return { dataType: t, suffix: s }; } + = t:(KW_NUMERIC / KW_DECIMAL / KW_INT / KW_INTEGER / KW_SMALLINT / KW_TINYINT / KW_BIGINT / KW_FLOAT / KW_DOUBLE / KW_REAL) __ LPAREN __ l:[0-9]+ __ r:(COMMA __ [0-9]+)? __ RPAREN __ s:numeric_type_suffix? { return { dataType: t, length: parseInt(l.join(''), 10), scale: r && parseInt(r[2].join(''), 10), parentheses: true, suffix: s }; } + / t:(KW_NUMERIC / KW_DECIMAL / KW_INT / KW_INTEGER / KW_SMALLINT / KW_TINYINT / KW_BIGINT / KW_FLOAT / KW_DOUBLE / KW_REAL)l:[0-9]+ __ s:numeric_type_suffix? { return { dataType: t, length: parseInt(l.join(''), 10), suffix: s }; } + / t:(KW_NUMERIC / KW_DECIMAL / KW_INT / KW_INTEGER / KW_SMALLINT / KW_TINYINT / KW_BIGINT / KW_FLOAT / KW_DOUBLE / KW_REAL) __ s:numeric_type_suffix? __{ return { dataType: t, suffix: s }; } datetime_type = t:(KW_DATE / KW_DATETIME / KW_TIME / KW_TIMESTAMP) __ LPAREN __ l:[0-9]+ __ RPAREN { return { dataType: t, length: parseInt(l.join(''), 10), parentheses: true }; } / t:(KW_DATE / KW_DATETIME / KW_TIME / KW_TIMESTAMP) { return { dataType: t }; }