Uploaded image for project: 'Parquet'
  1. Parquet
  2. PARQUET-2134

Incorrect type checking in HadoopStreams.wrap

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.8.3, 1.10.1, 1.11.2, 1.12.2
    • 1.13.0
    • parquet-mr
    • None

    Description

      The method HadoopStreams.wrap wraps an FSDataInputStream to a SeekableInputStream.

      It checks whether the underlying stream of the passed FSDataInputStream implements ByteBufferReadable: if true, wraps the FSDataInputStream to H2SeekableInputStream; otherwise, wraps to H1SeekableInputStream.

      In some cases, we may add another wrapper over FSDataInputStream. For example,

      class CustomDataInputStream extends FSDataInputStream {
          public CustomDataInputStream(FSDataInputStream original) {
              super(original);
          }
      }
      

      When we create an FSDataInputStream, whose underlying stream does not implements ByteBufferReadable, and then creates a CustomDataInputStream with it. If we use HadoopStreams.wrap to create a SeekableInputStream, we may get an error like

      java.lang.UnsupportedOperationException: Byte-buffer read unsupported by input stream

      We can fix this by taking recursive checks over the underlying stream of FSDataInputStream.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              gaoguantao Todd Gao
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: