File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 2626_use_structured_type_semantics = False
2727_use_structured_type_semantics_lock = threading .RLock ()
2828
29+ # This is an internal-only global flag, used to determine whether the api is called from snowflake.snowpark_connect
30+ _is_called_from_snowpark_connect = False
31+
2932
3033def _should_use_structured_type_semantics ():
3134 global _use_structured_type_semantics
Original file line number Diff line number Diff line change 66import inspect
77
88import snowflake .snowpark ._internal .proto .generated .ast_pb2 as proto
9+ import snowflake .snowpark .context as context
910from snowflake .connector .options import pandas
1011from snowflake .snowpark ._internal .analyzer .analyzer_utils import unquote_if_quoted
1112from snowflake .snowpark import functions
@@ -329,7 +330,6 @@ def apply_in_pandas(
329330 func : Callable ,
330331 output_schema : StructType ,
331332 _emit_ast : bool = True ,
332- _is_called_from_snowpark_connect = False ,
333333 ** kwargs ,
334334 ) -> DataFrame :
335335 """Maps each grouped dataframe in to a pandas.DataFrame, applies the given function on
@@ -409,7 +409,10 @@ def apply_in_pandas(
409409 # this is the case where this is being called from spark
410410 # this is not handleing nested column access, it is assuming that the access in the function is not nested
411411 original_columns : List [str ] | None = None
412- if _is_called_from_snowpark_connect and self ._dataframe ._column_map is not None :
412+ if (
413+ context ._is_called_from_snowpark_connect
414+ and self ._dataframe ._column_map is not None
415+ ):
413416 original_columns = [
414417 column .spark_name for column in self ._dataframe ._column_map .columns
415418 ]
You can’t perform that action at this time.
0 commit comments