[
https://issues.apache.org/jira/browse/BEAM-9547?focusedWorklogId=610852&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-610852
]
ASF GitHub Bot logged work on BEAM-9547:
----------------------------------------
Author: ASF GitHub Bot
Created on: 14/Jun/21 19:07
Start Date: 14/Jun/21 19:07
Worklog Time Spent: 10m
Work Description: kennknowles commented on a change in pull request
#14992:
URL: https://github.com/apache/beam/pull/14992#discussion_r651203658
##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -3210,17 +3230,15 @@ class _DeferredGroupByCols(frame_base.DeferredFrame):
diff = frame_base._elementwise_method('diff', base=DataFrameGroupBy)
fillna = frame_base._elementwise_method('fillna', base=DataFrameGroupBy)
filter = frame_base._elementwise_method('filter', base=DataFrameGroupBy)
- first = frame_base.wont_implement_method(
- DataFrameGroupBy, 'first', reason="order-sensitive")
+ first = frame_base._elementwise_method('first', base=DataFrameGroupBy)
Review comment:
Putting it here cause it to do a `first` globally?
##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -253,6 +253,36 @@ def fillna(self, value, method, axis, limit, **kwargs):
backfill = _fillna_alias('backfill')
pad = _fillna_alias('pad')
+ @frame_base.with_docs_from(pd.DataFrame)
+ def first(self, offset):
+ per_partition = expressions.ComputedExpression(
+ 'first-per-partition',
+ lambda df: df.sort_index().first(offset=offset), [self._expr],
+ preserves_partition_by=partitionings.Arbitrary(),
+ requires_partition_by=partitionings.Arbitrary())
+ with expressions.allow_non_parallel_operations(True):
+ return frame_base.DeferredFrame.wrap(
+ expressions.ComputedExpression(
+ 'first',
+ lambda df: df.sort_index().first(offset=offset), [per_partition],
+ preserves_partition_by=partitionings.Arbitrary(),
+ requires_partition_by=partitionings.Singleton()))
Review comment:
This is the bit that causes it to feed in the whole dataframe to the
DoFn at once?
##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -253,6 +253,36 @@ def fillna(self, value, method, axis, limit, **kwargs):
backfill = _fillna_alias('backfill')
pad = _fillna_alias('pad')
+ @frame_base.with_docs_from(pd.DataFrame)
+ def first(self, offset):
+ per_partition = expressions.ComputedExpression(
+ 'first-per-partition',
+ lambda df: df.sort_index().first(offset=offset), [self._expr],
+ preserves_partition_by=partitionings.Arbitrary(),
Review comment:
Assuming this means that it preserves no partitioning?
##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -3037,10 +3059,8 @@ def do_partition_apply(df):
tail = frame_base.wont_implement_method(
DataFrameGroupBy, 'tail', explanation=_PEEK_METHOD_EXPLANATION)
- first = frame_base.wont_implement_method(
- DataFrameGroupBy, 'first', reason='order-sensitive')
- last = frame_base.wont_implement_method(
- DataFrameGroupBy, 'last', reason='order-sensitive')
+ first = frame_base.not_implemented_method('first')
Review comment:
What's the difference here? I was looking at adjacent lines to see if
there were any analogous functions, to understand at a high level, but I don't
see any.
--
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: 610852)
Time Spent: 126h (was: 125h 50m)
> Implement all pandas operations (or raise WontImplementError)
> -------------------------------------------------------------
>
> Key: BEAM-9547
> URL: https://issues.apache.org/jira/browse/BEAM-9547
> Project: Beam
> Issue Type: Improvement
> Components: sdk-py-core
> Reporter: Brian Hulette
> Assignee: Robert Bradshaw
> Priority: P2
> Labels: dataframe-api
> Time Spent: 126h
> Remaining Estimate: 0h
>
> We should have an implementation for every DataFrame, Series, and GroupBy
> method. Everything that's not possible to implement should get a default
> implementation that raises WontImplementError
> SeeĀ https://github.com/apache/beam/pull/10757#discussion_r389132292
> Progress at the individual operation level is tracked in a
> [spreadsheet|https://docs.google.com/spreadsheets/d/1hHAaJ0n0k2tw465ORs5tfdy4Lg0DnGWIQ53cLjAhel0/edit],
> consider requesting edit access if you'd like to help out.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)