robertwb commented on a change in pull request #11766:
URL: https://github.com/apache/beam/pull/11766#discussion_r434214501



##########
File path: sdks/python/apache_beam/dataframe/partitionings.py
##########
@@ -0,0 +1,133 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from __future__ import absolute_import
+
+from typing import Any
+from typing import Iterable
+from typing import TypeVar
+
+import pandas as pd
+
+Frame = TypeVar('Frame', bound=pd.core.generic.NDFrame)
+
+
+class Partitioning(object):
+  """A class representing a (consistent) partitioning of dataframe objects.
+  """
+  def is_subpartition_of(self, other):
+    # type: (Partitioning) -> bool
+
+    """Returns whether self is a sub-partition of other.
+
+    Specifically, returns whether something partitioned by self is necissarily
+    also partitioned by other.
+    """
+    raise NotImplementedError
+
+  def partition_fn(self, df):
+    # type: (Frame) -> Iterable[Tuple[Any, Frame]]
+
+    """A callable that actually performs the partitioning of a Frame df.
+
+    This will be invoked via a FlatMap in conjunction with a GroupKey to
+    achieve the desired partitioning.
+    """
+    raise NotImplementedError
+
+
+class Index(Partitioning):
+  """A partitioning by index (either fully or partially).
+
+  If the set of "levels" of the index to consider is not specified, the entire
+  index is used.
+
+  These form a partial order, given by
+
+      Nothing() < Index([i]) < Index([i, j]) < ... < Index() < Singleton()
+  """
+
+  _INDEX_PARTITIONS = 100

Review comment:
       Oh, I was just testing things. I'll change it back. (It would be great 
to get rid of this altogether, as it limits parallelism, but that's not part of 
this change.)




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to