[
https://issues.apache.org/jira/browse/HIVE-24305?focusedWorklogId=505602&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-505602
]
ASF GitHub Bot logged work on HIVE-24305:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 28/Oct/20 07:39
Start Date: 28/Oct/20 07:39
Worklog Time Spent: 10m
Work Description: lcspinter commented on a change in pull request #1601:
URL: https://github.com/apache/hive/pull/1601#discussion_r513232453
##########
File path: ql/src/test/queries/clientnegative/avro_decimal.q
##########
@@ -12,6 +12,6 @@ OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
TBLPROPERTIES (
'numFiles'='1',
-
'avro.schema.literal'='{\"namespace\":\"com.howdy\",\"name\":\"some_schema\",\"type\":\"record\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"value\",\"type\":{\"type\":\"bytes\",\"logicalType\":\"decimal\",\"precision\":"5",\"scale\":"2"}}]}'
+
'avro.schema.literal'='{\"namespace\":\"com.howdy\",\"name\":\"some_schema\",\"type\":\"record\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"value\",\"type\":{\"type\":\"bytes\",\"logicalType\":\"decimal\",\"precision\":"a",\"scale\":"b"}}]}'
Review comment:
What happens if the precision or scale numbers are negative? Could you
please add some q tests to cover that scenario as well?
##########
File path:
serde/src/java/org/apache/hadoop/hive/serde2/avro/SchemaToTypeInfo.java
##########
@@ -186,6 +188,20 @@ public static TypeInfo generateTypeInfo(Schema schema,
return typeInfoCache.retrieve(schema, seenSchemas);
}
+ private static int getIntValue(JsonNode jsonNode) {
+ int value = 0;
+ if (jsonNode instanceof TextNode) {
+ try {
Review comment:
Nit: Instead of using a try-catch block, you could use
StringUtils.isNumeric() to determine if a string is a positive decimal number.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 505602)
Time Spent: 20m (was: 10m)
> avro decimal schema is not properly populating scale/precision if value is
> enclosed in quote
> --------------------------------------------------------------------------------------------
>
> Key: HIVE-24305
> URL: https://issues.apache.org/jira/browse/HIVE-24305
> Project: Hive
> Issue Type: Bug
> Reporter: Naresh P R
> Assignee: Naresh P R
> Priority: Major
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> {code:java}
> CREATE TABLE test_quoted_scale_precision STORED AS AVRO TBLPROPERTIES
> ('avro.schema.literal'='{"type":"record","name":"DecimalTest","namespace":"com.example.test","fields":[{"name":"Decimal24_6","type":["null",{"type":"bytes","logicalType":"decimal","precision":24,"scale":"6"}]}]}');
>
> desc test_quoted_scale_precision;
> // current output
> decimal24_6 decimal(24,0)
> // expected output
> decimal24_6 decimal(24,6){code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)