[
https://issues.apache.org/jira/browse/BEAM-9059?focusedWorklogId=367582&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-367582
]
ASF GitHub Bot logged work on BEAM-9059:
----------------------------------------
Author: ASF GitHub Bot
Created on: 07/Jan/20 17:38
Start Date: 07/Jan/20 17:38
Worklog Time Spent: 10m
Work Description: lukecwik commented on pull request #10511: [BEAM-9059]
Migrate PTransformTranslation to use string constants
URL: https://github.com/apache/beam/pull/10511#discussion_r363865781
##########
File path:
runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/PTransformTranslation.java
##########
@@ -60,68 +61,131 @@
* buffers}.
*/
public class PTransformTranslation {
-
- public static final String PAR_DO_TRANSFORM_URN =
getUrn(StandardPTransforms.Primitives.PAR_DO);
- public static final String FLATTEN_TRANSFORM_URN =
getUrn(StandardPTransforms.Primitives.FLATTEN);
- public static final String GROUP_BY_KEY_TRANSFORM_URN =
- getUrn(StandardPTransforms.Primitives.GROUP_BY_KEY);
- public static final String IMPULSE_TRANSFORM_URN =
getUrn(StandardPTransforms.Primitives.IMPULSE);
- public static final String ASSIGN_WINDOWS_TRANSFORM_URN =
- getUrn(StandardPTransforms.Primitives.ASSIGN_WINDOWS);
- public static final String TEST_STREAM_TRANSFORM_URN =
- getUrn(StandardPTransforms.Primitives.TEST_STREAM);
- public static final String MAP_WINDOWS_TRANSFORM_URN =
- getUrn(StandardPTransforms.Primitives.MAP_WINDOWS);
-
+ // We specifically copy the values here so that they can be used in switch
case statements
+ // and we validate that the value matches the actual URN in the static block
below.
+
+ // Primitives
+ public static final String PAR_DO_TRANSFORM_URN = "beam:transform:pardo:v1";
+ public static final String FLATTEN_TRANSFORM_URN =
"beam:transform:flatten:v1";
+ public static final String GROUP_BY_KEY_TRANSFORM_URN =
"beam:transform:group_by_key:v1";
+ public static final String IMPULSE_TRANSFORM_URN =
"beam:transform:impulse:v1";
+ public static final String ASSIGN_WINDOWS_TRANSFORM_URN =
"beam:transform:window_into:v1";
+ public static final String TEST_STREAM_TRANSFORM_URN =
"beam:transform:teststream:v1";
+ public static final String MAP_WINDOWS_TRANSFORM_URN =
"beam:transform:map_windows:v1";
+
+ // DeprecatedPrimitives
/**
* @deprecated SDKs should move away from creating `Read` transforms and
migrate to using Impulse
* + SplittableDoFns.
*/
- @Deprecated
- public static final String READ_TRANSFORM_URN =
- getUrn(StandardPTransforms.DeprecatedPrimitives.READ);
+ @Deprecated public static final String READ_TRANSFORM_URN =
"beam:transform:read:v1";
+
/**
* @deprecated runners should move away from translating
`CreatePCollectionView` and treat this as
* part of the translation for a `ParDo` side input.
*/
@Deprecated
- public static final String CREATE_VIEW_TRANSFORM_URN =
- getUrn(StandardPTransforms.DeprecatedPrimitives.CREATE_VIEW);
+ public static final String CREATE_VIEW_TRANSFORM_URN =
"beam:transform:create_view:v1";
- public static final String COMBINE_PER_KEY_TRANSFORM_URN =
- getUrn(StandardPTransforms.Composites.COMBINE_PER_KEY);
- public static final String COMBINE_GLOBALLY_TRANSFORM_URN =
- getUrn(StandardPTransforms.Composites.COMBINE_GLOBALLY);
- public static final String COMBINE_GROUPED_VALUES_TRANSFORM_URN =
- getUrn(CombineComponents.COMBINE_GROUPED_VALUES);
+ // Composites
+ public static final String COMBINE_PER_KEY_TRANSFORM_URN =
"beam:transform:combine_per_key:v1";
+ public static final String COMBINE_GLOBALLY_TRANSFORM_URN =
"beam:transform:combine_globally:v1";
+ public static final String RESHUFFLE_URN = "beam:transform:reshuffle:v1";
+ public static final String WRITE_FILES_TRANSFORM_URN =
"beam:transform:write_files:v1";
+
+ // CombineComponents
public static final String COMBINE_PER_KEY_PRECOMBINE_TRANSFORM_URN =
- getUrn(CombineComponents.COMBINE_PER_KEY_PRECOMBINE);
+ "beam:transform:combine_per_key_precombine:v1";
public static final String COMBINE_PER_KEY_MERGE_ACCUMULATORS_TRANSFORM_URN =
- getUrn(CombineComponents.COMBINE_PER_KEY_MERGE_ACCUMULATORS);
+ "beam:transform:combine_per_key_merge_accumulators:v1";
public static final String COMBINE_PER_KEY_EXTRACT_OUTPUTS_TRANSFORM_URN =
- getUrn(CombineComponents.COMBINE_PER_KEY_EXTRACT_OUTPUTS);
- public static final String RESHUFFLE_URN =
getUrn(StandardPTransforms.Composites.RESHUFFLE);
- public static final String WRITE_FILES_TRANSFORM_URN =
- getUrn(StandardPTransforms.Composites.WRITE_FILES);
+ "beam:transform:combine_per_key_extract_outputs:v1";
+ public static final String COMBINE_GROUPED_VALUES_TRANSFORM_URN =
+ "beam:transform:combine_grouped_values:v1";
// SplittableParDoComponents
public static final String SPLITTABLE_PAIR_WITH_RESTRICTION_URN =
- getUrn(SplittableParDoComponents.PAIR_WITH_RESTRICTION);
+ "beam:transform:sdf_pair_with_restriction:v1";
public static final String SPLITTABLE_SPLIT_RESTRICTION_URN =
- getUrn(SplittableParDoComponents.SPLIT_RESTRICTION);
+ "beam:transform:sdf_split_restriction:v1";
+ /**
+ * @deprecated runners should move away from using
`SplittableProcessKeyedElements` and prefer to
+ * internalize any necessary SplittableDoFn expansion.
+ */
+ @Deprecated
public static final String SPLITTABLE_PROCESS_KEYED_URN =
- getUrn(SplittableParDoComponents.PROCESS_KEYED_ELEMENTS);
+ "beam:transform:sdf_process_keyed_elements:v1";
+
public static final String SPLITTABLE_PROCESS_ELEMENTS_URN =
- getUrn(SplittableParDoComponents.PROCESS_ELEMENTS);
+ "beam:transform:sdf_process_elements:v1";
public static final String SPLITTABLE_SPLIT_AND_SIZE_RESTRICTIONS_URN =
- getUrn(SplittableParDoComponents.SPLIT_AND_SIZE_RESTRICTIONS);
+ "beam:transform:sdf_split_and_size_restrictions:v1";
public static final String
SPLITTABLE_PROCESS_SIZED_ELEMENTS_AND_RESTRICTIONS_URN =
-
getUrn(SplittableParDoComponents.PROCESS_SIZED_ELEMENTS_AND_RESTRICTIONS);
-
- public static final String ITERABLE_SIDE_INPUT =
- getUrn(RunnerApi.StandardSideInputTypes.Enum.ITERABLE);
- public static final String MULTIMAP_SIDE_INPUT =
- getUrn(RunnerApi.StandardSideInputTypes.Enum.MULTIMAP);
+ "beam:transform:sdf_process_sized_element_and_restrictions:v1";
+
+ static {
+
checkState(PAR_DO_TRANSFORM_URN.equals(getUrn(StandardPTransforms.Primitives.PAR_DO)));
Review comment:
I'll include that in a followup PR where I change many of the existing
getUrn calls as you suggest.
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 367582)
Time Spent: 1h (was: 50m)
> Migrate PTransformTranslation to use string constants
> -----------------------------------------------------
>
> Key: BEAM-9059
> URL: https://issues.apache.org/jira/browse/BEAM-9059
> Project: Beam
> Issue Type: Improvement
> Components: sdk-java-core
> Reporter: Luke Cwik
> Assignee: Luke Cwik
> Priority: Trivial
> Time Spent: 1h
> Remaining Estimate: 0h
>
> This allows for the values to be used within switch case statements.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)