Skip to content

Commit 3fc1656

Browse files
committed
utility
1 parent 2e0e41e commit 3fc1656

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

python/pyspark/pandas/strings.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import numpy as np
3333
import pandas as pd
3434

35+
from pyspark.pandas.utils import is_ansi_mode_enabled
3536
from pyspark.sql.types import StringType, BinaryType, ArrayType, LongType, MapType
3637
from pyspark.sql import functions as F
3738
from pyspark.sql.functions import pandas_udf
@@ -2031,8 +2032,8 @@ def pudf(s: pd.Series) -> pd.Series:
20312032
if expand:
20322033
psdf = psser.to_frame()
20332034
scol = psdf._internal.data_spark_columns[0]
2034-
2035-
if ps.get_option("compute.ansi_mode_support"):
2035+
spark_session = self._data._internal.spark_frame.sparkSession
2036+
if is_ansi_mode_enabled(spark_session):
20362037
spark_columns = [
20372038
F.try_element_at(scol, F.lit(i + 1)).alias(str(i)) for i in range(n + 1)
20382039
]
@@ -2184,7 +2185,8 @@ def pudf(s: pd.Series) -> pd.Series:
21842185
if expand:
21852186
psdf = psser.to_frame()
21862187
scol = psdf._internal.data_spark_columns[0]
2187-
if ps.get_option("compute.ansi_mode_support"):
2188+
spark_session = self._data._internal.spark_frame.sparkSession
2189+
if is_ansi_mode_enabled(spark_session):
21882190
spark_columns = [
21892191
F.try_element_at(scol, F.lit(i + 1)).alias(str(i)) for i in range(n + 1)
21902192
]

0 commit comments

Comments
 (0)