Class DefaultAvroSqlWriter

java.lang.Object
org.apache.nifi.processors.standard.sql.DefaultAvroSqlWriter
All Implemented Interfaces:
SqlWriter

public class DefaultAvroSqlWriter extends Object implements SqlWriter
  • Field Details

  • Constructor Details

  • Method Details

    • writeResultSet

      public long writeResultSet(ResultSet resultSet, OutputStream outputStream, org.apache.nifi.logging.ComponentLog logger, JdbcCommon.ResultSetRowCallback callback) throws Exception
      Description copied from interface: SqlWriter
      Writes the given result set out to the given output stream, possibly applying a callback as each row is processed.
      Specified by:
      writeResultSet in interface SqlWriter
      Parameters:
      resultSet - the ResultSet to be written
      outputStream - the OutputStream to write the result set to
      logger - a common logger that can be used to log messages during write
      callback - a MaxValueResultSetRowCollector that may be called as each row in the ResultSet is processed
      Returns:
      the number of rows written to the output stream
      Throws:
      Exception - if any errors occur during the writing of the result set to the output stream
    • getAttributesToAdd

      public Map<String,String> getAttributesToAdd()
      Description copied from interface: SqlWriter
      Returns a map of attribute key/value pairs to be added to any outgoing flow file(s). The default implementation is to return an empty map.
      Specified by:
      getAttributesToAdd in interface SqlWriter
      Returns:
      a map of attribute key/value pairs
    • writeEmptyResultSet

      public void writeEmptyResultSet(OutputStream outputStream, org.apache.nifi.logging.ComponentLog logger) throws IOException
      Description copied from interface: SqlWriter
      Writes an empty result set to the output stream. In some cases a ResultSet might not have any viable rows, but will throw an error or behave unexpectedly if rows are attempted to be retrieved. This method indicates the implementation should write whatever output is appropriate for a result set with no rows.
      Specified by:
      writeEmptyResultSet in interface SqlWriter
      Parameters:
      outputStream - the OutputStream to write the empty result set to
      logger - a common logger that can be used to log messages during write
      Throws:
      IOException - if any errors occur during the writing of an empty result set to the output stream
    • getMimeType

      public String getMimeType()
      Description copied from interface: SqlWriter
      Returns the MIME type of the output format. This can be used in FlowFile attributes or to perform format-specific processing as necessary.
      Specified by:
      getMimeType in interface SqlWriter
      Returns:
      the MIME type string of the output format.