File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
duckdb/experimental/spark/sql Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 77if TYPE_CHECKING :
88 from ._typing import DateTimeLiteral , DecimalLiteral , LiteralType
99
10- from duckdb import ConstantExpression , Expression , FunctionExpression
10+ from duckdb import ColumnExpression , ConstantExpression , Expression , FunctionExpression
1111from duckdb .sqltypes import DuckDBPyType
1212
1313__all__ = ["Column" ]
@@ -173,11 +173,9 @@ def __getitem__(self, k: Any) -> "Column": # noqa: ANN401
173173 # raise ValueError("Using a slice with a step value is not supported")
174174 # return self.substr(k.start, k.stop)
175175 else :
176- # Use struct_extract for proper struct field access
177- from duckdb import ConstantExpression , FunctionExpression
178-
179- field_name_expr = ConstantExpression (str (k ))
180- return Column (FunctionExpression ("struct_extract" , self .expr , field_name_expr ))
176+ # TODO: this is super hacky # noqa: TD002, TD003
177+ expr_str = str (self .expr ) + "." + str (k )
178+ return Column (ColumnExpression (expr_str ))
181179
182180 def __getattr__ (self , item : Any ) -> "Column" : # noqa: ANN401
183181 """An expression that gets an item at position ``ordinal`` out of a list,
You can’t perform that action at this time.
0 commit comments