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

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

GitHub user mattyb149 opened a pull request:

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

    NIFI-1409: Fix missing transfer on error in ExecuteSql

    This change keeps track of the "working flowfile", either the incoming 
flowfile if one exists, or the one created if no incoming flowfile exists. Then 
if an exception is thrown, the correct flowfile reference is available for 
transfer to failure.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mattyb149/nifi NIFI-1409

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

    https://github.com/apache/nifi/pull/178.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 #178
    
----
commit c20018f923f9feb4e50eb47586b36168e45e0931
Author: Matt Burgess <[email protected]>
Date:   2016-01-19T15:55:48Z

    NIFI-1409: Fix missing transfer on error in ExecuteSql

----


> ExecuteSQL gives transfer error when SQLException occurs with no input 
> flowfile
> -------------------------------------------------------------------------------
>
>                 Key: NIFI-1409
>                 URL: https://issues.apache.org/jira/browse/NIFI-1409
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Matt Burgess
>
> When the result set from ExecuteSQL has no columns, a bulletin is issued 
> saying a flowfile was not transferred:
> 13:35:12 ESTERROR05845c66-73a4-49ff-a973-ad986fb651bf
> ExecuteSQL[id=05845c66-73a4-49ff-a973-ad986fb651bf] Unable to execute SQL 
> select query SELECT * FROM test due to 
> org.apache.nifi.processor.exception.ProcessException: 
> org.postgresql.util.PSQLException: The column index is out of range: 1, 
> number of columns: 0.. No incoming flow file to route to failure: 
> org.apache.nifi.processor.exception.ProcessException: 
> org.postgresql.util.PSQLException: The column index is out of range: 1, 
> number of columns: 0.
> 13:35:12 ESTERROR05845c66-73a4-49ff-a973-ad986fb651bf
> ExecuteSQL[id=05845c66-73a4-49ff-a973-ad986fb651bf] 
> ExecuteSQL[id=05845c66-73a4-49ff-a973-ad986fb651bf] failed to process due to 
> org.apache.nifi.processor.exception.FlowFileHandlingException: 
> StandardFlowFileRecord[uuid=c9077d5c-d873-4bf2-a8c0-4cc92a6f3309,claim=,offset=0,name=258316166470532,size=0]
>  transfer relationship not specified; rolling back session: 
> org.apache.nifi.processor.exception.FlowFileHandlingException: 
> StandardFlowFileRecord[uuid=c9077d5c-d873-4bf2-a8c0-4cc92a6f3309,claim=,offset=0,name=258316166470532,size=0]
>  transfer relationship not specified
> If there is any problem with the query (such as selecting a column that 
> doesn't exist, or SELECT * from a table with no columns), a SQLException is 
> thrown, which becomes a ProcessException in the ExecuteSQL processor. In 
> addition, the exception handling tries to route the flowfile to failure, but 
> for the newly created flowfile (to contain the result set), the reference has 
> since been lost, and thus the flowfile is never transferred.
> At present, if it desired that an empty result set causes a route to failure, 
> then a workaround is to add a GenerateFlowFile processor (with a 0-byte size) 
> in front of the ExecuteSQL processor. This bypasses the logic error because 
> the incoming flowfile is reused and eventually transferred to failure because 
> of the exception thrown.



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

Reply via email to