blob: 03e6d714c3b270cec805ccac665253cfe9cbb083 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from sqlframe.base.column import Column
from narwhals._spark_like.expr import SparkLikeExpr
class SparkLikeExprStructNamespace:
def __init__(self, expr: SparkLikeExpr) -> None:
self._compliant_expr = expr
def field(self, name: str) -> SparkLikeExpr:
def func(expr: Column) -> Column:
return expr.getField(name)
return self._compliant_expr._with_callable(func).alias(name)
|