[ 
https://issues.apache.org/jira/browse/BEAM-8865?focusedWorklogId=357423&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-357423
 ]

ASF GitHub Bot logged work on BEAM-8865:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Dec/19 21:28
            Start Date: 10/Dec/19 21:28
    Worklog Time Spent: 10m 
      Work Description: suztomo commented on pull request #10256: [BEAM-8865] 
Updating Javadoc of FileIO example
URL: https://github.com/apache/beam/pull/10256#discussion_r356286568
 
 

 ##########
 File path: sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileIO.java
 ##########
 @@ -135,9 +135,15 @@
  *     .apply(FileIO.readMatches().withCompression(GZIP))
  *     .apply(MapElements
  *         // uses imports from TypeDescriptors
- *         .into(KVs(strings(), strings()))
- *         .via((ReadableFile f) -> KV.of(
- *             f.getMetadata().resourceId().toString(), 
f.readFullyAsUTF8String())));
+ *         .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);
 
 Review comment:
   Created a ticket to followup https://issues.apache.org/jira/browse/BEAM-8942 
.
   
   The original code with try-catch is still in this PR.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 357423)
    Time Spent: 1h 50m  (was: 1h 40m)

> 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
>
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> The doc says
>  !v1YuuuT2o2i.png! 
> However, 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)

Reply via email to