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

Initial offset design ideas #12015

Draft
wants to merge 14 commits into
base: develop
Choose a base branch
from
Draft

Initial offset design ideas #12015

wants to merge 14 commits into from

Conversation

AdRiley
Copy link
Member

@AdRiley AdRiley commented Jan 7, 2025

Pull Request Description

Column.Offset takes a number n and a mode of what to do with the missing values.

Defaults to n of -1 and ..Nothing for the missing values

image

Can also use closest value

image

Or wrap the values around

image

Or enter a constant value

image

This can then be used in an expression

image

Table.Offset

image

Questions:

  • Do we copy the columns or offset on top of the existing columns? (I think copy to allow easier month by month comparisons for example)
  • If we copy what are the names of the new columns?
  • Do we offer the ability to customise the new names?

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@radeusgd
Copy link
Member

radeusgd commented Jan 9, 2025

  • Do we offer the ability to customise the new names?

What if Table.offset only allows one input column, not many? Then it could have an optional argument new_name, working much like in Table.set.

Or do we expect to be setting offsets of many columns at once often? If yes, perhaps we could have something like name_suffix?

@jdunkerley
Copy link
Member

jdunkerley commented Jan 9, 2025

Column design looks great - Closest_Value meanss Previous if negative, Next if positive.

We could have set mode for it:

  • Add (default): offset([xx],shift) as new name
  • Update - replace existing column

I would keep the customization on names to use rename_columns.

We should let it work on multiple columns at once as that is useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants