|
2 | 2 | # Copyright (c) 2012-2025 Snowflake Computing Inc. All rights reserved. |
3 | 3 | # |
4 | 4 |
|
5 | | -# |
6 | | -# Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved. |
7 | | -# |
8 | | - |
9 | 5 | import logging |
10 | 6 | import re |
11 | 7 | from typing import Any, Optional, Iterable, List, Union, Dict, Tuple, Callable |
|
16 | 12 |
|
17 | 13 | from google.protobuf.json_format import MessageToDict |
18 | 14 |
|
19 | | -from build.lib.snowflake.snowpark.functions import call_table_function |
20 | | -from build.lib.snowflake.snowpark.relational_grouped_dataframe import GroupingSets |
| 15 | +from snowflake.snowpark.relational_grouped_dataframe import GroupingSets |
21 | 16 | from snowflake.snowpark import Session, Column, DataFrameAnalyticsFunctions |
22 | 17 | import snowflake.snowpark.functions |
23 | | -from snowflake.snowpark.functions import udf, when, sproc |
| 18 | +from snowflake.snowpark.functions import udf, when, sproc, call_table_function |
24 | 19 | from snowflake.snowpark.types import ( |
25 | 20 | DataType, |
26 | 21 | ArrayType, |
@@ -718,6 +713,9 @@ def decode_expr(self, expr: proto.Expr, **kwargs) -> Any: |
718 | 713 | for kv in expr.seq_map_val.kvs |
719 | 714 | } |
720 | 715 |
|
| 716 | + case "sp_datatype_val": |
| 717 | + return self.decode_data_type_expr(expr.sp_datatype_val.datatype) |
| 718 | + |
721 | 719 | case "tuple_val": |
722 | 720 | # vs can be a list of Expr, a single Expr, or (). |
723 | 721 | if hasattr(expr.tuple_val, "vs"): |
@@ -845,7 +843,13 @@ def decode_expr(self, expr: proto.Expr, **kwargs) -> Any: |
845 | 843 | return col.is_null() |
846 | 844 |
|
847 | 845 | case "sp_column_sql_expr": |
848 | | - return expr.sp_column_sql_expr.sql |
| 846 | + sql_expr = expr.sp_column_sql_expr.sql |
| 847 | + # Need to explicitly specify col("*") because of the way sql_expr AST is encoded. |
| 848 | + return ( |
| 849 | + snowflake.snowpark.functions.col(sql_expr) |
| 850 | + if sql_expr == "*" |
| 851 | + else sql_expr |
| 852 | + ) |
849 | 853 |
|
850 | 854 | case "sp_column_string_like": |
851 | 855 | col = self.decode_expr(expr.sp_column_string_like.col) |
|
0 commit comments