You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/11/27 23:37:01 UTC

[jira] [Commented] (NIFI-5845) Support OTHER and SQLXML JDBC types in database processors

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

ASF GitHub Bot commented on NIFI-5845:
--------------------------------------

GitHub user mattyb149 opened a pull request:

    https://github.com/apache/nifi/pull/3184

    NIFI-5845: Add support for OTHER and SQLXML JDBC types to SQL/Hive processors

    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?
    - [ ] 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?
    - [ ] 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/mattyb149/nifi NIFI-5845

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/3184.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 #3184
    
----
commit a8009f9a0010b99703713a38263006a7a9e5f5d5
Author: Matthew Burgess <ma...@...>
Date:   2018-11-27T23:35:29Z

    NIFI-5845: Add support for OTHER and SQLXML JDBC types to SQL/Hive processors

----


> Support OTHER and SQLXML JDBC types in database processors
> ----------------------------------------------------------
>
>                 Key: NIFI-5845
>                 URL: https://issues.apache.org/jira/browse/NIFI-5845
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Matt Burgess
>            Assignee: Matt Burgess
>            Priority: Major
>
> Currently, OTHER and SQLXML JDBC types are not supported by the database processors. When the processor(s) try to create a schema, it does not recognize these types and will fail. For example, this happens with PostgreSQL's JSONB and XML types, respectively.
> The meaning of OTHER is "the SQL type is database-specific and gets mapped to a Java object that can be accessed via the methods getObject and setObject." Since they are Java Objects, we could represent them as Strings in the schema and use the value of toString(). This doesn't allow us to represent the JSON fields as a nested record, but we don't have enough information per se, as an OTHER value could be anything. Perhaps in a future improvement we could try to parse the object as JSON, and continue if successful. However the schema currently has to be determined beforehand, so I'm not sure if that would work.
> For SQLXML, we can use the SQLXML interface to get at the String or even an InputStream, and since we know it's XML, we could parse it into records the same way XMLRecordReader does. However that would/should involve some refactor, to get the common utilities/methods into something like a nifi-xml-record-utils package. Also for this Jira it would be inconsistent with the handling of JSON fields (if reported as type OTHER). This might make a good companion Jira to the aforementioned one, to try and change JSON/XML fields into nested records.
> I verified these types with PostgreSQL's JSON, JSONB, and XML types, as well as MySQL's JSON type. Oracle's XMLTYPE returns a different code (2007), and I couldn't find a way to set the connection property to return SQLXML instead. Even with that, you have to add two additional JARs to the classpath, and in my experiments it didn't seem to work when I added them to the Driver Resources property. Apache Derby doesn't have either type so I wasn't able to write unit tests to illustrate this.
> This Jira proposes to add support for OTHER and SQLXML JDBC types to the database processors, interpreting their values as Strings.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)