You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/10/23 01:18:20 UTC

[GitHub] [hive] nareshpr opened a new pull request #1601: HIVE-24305: avro decimal schema is not properly populating scale/precision if value is enclosed in quote

nareshpr opened a new pull request #1601:
URL: https://github.com/apache/hive/pull/1601


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] lcspinter commented on a change in pull request #1601: HIVE-24305: avro decimal schema is not properly populating scale/precision if value is enclosed in quote

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] lcspinter merged pull request #1601: HIVE-24305: avro decimal schema is not properly populating scale/precision if value is enclosed in quote

Posted by GitBox <gi...@apache.org>.
lcspinter merged pull request #1601:
URL: https://github.com/apache/hive/pull/1601


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] lcspinter commented on pull request #1601: HIVE-24305: avro decimal schema is not properly populating scale/precision if value is enclosed in quote

Posted by GitBox <gi...@apache.org>.
lcspinter commented on pull request #1601:
URL: https://github.com/apache/hive/pull/1601#issuecomment-722917583


   @nareshpr Thanks for the patch! Pushed it to master.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org