Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-8865

FileIO's Javadoc is outdated: TypeDescriptors.KVs and unhandled IOException

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.19.0
    • Component/s: sdk-java-core
    • Labels:

      Description

      The doc says

      However, I had to modify the code to below:

          p.apply("ReadLines",
              FileIO.match().filepattern("hdfs:///foo/bar/*.gz"))
              .apply(FileIO.readMatches().withCompression(GZIP))
              .apply(MapElements
                  // uses imports from TypeDescriptors
                  .into(kvs(strings(), strings()))
                  .via((ReadableFile f) -> {
                    try {
                      return KV.of(
                          f.getMetadata().resourceId().toString(), f.readFullyAsUTF8String());
                    } catch (IOException ex) {
                      throw new RuntimeException("Failed to read the file", ex);
                    }
                   }))
      

        Attachments

          Activity

            People

            • Assignee:
              suztomo Tomo Suzuki
              Reporter:
              suztomo Tomo Suzuki

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

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

                  Issue deployment