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

SQL processors do not handle Avro conversion of Oracle timestamps correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.7.0
    • Extensions
    • None

    Description

      In JdbcCommon (used by such processors as ExecuteSQL and QueryDatabaseTable), if a ResultSet column is not a CLOB or BLOB, its value is retrieved using getObject(), then further processing is done based on the SQL type and/or the Java class of the value.

      However, in Oracle when getObject() is called on a Timestamp column, it returns an Oracle-specific TIMESTAMP class which does not inherit from java.sql.Timestamp or java.sql.Date. Thus the processing "falls through" and its value is attempted to be inserted as a string, which violates the Avro schema (which correctly recognized it as a long of timestamp logical type).

      At least for Oracle, the right way to process a Timestamp column is to call getTimestamp() rather than getObject(), the former returns a java.sql.Timestamp object which would correctly be processed by the current code. I would hope that all drivers would support this but we would want to test on (at least) MySQL, Oracle, and PostgreSQL.

      Attachments

        Issue Links

          Activity

            People

              mattyb149 Matt Burgess
              mattyb149 Matt Burgess
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: