You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Tomo Suzuki (Jira)" <ji...@apache.org> on 2019/12/02 20:52:00 UTC

[jira] [Updated] (BEAM-8865) FileIO's Javadoc is outdated: TypeDescriptors.KVs and unhandled IOException

     [ https://issues.apache.org/jira/browse/BEAM-8865?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tomo Suzuki updated BEAM-8865:
------------------------------
    Attachment: v1YuuuT2o2i.png

> FileIO's Javadoc is outdated: TypeDescriptors.KVs and unhandled IOException
> ---------------------------------------------------------------------------
>
>                 Key: BEAM-8865
>                 URL: https://issues.apache.org/jira/browse/BEAM-8865
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Tomo Suzuki
>            Assignee: Tomo Suzuki
>            Priority: Major
>         Attachments: v1YuuuT2o2i.png
>
>
> I had to modify the code to below:
> {noformat}
>     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);
>               }
>              }))
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)