From 7d24c4530c4168da4f4eeec0dc04a4b96353d42b Mon Sep 17 00:00:00 2001 From: ChampChamp Date: Sun, 12 Apr 2026 02:22:36 +0900 Subject: [PATCH] Fix #4111: lower() returns correct string type --- src/snowflake/snowpark/mock/_plan.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/snowflake/snowpark/mock/_plan.py b/src/snowflake/snowpark/mock/_plan.py index f794f4f72f..debcaf7e02 100644 --- a/src/snowflake/snowpark/mock/_plan.py +++ b/src/snowflake/snowpark/mock/_plan.py @@ -2971,10 +2971,14 @@ def get_bound(bound): return res elif isinstance(exp, SubfieldInt): col = calculate_expression(exp.child, input_data, analyzer, expr_to_alias) - res = col.apply( - lambda x: None if x is None or exp.field >= len(x) else x[exp.field] - ) - res.sf_type = ColumnType(VariantType(), col.sf_type.nullable) + result_data = [ + None if x is None or exp.field >= len(x) else x[exp.field] for x in col + ] + res = ColumnEmulator( + data=result_data, + dtype=object, + sf_type=ColumnType(VariantType(), col.sf_type.nullable), + ) # dtype=object prevents implicit converting None to NaN return res elif isinstance(exp, SnowflakeUDF): # Could be either UDAF or UDF, decide on type.