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

Added columns as case values #872

Merged
merged 4 commits into from
Jan 31, 2025
Merged

Conversation

ilongin
Copy link
Contributor

@ilongin ilongin commented Jan 28, 2025

Up until now we only allowed python primitives as case values like str, int, float ...
With this PR we will allow columns as well (note that this also adds ability for columns as outcomes in ifelse as it uses case under the hood ), e.g

# case example
res = dc.mutate(test=case((C("num") < 3, C("val")), else_="default"))

# ifelse example
res = dc.mutate(test=ifelse(C("num") < 3, C("val"), "default"))

@ilongin ilongin marked this pull request as draft January 28, 2025 15:34
@ilongin ilongin linked an issue Jan 28, 2025 that may be closed by this pull request
Copy link

cloudflare-workers-and-pages bot commented Jan 28, 2025

Deploying datachain-documentation with  Cloudflare Pages  Cloudflare Pages

Latest commit: fbf1ee1
Status: ✅  Deploy successful!
Preview URL: https://f84dd2f5.datachain-documentation.pages.dev
Branch Preview URL: https://ilongin-871-columns-as-case.datachain-documentation.pages.dev

View logs

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.65%. Comparing base (143b4be) to head (fbf1ee1).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #872      +/-   ##
==========================================
- Coverage   87.65%   87.65%   -0.01%     
==========================================
  Files         128      128              
  Lines       11457    11461       +4     
  Branches     1544     1546       +2     
==========================================
+ Hits        10043    10046       +3     
- Misses       1026     1027       +1     
  Partials      388      388              
Flag Coverage Δ
datachain 87.57% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ilongin ilongin marked this pull request as ready for review January 29, 2025 01:22
@ilongin ilongin requested a review from amritghimire January 29, 2025 09:08
@ilongin ilongin requested a review from dmpetrov January 30, 2025 18:08
Copy link
Contributor

@dreadatour dreadatour left a comment

Choose a reason for hiding this comment

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

❤️

@ilongin ilongin merged commit 9084dae into main Jan 31, 2025
37 checks passed
@ilongin ilongin deleted the ilongin/871-columns-as-case-values branch January 31, 2025 05:12
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.

Allow columns as values in case function
3 participants