[ 
https://issues.apache.org/jira/browse/BEAM-5420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16629346#comment-16629346
 ] 

Kevin Si commented on BEAM-5420:
--------------------------------

Or we use the following method to get display data from runtime parameters. The 
point is it shouldn't call the get() method.

 

/** Create a display item for the specified key and \{@link ValueProvider}. */
 public static ItemSpec<?> item(String key, @Nullable ValueProvider<?> value) {
 if (value == null) {
 return item(key, Type.STRING, null);
 }
 if (value.isAccessible()) {
 Object got = value.get();
 if (got == null) {
 return item(key, Type.STRING, null);
 }
 Type type = inferType(got);
 if (type != null) {
 return item(key, type, got);
 }
 }
 // General case: not null and type not inferable. Fall back to toString of the 
VP itself.
 return item(key, Type.STRING, String.valueOf(value));
 }

> BigtableIO tries to get runtime parameters when collecting display data at 
> pipeline construction time
> -----------------------------------------------------------------------------------------------------
>
>                 Key: BEAM-5420
>                 URL: https://issues.apache.org/jira/browse/BEAM-5420
>             Project: Beam
>          Issue Type: Bug
>          Components: io-java-gcp
>            Reporter: Kevin Si
>            Assignee: Chamikara Jayalath
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> For example: 
> [https://github.com/apache/beam/blob/master/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableConfig.java#L165]
> At Dataflow pipeline construction time calling getProjectId() gives an error.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to