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

feat: implement n_unique for DuckDB #1762

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

MarcoGorelli
Copy link
Member

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

  • Related issue #<issue number>
  • Closes #<issue number>

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

@MarcoGorelli MarcoGorelli marked this pull request as ready for review January 8, 2025 13:54
Comment on lines +418 to +425
return FunctionExpression(
"array_unique", FunctionExpression("array_agg", _input)
) + FunctionExpression(
"max",
CaseExpression(
condition=_input.isnotnull(), value=ConstantExpression(0)
).otherwise(ConstantExpression(1)),
)
Copy link
Member

Choose a reason for hiding this comment

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

Wonderful! I think we can reuse this trick for spark πŸš€

Copy link
Member

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

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

Commented but didn't approve! So here you go πŸš€

NarwhalOtterGIF

@MarcoGorelli MarcoGorelli merged commit 36dacf9 into narwhals-dev:main Jan 9, 2025
23 checks passed
@MarcoGorelli MarcoGorelli added the enhancement New feature or request label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants