Skip to content

Commit 9a544e8

Browse files
committed
wip operator: more comments, going back to reading
1 parent 3a97dcb commit 9a544e8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

narwhals/_sql/expr.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@
2828
from narwhals._sql.namespace import SQLNamespace
2929
from narwhals.typing import NumericLiteral, PythonLiteral, RankMethod, TemporalLiteral
3030

31-
32-
class SQLExpr(LazyExpr[SQLLazyFrameT, NativeExprT], Protocol[SQLLazyFrameT, NativeExprT]):
33-
_call: EvalSeries[SQLLazyFrameT, NativeExprT]
31+
# am I right in thinking we need to pass NativeSQLExprT here, not NativeExprT? since NativeSQLExprT
32+
# inherits from it, I can use that througout in the code and it will also have its parents functionality.
33+
# though at the moment there are still problems with the class..
34+
class SQLExpr(LazyExpr[SQLLazyFrameT, NativeSQLExprT], Protocol[SQLLazyFrameT, NativeSQLExprT]):
35+
_call: EvalSeries[SQLLazyFrameT, NativeSQLExprT]
3436
_evaluate_output_names: EvalNames[SQLLazyFrameT]
3537
_alias_output_names: AliasNames | None
3638
_version: Version
3739
_implementation: Implementation
3840
_metadata: ExprMetadata | None
39-
_window_function: WindowFunction[SQLLazyFrameT, NativeExprT] | None
41+
_window_function: WindowFunction[SQLLazyFrameT, NativeSQLExprT] | None
4042

4143
def __init__(
4244
self,

narwhals/_sql/typing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ def __mul__(self, value: Self) -> Self: ...
3535
# TODO: @mp, understand why these are here & if we need one for NativeSQLExprT;
3636
# seem to reflect number of different 'catgories' each of the parent class has
3737
# tbc! since NativeExpr only has Protocol, I don't think we need this for NativeSQLExpr
38+
# NativeSQLExpr isn't accepting Any arguments :) I need to go back to the reading on
39+
# cov-, contra- & invariance
3840
SQLExprAny = SQLExpr[Any, Any]
3941
SQLLazyFrameAny = SQLLazyFrame[Any, Any, Any]
42+
NativeSQLExprAny = NativeSQLExpr
4043

4144
SQLExprT = TypeVar("SQLExprT", bound="SQLExprAny")
4245
SQLExprT_contra = TypeVar("SQLExprT_contra", bound="SQLExprAny", contravariant=True)

0 commit comments

Comments
 (0)