-
Notifications
You must be signed in to change notification settings - Fork 122
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: support more scalar operations for duckdb, Increase width for ipython #1877
feat: support more scalar operations for duckdb, Increase width for ipython #1877
Conversation
terminal_width = 80 | ||
terminal_width = int(os.getenv("COLUMNS", 80)) # noqa: PLW1508 | ||
native_lines = native_repr.splitlines() | ||
max_native_width = max(len(line) for line in native_lines) | ||
|
||
if max_native_width + 2 < terminal_width: | ||
if max_native_width + 2 <= terminal_width: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-by, but i noticed that on kaggle notebooks os.get_terminal_size()
raises, but COLUMNS
is set to 100. COLUMNS
seems to be the IPython standard
uurghh gonna have to come back to this |
π€ we might need |
just jotting down some thoughts:
n-ary operation between expressions:
select:
with_columns:
|
DUCKDB_SKIPS = ["q14", "q15"] | ||
DUCKDB_SKIPS = ["q15"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just one left!
π₯³
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# it means that it was a scalar (e.g. nw.col('a') + 1), and so we default | ||
# to `True`. | ||
return lhs._returns_scalar and getattr(rhs, "_returns_scalar", True) | ||
def n_ary_operation_expr_kind(*args: DuckDBExpr | Any) -> ExprKind: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one!
narwhals/_duckdb/utils.py
Outdated
class ExprKind(Enum): | ||
LITERAL = auto() # e.g. nw.lit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth adding a tiny docstring and describe interaction between values:
class ExprKind(Enum): | |
LITERAL = auto() # e.g. nw.lit(1) | |
class ExprKind(Enum): | |
"""Describe which kind of expression we are dealing with. | |
Composition rule is: | |
- LITERAL & LITERAL -> LITERAL | |
- TRANSFORM & X -> TRANSFORM | |
- X & TRANSFORM -> TRANSFORM | |
- all remaining cases -> AGGREGATION | |
""" | |
LITERAL = auto() # e.g. nw.lit(1) |
thanks for your review! |
Very similar to the recent PySpark PR #1870
What type of PR is this? (check all applicable)
Related issues
Checklist
If you have comments or can explain your changes, please do so below