From 33afbb2e59ae71cad6cbd47dba9ed980db88b113 Mon Sep 17 00:00:00 2001 From: Younghee Kwon Date: Fri, 30 Dec 2016 14:32:58 -0800 Subject: [PATCH] Updated ptransform.apply() to ptransform.expand() in the comments. --- sdks/python/apache_beam/transforms/core.py | 4 ++-- sdks/python/apache_beam/transforms/ptransform.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdks/python/apache_beam/transforms/core.py b/sdks/python/apache_beam/transforms/core.py index 6a7bd2e5ce28..72f7cd4e2891 100644 --- a/sdks/python/apache_beam/transforms/core.py +++ b/sdks/python/apache_beam/transforms/core.py @@ -122,7 +122,7 @@ def aggregate_to(self, aggregator, input_value): class DoFn(WithTypeHints, HasDisplayData): """A function object used by a transform with custom processing. - The ParDo transform is such a transform. The ParDo.apply + The ParDo transform is such a transform. The ParDo.expand() method will take an object of type DoFn and apply it to all elements of a PCollection object. @@ -551,7 +551,7 @@ class ParDo(PTransformWithSideInputs): returning the accumulated results into an output PCollection. The type of the elements is not fixed as long as the DoFn can deal with it. In reality the type is restrained to some extent because the elements sometimes must be - persisted to external storage. See the apply() method comments for a detailed + persisted to external storage. See the expand() method comments for a detailed description of all possible arguments. Note that the DoFn must return an iterable for each element of the input diff --git a/sdks/python/apache_beam/transforms/ptransform.py b/sdks/python/apache_beam/transforms/ptransform.py index c022c5e899db..006a9378a537 100644 --- a/sdks/python/apache_beam/transforms/ptransform.py +++ b/sdks/python/apache_beam/transforms/ptransform.py @@ -21,11 +21,11 @@ execution semantics for a transform is captured by a runner object. A transform object always belongs to a pipeline object. -A PTransform derived class needs to define the apply() method that describes +A PTransform derived class needs to define the expand() method that describes how one or more PValues are created by the transform. The module defines a few standard transforms: FlatMap (parallel do), -GroupByKey (group by key), etc. Note that the apply() methods for these +GroupByKey (group by key), etc. Note that the expand() methods for these classes contain code that will add nodes to the processing graph associated with a pipeline. @@ -172,12 +172,12 @@ def visit_dict(self, pvalueish, sibling, pairs, context): class PTransform(WithTypeHints, HasDisplayData): """A transform object used to modify one or more PCollections. - Subclasses must define an apply() method that will be used when the transform + Subclasses must define an expand() method that will be used when the transform is applied to some arguments. Typical usage pattern will be: input | CustomTransform(...) - The apply() method of the CustomTransform object passed in will be called + The expand() method of the CustomTransform object passed in will be called with input as an argument. """ # By default, transforms don't have any side inputs. @@ -683,7 +683,7 @@ def ptransform_fn(fn): A CallablePTransform instance wrapping the function-based PTransform. This wrapper provides an alternative, simpler way to define a PTransform. - The standard method is to subclass from PTransform and override the apply() + The standard method is to subclass from PTransform and override the expand() method. An equivalent effect can be obtained by defining a function that an input PCollection and additional optional arguments and returns a resulting PCollection. For example:: @@ -739,4 +739,4 @@ def __ror__(self, pvalueish): return self.transform.__ror__(pvalueish, self.label) def expand(self, pvalue): - raise RuntimeError("Should never be applied directly.") + raise RuntimeError("Should never be expanded directly.")