[ https://issues.apache.org/jira/browse/HIVE-24223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kriti Jha updated HIVE-24223:
-----------------------------
Description:
Any insert operation to a table in Hive with decimal integers without a digit before the
DOT ('.') fails with an exception as shown below:
------------------------------------------------------------------
hive> create table test_dec(id decimal(10,8));
hive> insert into test_dec values (-.5);
NoViableAltException(16@[412:1: atomExpression : ( constant | ( intervalExpression )=>
intervalExpression | castExpression | extractExpression | floorExpression | caseExpression
| whenExpression | ( subQueryExpression )=> ( subQueryExpression ) -> ^( TOK_SUBQUERY_EXPR
TOK_SUBQUERY_OP subQueryExpression ) | ( functionName LPAREN )=> function | tableOrColumn
| expressionsInParenthesis[true] );])NoViableAltException(16@[412:1: atomExpression : ( constant
| ( intervalExpression )=> intervalExpression | castExpression | extractExpression | floorExpression
| caseExpression | whenExpression | ( subQueryExpression )=> ( subQueryExpression ) ->
^( TOK_SUBQUERY_EXPR TOK_SUBQUERY_OP subQueryExpression ) | ( functionName LPAREN )=> function
| tableOrColumn | expressionsInParenthesis[true] );]) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser$DFA36.specialStateTransition(HiveParser_IdentifiersParser.java:31810)
at org.antlr.runtime.DFA.predict(DFA.java:80) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.atomExpression(HiveParser_IdentifiersParser.java:6746)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceFieldExpression(HiveParser_IdentifiersParser.java:6988)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnaryPrefixExpression(HiveParser_IdentifiersParser.java:7324)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnarySuffixExpression(HiveParser_IdentifiersParser.java:7380)
at
...
org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expression(HiveParser_IdentifiersParser.java:6686)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expressionsNotInParenthesis(HiveParser_IdentifiersParser.java:2287)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expressionsInParenthesis(HiveParser_IdentifiersParser.java:2233)
at org.apache.hadoop.hive.ql.parse.HiveParser.expressionsInParenthesis(HiveParser.java:42106)
at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.valueRowConstructor(HiveParser_FromClauseParser.java:6499)
at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.valuesTableConstructor(HiveParser_FromClauseParser.java:6583)
at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.valuesClause(HiveParser_FromClauseParser.java:6704)
at org.apache.hadoop.hive.ql.parse.HiveParser.valuesClause(HiveParser.java:41954) at org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:36536)
at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:35822)
at
...
org.apache.hadoop.util.RunJar.main(RunJar.java:153)FAILED: ParseException line 1:30 cannot
recognize input near '.' '5' ')' in expression specification
------------------------------------------------------------------
It seems to be coming from the Lexer where the types are defined and the definition of 'Number'
should be coming into play:
----------------------
Number : (Digit)+ ( DOT (Digit)* (Exponent)? | Exponent)? ;
----------------------
>[https://github.com/apache/hive/blob/2006e52713508a92fb4d1d28262fd7175eade8b7/parser/src/java/org/apache/hadoop/hive/ql/parse/HiveLexerParent.g#L469]
However, the below works:
> insert into test_dec values ('-.5');
> insert into test_dec values (-0.5);
was:
Any insert operation to a table in Hive with decimal integers without a digit before the
DOT ('.') fails with an exception as shown below:
------------------------------------------------------------------
hive> create table test_dec(id decimal(10,8));
hive> insert into test_dec values (-.5);
NoViableAltException(16@[412:1: atomExpression : ( constant | ( intervalExpression )=>
intervalExpression | castExpression | extractExpression | floorExpression | caseExpression
| whenExpression | ( subQueryExpression )=> ( subQueryExpression ) -> ^( TOK_SUBQUERY_EXPR
TOK_SUBQUERY_OP subQueryExpression ) | ( functionName LPAREN )=> function | tableOrColumn
| expressionsInParenthesis[true] );])NoViableAltException(16@[412:1: atomExpression : ( constant
| ( intervalExpression )=> intervalExpression | castExpression | extractExpression | floorExpression
| caseExpression | whenExpression | ( subQueryExpression )=> ( subQueryExpression ) ->
^( TOK_SUBQUERY_EXPR TOK_SUBQUERY_OP subQueryExpression ) | ( functionName LPAREN )=> function
| tableOrColumn | expressionsInParenthesis[true] );]) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser$DFA36.specialStateTransition(HiveParser_IdentifiersParser.java:31810)
at org.antlr.runtime.DFA.predict(DFA.java:80) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.atomExpression(HiveParser_IdentifiersParser.java:6746)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceFieldExpression(HiveParser_IdentifiersParser.java:6988)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnaryPrefixExpression(HiveParser_IdentifiersParser.java:7324)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnarySuffixExpression(HiveParser_IdentifiersParser.java:7380)
at
...
org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expression(HiveParser_IdentifiersParser.java:6686)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expressionsNotInParenthesis(HiveParser_IdentifiersParser.java:2287)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expressionsInParenthesis(HiveParser_IdentifiersParser.java:2233)
at org.apache.hadoop.hive.ql.parse.HiveParser.expressionsInParenthesis(HiveParser.java:42106)
at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.valueRowConstructor(HiveParser_FromClauseParser.java:6499)
at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.valuesTableConstructor(HiveParser_FromClauseParser.java:6583)
at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.valuesClause(HiveParser_FromClauseParser.java:6704)
at org.apache.hadoop.hive.ql.parse.HiveParser.valuesClause(HiveParser.java:41954) at org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:36536)
at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:35822)
at
...
org.apache.hadoop.util.RunJar.main(RunJar.java:153)FAILED: ParseException line 1:30 cannot
recognize input near '.' '5' ')' in expression specification
------------------------------------------------------------------
It seems to be coming from the Lexer where the types are defined and the definition of 'Number'
should be coming into play:
----------------------
Number : (Digit)+ ( DOT (Digit)* (Exponent)? | Exponent)? ;
----------------------
>[https://github.com/apache/hive/blob/2006e52713508a92fb4d1d28262fd7175eade8b7/parser/src/java/org/apache/hadoop/hive/ql/parse/HiveLexerParent.g#L469]
However, the below works:
--> insert into test_dec values ('-.5');
--> insert into test_dec values (-0.5);
> Insert into Hive tables doesn't work for decimal numbers with no preceding digit before
the decimal
> ---------------------------------------------------------------------------------------------------
>
> Key: HIVE-24223
> URL: https://issues.apache.org/jira/browse/HIVE-24223
> Project: Hive
> Issue Type: Bug
> Affects Versions: All Versions
> Reporter: Kriti Jha
> Priority: Minor
>
> Any insert operation to a table in Hive with decimal integers without a digit before
the DOT ('.') fails with an exception as shown below:
> ------------------------------------------------------------------
> hive> create table test_dec(id decimal(10,8));
> hive> insert into test_dec values (-.5);
> NoViableAltException(16@[412:1: atomExpression : ( constant | ( intervalExpression )=>
intervalExpression | castExpression | extractExpression | floorExpression | caseExpression
| whenExpression | ( subQueryExpression )=> ( subQueryExpression ) -> ^( TOK_SUBQUERY_EXPR
TOK_SUBQUERY_OP subQueryExpression ) | ( functionName LPAREN )=> function | tableOrColumn
| expressionsInParenthesis[true] );])NoViableAltException(16@[412:1: atomExpression : ( constant
| ( intervalExpression )=> intervalExpression | castExpression | extractExpression | floorExpression
| caseExpression | whenExpression | ( subQueryExpression )=> ( subQueryExpression ) ->
^( TOK_SUBQUERY_EXPR TOK_SUBQUERY_OP subQueryExpression ) | ( functionName LPAREN )=> function
| tableOrColumn | expressionsInParenthesis[true] );]) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser$DFA36.specialStateTransition(HiveParser_IdentifiersParser.java:31810)
at org.antlr.runtime.DFA.predict(DFA.java:80) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.atomExpression(HiveParser_IdentifiersParser.java:6746)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceFieldExpression(HiveParser_IdentifiersParser.java:6988)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnaryPrefixExpression(HiveParser_IdentifiersParser.java:7324)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnarySuffixExpression(HiveParser_IdentifiersParser.java:7380)
at
> ...
> org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expression(HiveParser_IdentifiersParser.java:6686)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expressionsNotInParenthesis(HiveParser_IdentifiersParser.java:2287)
at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expressionsInParenthesis(HiveParser_IdentifiersParser.java:2233)
at org.apache.hadoop.hive.ql.parse.HiveParser.expressionsInParenthesis(HiveParser.java:42106)
at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.valueRowConstructor(HiveParser_FromClauseParser.java:6499)
at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.valuesTableConstructor(HiveParser_FromClauseParser.java:6583)
at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.valuesClause(HiveParser_FromClauseParser.java:6704)
at org.apache.hadoop.hive.ql.parse.HiveParser.valuesClause(HiveParser.java:41954) at org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:36536)
at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:35822)
at
> ...
> org.apache.hadoop.util.RunJar.main(RunJar.java:153)FAILED: ParseException line 1:30
cannot recognize input near '.' '5' ')' in expression specification
> ------------------------------------------------------------------
> It seems to be coming from the Lexer where the types are defined and the definition of
'Number' should be coming into play:
> ----------------------
> Number : (Digit)+ ( DOT (Digit)* (Exponent)? | Exponent)? ;
> ----------------------
> >[https://github.com/apache/hive/blob/2006e52713508a92fb4d1d28262fd7175eade8b7/parser/src/java/org/apache/hadoop/hive/ql/parse/HiveLexerParent.g#L469]
> However, the below works:
> > insert into test_dec values ('-.5');
> > insert into test_dec values (-0.5);
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
|