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

Additional operator for update_by requested #5709

Open
lbooker42 opened this issue Jul 3, 2024 · 6 comments
Open

Additional operator for update_by requested #5709

lbooker42 opened this issue Jul 3, 2024 · 6 comments
Assignees
Labels
2023_unscheduled core Core development tasks feature request New feature or request query engine
Milestone

Comments

@lbooker42
Copy link
Contributor

To support production use cases, we need the following operators (also found in #4424):

  • median
  • percentile
  • var
  • cor
  • count_neg, count_pos
  • cum_std

But also needed are the following (supported by pandas / Polars):

  • last
  • rank
  • pct_change
@lbooker42 lbooker42 added feature request New feature or request triage labels Jul 3, 2024
@lbooker42 lbooker42 self-assigned this Jul 3, 2024
@rcaudy rcaudy added this to the 4. Unscheduled milestone Jul 3, 2024
@rcaudy rcaudy added query engine core Core development tasks and removed triage labels Jul 3, 2024
@chipkent
Copy link
Member

Other count operations like count_null, count_nan, etc. would be useful.

@chipkent
Copy link
Member

As we have done in other cases, null values should be ignored, and NaN values are included -- typically resulting in poisoning.

@chipkent
Copy link
Member

I looked through Pandas docs and found a few more operations that we should really support:

@chipkent
Copy link
Member

chipkent commented Sep 9, 2024

Below is an attempt at a more comprehensive and carefully curated list.

As has been the case for other operations:

  1. null values are ignored in calculations.
  2. NaN values are included in calculations. Typically, this means that NaN poisons results, so the operator will return NaN after seeing a NaN.
  3. +0.0 and -0.0 are considered to be the same and equivalent.

Operators have a few different contexts:

  1. agg
  2. update_by cumulative
  3. update_by window / rolling

Missing cumulative operators:

New operators (singleton)

  • delta_pct (Naming seems more consistent with the existing delta than the originally proposed pct_change)

New operators (agg, cumulative, and rolling):

Don't Do Operators? (Present in agg)

These are present in agg, but they may not be worth adding to the other cases until there is demand. They need some discussion.

  • [] distinct
  • [] unique
  • [] sorted_first
  • [] sorted_last

(?) There will be some debate on if this method should be implemented because of efficiency.
(*) May involve some tricky, careful numerics to compute good values. Need to be careful in defining the calculation.
(+) Not yet implemented in Numerics.ftl
(!) There has been some discussion around these operations with @rcaudy and @chipkent . cum_first/cum_last are the same as first_by/last_by, so there is an argument to not include them. offset is proposed as a way to get a value at a specific index or time offset instead of having a first/last operator. For time offsets, there needs to be a way to disambiguate if there are multiple values with the same time offset. offset would not be supported by agg, but first and last would.

@chipkent
Copy link
Member

Details on computing skewness and excess kurtosis can be found at:

We want the sample skewness and sample excess kurtosis. The formulae used by Excel, SAS, etc. have probably been well vetted.

@chipkent
Copy link
Member

Details on computing the sample covariance can be found at:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2023_unscheduled core Core development tasks feature request New feature or request query engine
Projects
None yet
Development

No branches or pull requests

4 participants