You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Denes Arvay (Jira)" <ji...@apache.org> on 2021/07/12 08:05:00 UTC

[jira] [Comment Edited] (NIFI-8759) ExecuteSQL and ExecuteSQLRecord unnecessarily fall back to default decimal scale

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

Denes Arvay edited comment on NIFI-8759 at 7/12/21, 8:04 AM:
-------------------------------------------------------------

[~mattyb149], I have tested several numeric types using Oracle.

FLOAT's precision is 126, scale is -127, this won't be affected by the suggested change due to scale being negative.

{{SELECT 1.23 FROM DUAL}}'s is mapped as {{NUMBER(0, -127)}}, with {{oracle.jdbc.J2EE13Compliant}} as {{NUMBER(0, 0)}}, ROWNUM is mapped as {{NUMBER(0, 0) }}in both cases. None of these will be affected either as a different {{if}} branch handles the {{precision == 0}} cases, see [1].

I'll open a PR soon.

 

There's one case though where the logic could be improved: NUMBER with negative scale should be treated with zero scale instead of the default.

This isn't in the scope of this ticket, I just wanted to mention.

 

[1] https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-extension-utils/nifi-database-utils/src/main/java/org/apache/nifi/util/db/JdbcCommon.java#L586-L594


was (Author: denes):
[~mattyb149], I have tested several numeric types using Oracle.

FLOAT's precision is 126, scale is -127, this won't be affected by the suggested change due to scale being negative.

{{SELECT 1.23 FROM DUAL}}'s is mapped as {{NUMBER(0, -127)}}, ROWNUM is mapped as {{NUMBER(0, 0)}}. These won't be affected either as a different {{if}} branch handles the {{precision == 0}} cases.

I'll open a PR soon.

 

There's one case though where the logic could be improved: NUMBER with negative scale should be treated with zero scale instead of the default.

This isn't in the scope of this ticket, I just wanted to mention.

> ExecuteSQL and ExecuteSQLRecord unnecessarily fall back to default decimal scale
> --------------------------------------------------------------------------------
>
>                 Key: NIFI-8759
>                 URL: https://issues.apache.org/jira/browse/NIFI-8759
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Denes Arvay
>            Assignee: Denes Arvay
>            Priority: Major
>
> If the database returns 0 as scale of a decimal field ExecuteSQL and ExecuteSQLRecord processors fall back to the default scale even though 0 should be a valid scale.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)