[ 
https://issues.apache.org/jira/browse/NIFI-3958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16025187#comment-16025187
 ] 

ASF subversion and git services commented on NIFI-3958:
-------------------------------------------------------

Commit 13b59b56210eff6f06f6cfb3020953666d502604 in nifi's branch 
refs/heads/master from [~ijokarumawak]
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=13b59b5 ]

NIFI-3958: Decimal logical type with undefined precision and scale.

- Oracle NUMBER can return 0 precision and -127 or 0 scale with variable scale 
NUMBER such as ROWNUM or function result
- Added 'Default Decimal Precision' and 'Default Decimal Scale' property to 
ExecuteSQL and QueryDatabaseTable to apply default precision and scale if those 
are unknown
- Coerce BigDecimal scale to field schema logical type, so that BigDecimals 
having different scale can be written

Signed-off-by: Matt Burgess <mattyb...@apache.org>

This closes #1851


> Avro decimal logical type fail if database returns Zero precision
> -----------------------------------------------------------------
>
>                 Key: NIFI-3958
>                 URL: https://issues.apache.org/jira/browse/NIFI-3958
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 1.3.0
>            Reporter: Koji Kawamura
>            Assignee: Koji Kawamura
>
> NIFI-2624 introduced Avro logical type mapping capability. For 
> NUMERIC/DECIMAL types, 'decimal' logical type is used, and positive precision 
> is required to encode a numeric value as 'decimal logical type.
> However, database can return 0 (Zero) precision to represent unlimited 
> precision, if a column is not configured with specific precision (some 
> database engine has default precision, but some don't), or numeric value 
> generated by functions or other means dynamically.
> We need to provide a way to define default precision in case Zero precision 
> is returned, probably by adding another Processor property to specify default 
> precision.
> {code}
> 2017-05-23 16:54:12,414 WARN [Timer-Driven Process Thread-5] 
> o.a.n.c.t.ContinuallyRunProcessorTask
> java.lang.IllegalArgumentException: Invalid decimal precision: 0 (must be 
> positive)
>         at 
> org.apache.avro.LogicalTypes$Decimal.validate(LogicalTypes.java:206)
>         at org.apache.avro.LogicalType.addToSchema(LogicalType.java:70)
>         at 
> org.apache.avro.LogicalTypes$Decimal.addToSchema(LogicalTypes.java:182)
>         at 
> org.apache.nifi.processors.standard.util.JdbcCommon.lambda$createSchema$0(JdbcCommon.java:463)
>         at 
> org.apache.nifi.processors.standard.util.JdbcCommon.addNullableField(JdbcCommon.java:359)
>         at 
> org.apache.nifi.processors.standard.util.JdbcCommon.createSchema(JdbcCommon.java:461)
>         at 
> org.apache.nifi.processors.standard.util.JdbcCommon.convertToAvroStream(JdbcCommon.java:192)
>         at 
> org.apache.nifi.processors.standard.ExecuteSQL$2.process(ExecuteSQL.java:204)
>         at 
> org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2529)
>         at 
> org.apache.nifi.processors.standard.ExecuteSQL.onTrigger(ExecuteSQL.java:195)
>         at 
> org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
>         at 
> org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1120)
>         at 
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:144)
>         at 
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to