Bryan Bende created NIFI-2048:
---------------------------------

             Summary: ExecuteSQL converts BigDecimal to strings in Avro
                 Key: NIFI-2048
                 URL: https://issues.apache.org/jira/browse/NIFI-2048
             Project: Apache NiFi
          Issue Type: Bug
    Affects Versions: 0.6.1
            Reporter: Bryan Bende
            Priority: Minor


Some JDBC drivers (Oracle is one of them) return NUMBER columns as BigDecimal. 
NiFi then turns that into a string in the Avro that is produced. 

This happens in JdbcCommon when creating the schema:
{code}        
case DECIMAL:
case NUMERIC:            
builder.name(meta.getColumnName(i)).type().unionOf()
  .nullBuilder().endNull().and().stringType().endUnion().noDefault();
{code}

Then later when getting the value of the column to add to the Avro record:

{code}
} else if (value instanceof BigDecimal || value instanceof BigInteger) {
                        rec.put(i - 1, value.toString());
                    } 
{code}

It looks like Avro has support for Decimal types and we should look into using 
this:

https://avro.apache.org/docs/1.7.7/spec.html#Logical+Types
https://issues.apache.org/jira/browse/AVRO-1402



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to