Skip to content

Commit 17a41a9

Browse files
committed
fix unit tests
1 parent 71ff340 commit 17a41a9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

bigframes/core/compile/sqlglot/expressions/datetime_ops.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def _integer_label_to_datetime_op_fixed_frequency(
470470
from microseconds (us) to days.
471471
"""
472472
us = op.freq.nanos / 1000
473-
first = _calculate_resample_first(y, op.origin) # type: ignore
473+
first = _calculate_resample_first(y, op.origin) # type: ignore
474474
x_label = sge.Cast(
475475
this=sge.func(
476476
"TIMESTAMP_MICROS",
@@ -487,7 +487,7 @@ def _integer_label_to_datetime_op_fixed_frequency(
487487
to=sge.DataType.build("INT64"),
488488
),
489489
),
490-
to=_dtype_to_sql_string(y.dtype), # type: ignore
490+
to=_dtype_to_sql_string(y.dtype), # type: ignore
491491
)
492492
return x_label
493493

@@ -536,12 +536,12 @@ def _integer_label_to_datetime_op_non_fixed_frequency(
536536
to=sge.DataType.build("INT64"),
537537
),
538538
),
539-
to=_dtype_to_sql_string(y.dtype), # type: ignore
539+
to=_dtype_to_sql_string(y.dtype), # type: ignore
540540
)
541-
elif rule_code == "ME": # Monthly
541+
elif rule_code in ("ME", "M"): # Monthly
542542
one = sge.convert(1)
543543
twelve = sge.convert(12)
544-
first = sge.Sub( # type: ignore
544+
first = sge.Sub( # type: ignore
545545
this=sge.Add(
546546
this=sge.Mul(
547547
this=sge.Extract(this="YEAR", expression=y.expr),
@@ -594,12 +594,12 @@ def _integer_label_to_datetime_op_non_fixed_frequency(
594594
x_label = sge.Sub( # type: ignore
595595
this=next_month_date, expression=sge.Interval(this=one, unit="DAY")
596596
)
597-
elif rule_code == "QE-DEC": # Quarterly
597+
elif rule_code in ("QE-DEC", "Q-DEC"): # Quarterly
598598
one = sge.convert(1)
599599
three = sge.convert(3)
600600
four = sge.convert(4)
601601
twelve = sge.convert(12)
602-
first = sge.Sub( # type: ignore
602+
first = sge.Sub( # type: ignore
603603
this=sge.Add(
604604
this=sge.Mul(
605605
this=sge.Extract(this="YEAR", expression=y.expr),
@@ -616,7 +616,7 @@ def _integer_label_to_datetime_op_non_fixed_frequency(
616616
this=sge.Floor(this=sge.func("IEEE_DIVIDE", x_val, four)),
617617
to=sge.DataType.build("INT64"),
618618
)
619-
month = sge.Mul( # type: ignore
619+
month = sge.Mul( # type: ignore
620620
this=sge.Paren(
621621
this=sge.Add(this=sge.Mod(this=x_val, expression=four), expression=one)
622622
),
@@ -649,13 +649,13 @@ def _integer_label_to_datetime_op_non_fixed_frequency(
649649
x_label = sge.Sub( # type: ignore
650650
this=next_month_date, expression=sge.Interval(this=one, unit="DAY")
651651
)
652-
elif rule_code == "YE-DEC": # Yearly
652+
elif rule_code in ("YE-DEC", "A-DEC", "Y-DEC"): # Yearly
653653
one = sge.convert(1)
654654
first = sge.Extract(this="YEAR", expression=y.expr)
655655
x_val = sge.Add(
656656
this=sge.Mul(this=x.expr, expression=sge.convert(n)), expression=first
657657
)
658-
next_year = sge.Add(this=x_val, expression=one) # type: ignore
658+
next_year = sge.Add(this=x_val, expression=one) # type: ignore
659659
next_month_date = sge.func(
660660
"TIMESTAMP",
661661
sge.Anonymous(
@@ -675,4 +675,4 @@ def _integer_label_to_datetime_op_non_fixed_frequency(
675675
)
676676
else:
677677
raise ValueError(rule_code)
678-
return sge.Cast(this=x_label, to=_dtype_to_sql_string(y.dtype)) # type: ignore
678+
return sge.Cast(this=x_label, to=_dtype_to_sql_string(y.dtype)) # type: ignore

0 commit comments

Comments
 (0)