@Override
  public void addWriteNotificationEvents() throws StreamingException {
    if (!conf.getBoolVar(HiveConf.ConfVars.FIRE_EVENTS_FOR_DML)) {
      LOG.debug("Write notification log is ignored as dml event logging is disabled.");
      return;
    }
    try {
      // Traverse the write paths for the current streaming connection and add one write notification
      // event per table or partitions.
      // For non-partitioned table, there will be only one entry in writePath and corresponding
      // partitionVals is null.
      Long currentTxnId = getCurrentTxnId();
      Long currentWriteId = getCurrentWriteId();
      for (WriteDirInfo writeInfo : writePaths.values()) {
        LOG.debug("TxnId: " + currentTxnId + ", WriteId: " + currentWriteId
                + " - Logging write event for the files in path " + writeInfo.getWriteDir());

        // List the new files added inside the write path (delta directory).
        FileSystem fs = tableObject.getDataLocation().getFileSystem(conf);
        List<FileStatus> newFiles = HdfsUtils.listLocatedFileStatus(fs, writeInfo.getWriteDir(), null, true);

        // If no files are added by this streaming writes, then no need to log write notification event.
        if (newFiles.isEmpty()) {
          LOG.debug("TxnId: " + currentTxnId + ", WriteId: " + currentWriteId
                  + " - Skipping empty path " + writeInfo.getWriteDir());
          continue;
        }

        // Add write notification events into HMS table.
        Hive.addWriteNotificationLog(conf, tableObject, writeInfo.getPartitionVals(),
                currentTxnId, currentWriteId, newFiles, null);
      }
    } catch (IOException | TException | HiveException e) {
      throw new StreamingException("Failed to log write notification events.", e);
    }
  }
Add Write notification events if it is enabled.
@throws StreamingException File operation errors or HMS errors.
streaming/src/java/org/apache/hive/streaming/HiveStreamingConnection.java