Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-22981

DataFileReader is not closed in AvroGenericRecordReader#extractWriterTimezoneFromMetadata

    XMLWordPrintableJSON

Details

    Description

      Method looks like :

       private ZoneId extractWriterTimezoneFromMetadata(JobConf job, FileSplit split,
            GenericDatumReader<GenericRecord> gdr) throws IOException {
          if (job == null || gdr == null || split == null || split.getPath() == null) {
            return null;
          }
          try {
            DataFileReader<GenericRecord> dataFileReader =
                new DataFileReader<GenericRecord>(new FsInput(split.getPath(), job), gdr);
            [...return...]
            }
          } catch (IOException e) {
            // Can't access metadata, carry on.
          }
          return null;
        }
      

      The DataFileReader is never closed which can cause a memory leak. We need a try-with-resources here.

      Attachments

        1. HIVE-22981.01.patch
          1 kB
          Karen Coppage

        Issue Links

          Activity

            People

              klcopp Karen Coppage
              klcopp Karen Coppage
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 40m
                  1h 40m