2017-10-31 10 views
0

) 빔 google 데이터 흐름 파이프 라인 예제 중 하나를 시도하고 있지만 MapElements 및 메소드 SingleFunction/SerializableFunction 호출과 관련하여 예외가 발생합니다. 코드 조각은 다음과 같다 : 점에서Apache beam Dataflow SDK 오류 (예 :

static class ParseTableRowJson extends SimpleFunction<String, TableRow> { 
    @Override 
    public TableRow apply(String input) { 
     try { 
      return Transport.getJsonFactory().fromString(input, TableRow.class); 
     } catch (IOException e) { 
      throw new RuntimeException("Failed parsing table row json", e); 
     } 
    } 
} 
...... 
p.apply(TextIO.read().from(options.getInput())) 
       .apply(MapElements.via(new ParseTableRowJson())) 
       .apply(new ComputeTopSessions(samplingThreshold)) 
       .apply("Write", 
TextIO.write().withoutSharding().to(options.getOutput())); 

예외의 방법에 모호한 전화 :

Ambiguous method call. Both 
via (SimpleFunction<String, TableRow>) in MapElements and 
via (SerializableFunction)    in MapElements match 

다른 사람이 같은 예외로 충돌하고 주위에 방법이있어 했습니까?

전체 예제는 github (https://github.com/apache/beam/blob/master/examples/java/src/main/java/org/apache/beam/examples/complete/TopWikipediaSessions.java)입니다. 이 보인다

감사합니다,

페르난도

답변

0

는 HEAD의 코드에서 수정 된합니다. 특히 MapElements에는 더 이상 두 가지 정적 버전 via이 없습니다. 단기적으로는 HEAD에서 Beam을 설치하거나를 직접 수정하여 ParDo을 사용하여 SimpleFunction 대신 을 DoFn으로 업데이트 할 수 있습니다.

+0

안녕하세요 Ben, 답장을 보내 주셔서 감사합니다. MapElements를 DoFn으로 변환하는 과정이 끝났습니다. –