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

Matt Burgess commented on NIFI-1412:
------------------------------------

I'm totally open to discussing whether this is a real bug or not, if a better 
behavior is to throw an exception when no columns are present, then this can be 
closed. However empty result sets are valid in SQL so my inclination is to 
produce an empty Avro Schema.

> JdbcCommon.createSchema() throws exception when no columns are present
> ----------------------------------------------------------------------
>
>                 Key: NIFI-1412
>                 URL: https://issues.apache.org/jira/browse/NIFI-1412
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Matt Burgess
>
> The discovery of the bug in NIFI-1409 was a result of an exception being 
> thrown when no columns were present in a result set returned by a query in 
> the ExecuteSql processor.  While NIFI-1409 is concerned with handling all 
> such exceptions, this case is for the aforementioned exception.
> The problem seems to be in JdbcCommon.createSchema():
> https://github.com/apache/nifi/blob/nifi-0.4.1/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java#L130
> This line asks for the table name for the first column, and when there are no 
> columns, a SQLException is thrown.
> The Avro docs suggest that no fields are necessary for the schema to be 
> valid, so if there are no columns in the result set, a schema with no fields 
> should be returned, rather than an exception being thrown.



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

Reply via email to