Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Namespace time_col config, fix type check for trim_with_timecontext for pandas window execution. #2680

Merged

Conversation

LeeTZ
Copy link
Contributor

@LeeTZ LeeTZ commented Mar 11, 2021

Overview

As a follow-up of #2646, add namespace timecontext for the ibis config time_col.

Also, fix a type check in trim_with_time_context for pandas window execution. The type check to check a DataFrame has a time_col column and its type is a Datetime type, will not hit by any user level APIs, removing it.

For the result series of a Groupby Transform. The result series is still using the name of the input series. We should unset it to avoid confusion. e.g. If the input series is 'time' and the result series is float but still named 'time' Then in trimming with context the series will be identified as a time column and result in an error.

Tests

Still using the tests implemented in ibis/backends/tests/test_timecontext.py, and ibis/backends/execution/pandas/test_timecontext.py


# Filter the data, here we preserve the time index so that when user is
# computing a single column, the computation and the relevant time
# indexes are returned.
time_col = get_time_col()
if time_col not in df or not is_datetime64_dtype(df[time_col]):
if time_col not in df or not is_datetime64_any_dtype(df[time_col]):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have test for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this, not hitting by any user level APIs

@@ -95,7 +95,7 @@ def test_context_adjustment_window_udf(
""" This test case aims to test context adjustment of
udfs in window method.
"""
with option_context('time_col', 'timestamp_col'):
with option_context('timecontext.time_col', 'timestamp_col'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be under a the namespace context_adjustment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about timecontext_adjustment? We have been calling this timecontext instead of context all over the place

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use context_adjustment as suggested

@LeeTZ LeeTZ changed the title ENH: Namespace time_col config, fix type check for trim_with_timecontext for pandas window execution. [WIP] ENH: Namespace time_col config, fix type check for trim_with_timecontext for pandas window execution. Mar 11, 2021
@LeeTZ LeeTZ force-pushed the tiezheng/namespace_time_context_col_name branch from 4148fb9 to c172631 Compare March 11, 2021 22:36
@LeeTZ LeeTZ force-pushed the tiezheng/namespace_time_context_col_name branch from 71116d5 to 6e36706 Compare March 12, 2021 13:46
@LeeTZ LeeTZ changed the title [WIP] ENH: Namespace time_col config, fix type check for trim_with_timecontext for pandas window execution. ENH: Namespace time_col config, fix type check for trim_with_timecontext for pandas window execution. Mar 12, 2021
Copy link
Contributor

@icexelloss icexelloss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jreback jreback added this to the Next release milestone Mar 14, 2021
@jreback jreback added the expressions Issues or PRs related to the expression API label Mar 14, 2021
@jreback jreback merged commit 92175e4 into ibis-project:master Mar 14, 2021
@jreback
Copy link
Contributor

jreback commented Mar 14, 2021

thanks @LeeTZ

@cpcloud cpcloud removed this from the Next release milestone Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expressions Issues or PRs related to the expression API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants