Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdks/python/apache_beam/transforms/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions sdks/python/apache_beam/transforms/ptransform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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::
Expand Down Expand Up @@ -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.")