Skip to content

Commit ec14391

Browse files
Merge branch 'main' into helmeleegy-SNOW-2391351
2 parents 52d4c11 + 905bf84 commit ec14391

File tree

3 files changed

+347
-0
lines changed

3 files changed

+347
-0
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@
7373
- `str.lstrip`
7474
- `str.rstrip`
7575
- `str.translate`
76+
- `dt.tz_localize`
77+
- `dt.tz_convert`
78+
- `dt.ceil`
79+
- `dt.round`
80+
- `dt.floor`
81+
- `dt.normalize`
82+
- `dt.month_name`
83+
- `dt.day_name`
84+
- `dt.strftime`
7685
- Make faster pandas disabled by default (opt-in instead of opt-out).
7786
- Improve performance of `drop_duplicates` by avoiding joins when `keep!=False` in faster pandas.
7887

src/snowflake/snowpark/modin/plugin/compiler/snowflake_query_compiler.py

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21280,6 +21280,34 @@ def dt_tz_localize(
2128021280
ambiguous: str = "raise",
2128121281
nonexistent: str = "raise",
2128221282
include_index: bool = False,
21283+
) -> "SnowflakeQueryCompiler":
21284+
"""
21285+
Wrapper around _dt_tz_localize_internal to be supported in faster pandas.
21286+
"""
21287+
relaxed_query_compiler = None
21288+
if self._relaxed_query_compiler is not None:
21289+
relaxed_query_compiler = (
21290+
self._relaxed_query_compiler._dt_tz_localize_internal(
21291+
tz=tz,
21292+
ambiguous=ambiguous,
21293+
nonexistent=nonexistent,
21294+
include_index=include_index,
21295+
)
21296+
)
21297+
qc = self._dt_tz_localize_internal(
21298+
tz=tz,
21299+
ambiguous=ambiguous,
21300+
nonexistent=nonexistent,
21301+
include_index=include_index,
21302+
)
21303+
return self._maybe_set_relaxed_qc(qc, relaxed_query_compiler)
21304+
21305+
def _dt_tz_localize_internal(
21306+
self,
21307+
tz: Union[str, tzinfo],
21308+
ambiguous: str = "raise",
21309+
nonexistent: str = "raise",
21310+
include_index: bool = False,
2128321311
) -> "SnowflakeQueryCompiler":
2128421312
"""
2128521313
Localize tz-naive to tz-aware.
@@ -21320,6 +21348,28 @@ def dt_tz_convert(
2132021348
self,
2132121349
tz: Union[str, tzinfo],
2132221350
include_index: bool = False,
21351+
) -> "SnowflakeQueryCompiler":
21352+
"""
21353+
Wrapper around _dt_tz_convert_internal to be supported in faster pandas.
21354+
"""
21355+
relaxed_query_compiler = None
21356+
if self._relaxed_query_compiler is not None:
21357+
relaxed_query_compiler = (
21358+
self._relaxed_query_compiler._dt_tz_convert_internal(
21359+
tz=tz,
21360+
include_index=include_index,
21361+
)
21362+
)
21363+
qc = self._dt_tz_convert_internal(
21364+
tz=tz,
21365+
include_index=include_index,
21366+
)
21367+
return self._maybe_set_relaxed_qc(qc, relaxed_query_compiler)
21368+
21369+
def _dt_tz_convert_internal(
21370+
self,
21371+
tz: Union[str, tzinfo],
21372+
include_index: bool = False,
2132321373
) -> "SnowflakeQueryCompiler":
2132421374
"""
2132521375
Convert time-series data to the specified time zone.
@@ -21353,6 +21403,32 @@ def dt_ceil(
2135321403
ambiguous: str = "raise",
2135421404
nonexistent: str = "raise",
2135521405
include_index: bool = False,
21406+
) -> "SnowflakeQueryCompiler":
21407+
"""
21408+
Wrapper around _dt_ceil_internal to be supported in faster pandas.
21409+
"""
21410+
relaxed_query_compiler = None
21411+
if self._relaxed_query_compiler is not None:
21412+
relaxed_query_compiler = self._relaxed_query_compiler._dt_ceil_internal(
21413+
freq=freq,
21414+
ambiguous=ambiguous,
21415+
nonexistent=nonexistent,
21416+
include_index=include_index,
21417+
)
21418+
qc = self._dt_ceil_internal(
21419+
freq=freq,
21420+
ambiguous=ambiguous,
21421+
nonexistent=nonexistent,
21422+
include_index=include_index,
21423+
)
21424+
return self._maybe_set_relaxed_qc(qc, relaxed_query_compiler)
21425+
21426+
def _dt_ceil_internal(
21427+
self,
21428+
freq: Frequency,
21429+
ambiguous: str = "raise",
21430+
nonexistent: str = "raise",
21431+
include_index: bool = False,
2135621432
) -> "SnowflakeQueryCompiler":
2135721433
"""
2135821434
Args:
@@ -21436,6 +21512,32 @@ def dt_round(
2143621512
ambiguous: str = "raise",
2143721513
nonexistent: str = "raise",
2143821514
include_index: bool = False,
21515+
) -> "SnowflakeQueryCompiler":
21516+
"""
21517+
Wrapper around _dt_round_internal to be supported in faster pandas.
21518+
"""
21519+
relaxed_query_compiler = None
21520+
if self._relaxed_query_compiler is not None:
21521+
relaxed_query_compiler = self._relaxed_query_compiler._dt_round_internal(
21522+
freq=freq,
21523+
ambiguous=ambiguous,
21524+
nonexistent=nonexistent,
21525+
include_index=include_index,
21526+
)
21527+
qc = self._dt_round_internal(
21528+
freq=freq,
21529+
ambiguous=ambiguous,
21530+
nonexistent=nonexistent,
21531+
include_index=include_index,
21532+
)
21533+
return self._maybe_set_relaxed_qc(qc, relaxed_query_compiler)
21534+
21535+
def _dt_round_internal(
21536+
self,
21537+
freq: Frequency,
21538+
ambiguous: str = "raise",
21539+
nonexistent: str = "raise",
21540+
include_index: bool = False,
2143921541
) -> "SnowflakeQueryCompiler":
2144021542
"""
2144121543
Args:
@@ -21597,6 +21699,32 @@ def dt_floor(
2159721699
ambiguous: str = "raise",
2159821700
nonexistent: str = "raise",
2159921701
include_index: bool = False,
21702+
) -> "SnowflakeQueryCompiler":
21703+
"""
21704+
Wrapper around _dt_floor_internal to be supported in faster pandas.
21705+
"""
21706+
relaxed_query_compiler = None
21707+
if self._relaxed_query_compiler is not None:
21708+
relaxed_query_compiler = self._relaxed_query_compiler._dt_floor_internal(
21709+
freq=freq,
21710+
ambiguous=ambiguous,
21711+
nonexistent=nonexistent,
21712+
include_index=include_index,
21713+
)
21714+
qc = self._dt_floor_internal(
21715+
freq=freq,
21716+
ambiguous=ambiguous,
21717+
nonexistent=nonexistent,
21718+
include_index=include_index,
21719+
)
21720+
return self._maybe_set_relaxed_qc(qc, relaxed_query_compiler)
21721+
21722+
def _dt_floor_internal(
21723+
self,
21724+
freq: Frequency,
21725+
ambiguous: str = "raise",
21726+
nonexistent: str = "raise",
21727+
include_index: bool = False,
2160021728
) -> "SnowflakeQueryCompiler":
2160121729
"""
2160221730
Args:
@@ -21667,6 +21795,22 @@ def floor_func(column: SnowparkColumn) -> SnowparkColumn:
2166721795
)
2166821796

2166921797
def dt_normalize(self, include_index: bool = False) -> "SnowflakeQueryCompiler":
21798+
"""
21799+
Wrapper around _dt_normalize_internal to be supported in faster pandas.
21800+
"""
21801+
relaxed_query_compiler = None
21802+
if self._relaxed_query_compiler is not None:
21803+
relaxed_query_compiler = (
21804+
self._relaxed_query_compiler._dt_normalize_internal(
21805+
include_index=include_index
21806+
)
21807+
)
21808+
qc = self._dt_normalize_internal(include_index=include_index)
21809+
return self._maybe_set_relaxed_qc(qc, relaxed_query_compiler)
21810+
21811+
def _dt_normalize_internal(
21812+
self, include_index: bool = False
21813+
) -> "SnowflakeQueryCompiler":
2167021814
"""
2167121815
Set the time component of each date-time value to midnight.
2167221816

@@ -21691,6 +21835,26 @@ def normalize_column(column: SnowparkColumn) -> SnowparkColumn:
2169121835

2169221836
def dt_month_name(
2169321837
self, locale: Optional[str] = None, include_index: bool = False
21838+
) -> "SnowflakeQueryCompiler":
21839+
"""
21840+
Wrapper around _dt_month_name_internal to be supported in faster pandas.
21841+
"""
21842+
relaxed_query_compiler = None
21843+
if self._relaxed_query_compiler is not None:
21844+
relaxed_query_compiler = (
21845+
self._relaxed_query_compiler._dt_month_name_internal(
21846+
locale=locale,
21847+
include_index=include_index,
21848+
)
21849+
)
21850+
qc = self._dt_month_name_internal(
21851+
locale=locale,
21852+
include_index=include_index,
21853+
)
21854+
return self._maybe_set_relaxed_qc(qc, relaxed_query_compiler)
21855+
21856+
def _dt_month_name_internal(
21857+
self, locale: Optional[str] = None, include_index: bool = False
2169421858
) -> "SnowflakeQueryCompiler":
2169521859
"""
2169621860
Args:
@@ -21725,6 +21889,24 @@ def month_name_func(column: SnowparkColumn) -> SnowparkColumn:
2172521889

2172621890
def dt_day_name(
2172721891
self, locale: Optional[str] = None, include_index: bool = False
21892+
) -> "SnowflakeQueryCompiler":
21893+
"""
21894+
Wrapper around _dt_day_name_internal to be supported in faster pandas.
21895+
"""
21896+
relaxed_query_compiler = None
21897+
if self._relaxed_query_compiler is not None:
21898+
relaxed_query_compiler = self._relaxed_query_compiler._dt_day_name_internal(
21899+
locale=locale,
21900+
include_index=include_index,
21901+
)
21902+
qc = self._dt_day_name_internal(
21903+
locale=locale,
21904+
include_index=include_index,
21905+
)
21906+
return self._maybe_set_relaxed_qc(qc, relaxed_query_compiler)
21907+
21908+
def _dt_day_name_internal(
21909+
self, locale: Optional[str] = None, include_index: bool = False
2172821910
) -> "SnowflakeQueryCompiler":
2172921911
"""
2173021912
Args:
@@ -21780,6 +21962,18 @@ def dt_total_seconds(self, include_index: bool = False) -> "SnowflakeQueryCompil
2178021962
)
2178121963

2178221964
def dt_strftime(self, date_format: str) -> "SnowflakeQueryCompiler":
21965+
"""
21966+
Wrapper around _dt_strftime_internal to be supported in faster pandas.
21967+
"""
21968+
relaxed_query_compiler = None
21969+
if self._relaxed_query_compiler is not None:
21970+
relaxed_query_compiler = self._relaxed_query_compiler._dt_strftime_internal(
21971+
date_format=date_format
21972+
)
21973+
qc = self._dt_strftime_internal(date_format=date_format)
21974+
return self._maybe_set_relaxed_qc(qc, relaxed_query_compiler)
21975+
21976+
def _dt_strftime_internal(self, date_format: str) -> "SnowflakeQueryCompiler":
2178321977
"""
2178421978
Format underlying date-time data using specified format.
2178521979

0 commit comments

Comments
 (0)