tpalfy commented on a change in pull request #4223:
URL: https://github.com/apache/nifi/pull/4223#discussion_r413947216



##########
File path: 
nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java
##########
@@ -341,9 +341,7 @@ public static DataType determineDataType(final Schema 
avroSchema, Map<String, Da
                 case LOGICAL_TYPE_TIMESTAMP_MICROS:
                     return RecordFieldType.TIMESTAMP.getDataType();
                 case LOGICAL_TYPE_DECIMAL:
-                    // We convert Decimal to Double.
-                    // Alternatively we could convert it to String, but 
numeric type is generally more preferable by users.
-                    return RecordFieldType.DOUBLE.getDataType();
+                    return RecordFieldType.BIGDECIMAL.getDataType();

Review comment:
       Shouldn't we also handle `RecordFieldType.BIGDECIMA` in the 
`buildAvroSchema` method?

##########
File path: 
nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/RecordFieldType.java
##########
@@ -72,6 +72,11 @@
      */
     DOUBLE("double", FLOAT),
 
+    /**
+     * A big decimal field type. Fields of this type use a {@code 
java.math.BigDecimal} value.
+     */
+    BIGDECIMAL("bigdecimal", FLOAT, DOUBLE),

Review comment:
       Maybe we should consider the following methods as well:
   `InferenceSchemaStrategy.convertSchema`
   `PutElasticsearchHttpRecord.writeValue`
   `PutHBaseRecord.asBytes`
   `AbstractKuduProcessor.toKuduType`
   `ResultSetRecordSet.getFieldType:382 case Types.JAVA_OBJECT`
   `DataTypeUtils.getWiderType:1744,1749 case FLOAT,case DOUBLE`
   `AbstractCSVRecordReader.convertSimpleIfPossible`
   `CSVSchemaInference.getDataType`
   `JsonTreeRowRecordReader.convertField`
   `WriteXMLResult.writeFieldForType`
   `XMLRecordReader.parseFieldForType`
   `XMLRecordReader.parseStringForType`
   `XmlSchemaInference.inferTextualDataType`
   `RecordSinkHandler.getDataType`
   `KuduLookupService.kuduSchemaToNiFiSchema:319 case DECIMAL`




----------------------------------------------------------------
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]


Reply via email to