[
https://issues.apache.org/jira/browse/NIFI-3958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16023138#comment-16023138
]
ASF GitHub Bot commented on NIFI-3958:
--------------------------------------
GitHub user ijokarumawak opened a pull request:
https://github.com/apache/nifi/pull/1851
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
Thank you for submitting a contribution to Apache NiFi.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [x] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number
you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [x] Has your PR been rebased against the latest commit within the target
branch (typically master)?
- [x] Is your initial contribution a single, squashed commit?
### For code changes:
- [x] Have you ensured that the full suite of tests is executed via mvn
-Pcontrib-check clean install at the root nifi folder?
- [x] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the LICENSE file, including the main
LICENSE file under nifi-assembly?
- [ ] If applicable, have you updated the NOTICE file, including the main
NOTICE file found under nifi-assembly?
- [x] If adding new Properties, have you added .displayName in addition to
.name (programmatic access) for each of the new properties?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in
which it is rendered?
### Note:
Please ensure that once the PR is submitted, you check travis-ci for build
issues and submit an update to your PR as soon as possible.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ijokarumawak/nifi nifi-3958
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/1851.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1851
----
commit 3a49c8ed5263fbccc917bdfb91cf2c9b7b62459a
Author: Koji Kawamura <[email protected]>
Date: 2017-05-24T15:53:09Z
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
----
> 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)