Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-1412

JdbcCommon.createSchema() throws exception when no columns are present

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.5.0
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mattyb149 Matt Burgess
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: