Skip to content

Commit 110bcc4

Browse files
committed
remove timestamp from format_date support
1 parent 09eb8b7 commit 110bcc4

4 files changed

Lines changed: 3 additions & 49 deletions

File tree

packages/bigframes/bigframes/extensions/core/series_accessor.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,11 +1062,6 @@ def format_date(
10621062
bigframes.core.col.Expression,
10631063
Union[Literal[sentinels.Sentinel.ARGUMENT_DEFAULT], str],
10641064
],
1065-
time_zone: Union[
1066-
series.Series,
1067-
bigframes.core.col.Expression,
1068-
Union[Literal[sentinels.Sentinel.ARGUMENT_DEFAULT], str],
1069-
] = sentinels.Sentinel.ARGUMENT_DEFAULT,
10701065
*,
10711066
session: Optional[bigframes.session.Session] = None,
10721067
) -> S:
@@ -1081,14 +1076,12 @@ def format_date(
10811076

10821077
session = googlesql._find_session(
10831078
format_string,
1084-
time_zone,
10851079
)
10861080

10871081
bf_series = self._bf_from_series(session)
10881082
result = format_date_impl(
10891083
format_string,
10901084
bf_series,
1091-
time_zone,
10921085
)
10931086
return self._to_series(cast(series.Series, result))
10941087

packages/bigframes/bigframes/operations/googlesql/global_namespace/date.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
)
8282
_FORMAT_DATE_OP = googlesql.GoogleSqlScalarOp(
8383
"FORMAT_DATE",
84-
args=(googlesql.ArgSpec(), googlesql.ArgSpec(), googlesql.ArgSpec(optional=True)),
84+
args=(googlesql.ArgSpec(), googlesql.ArgSpec()),
8585
signature=lambda *args: dtypes.STRING_DTYPE,
8686
)
8787
_GENERATE_DATE_ARRAY_OP = googlesql.GoogleSqlScalarOp(
@@ -355,24 +355,14 @@ def format_date(
355355
date_expr: Union[
356356
series.Series,
357357
bigframes.core.col.Expression,
358-
Union[
359-
Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
360-
datetime.date,
361-
datetime.datetime,
362-
],
358+
Union[Literal[sentinels.Sentinel.ARGUMENT_DEFAULT], datetime.date],
363359
],
364-
time_zone: Union[
365-
series.Series,
366-
bigframes.core.col.Expression,
367-
Union[Literal[sentinels.Sentinel.ARGUMENT_DEFAULT], str],
368-
] = sentinels.Sentinel.ARGUMENT_DEFAULT,
369360
) -> Union[series.Series, bigframes.core.col.Expression]:
370361
"""Formats a DATE value according to a specified format string."""
371362
return bigframes.core.googlesql.apply_googlesql_scalar_op(
372363
_FORMAT_DATE_OP,
373364
format_string,
374365
date_expr,
375-
time_zone,
376366
)
377367

378368

packages/bigframes/scripts/data/sql-functions/global_namespace/date.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -256,32 +256,6 @@ scalar_functions:
256256
optional: false
257257
keyword_only: false
258258
return: string
259-
# Signature: format_date:str_pts
260-
- args:
261-
- name: "format_string"
262-
value: string
263-
optional: false
264-
keyword_only: false
265-
- name: "date_expr"
266-
value: timestamp
267-
optional: false
268-
keyword_only: false
269-
return: string
270-
# Signature: format_date:str_pts_str
271-
- args:
272-
- name: "format_string"
273-
value: string
274-
optional: false
275-
keyword_only: false
276-
- name: "date_expr"
277-
value: timestamp
278-
optional: false
279-
keyword_only: false
280-
- name: "time_zone"
281-
value: string
282-
optional: true
283-
keyword_only: false
284-
return: string
285259
- name: "generate_date_array"
286260
description: "Generates an array of dates in a range."
287261
impls:

packages/bigframes/tests/unit/bigquery/generated/global_namespace/test_date.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ def test_format_date_expression():
253253
result = bbq.format_date(
254254
bpd.col("format_string"),
255255
bpd.col("date_expr"),
256-
bpd.col("time_zone"),
257256
)
258257

259258
# Verify result is a col Expression
@@ -265,13 +264,11 @@ def test_format_date_expression():
265264
assert expr.op == date_op._FORMAT_DATE_OP
266265

267266
# Verify arguments are free variables matching the names
268-
assert len(expr.inputs) == 3
267+
assert len(expr.inputs) == 2
269268
assert isinstance(expr.inputs[0], ex.UnboundVariableExpression)
270269
assert expr.inputs[0].id == "format_string"
271270
assert isinstance(expr.inputs[1], ex.UnboundVariableExpression)
272271
assert expr.inputs[1].id == "date_expr"
273-
assert isinstance(expr.inputs[2], ex.UnboundVariableExpression)
274-
assert expr.inputs[2].id == "time_zone"
275272

276273

277274
def test_generate_date_array_expression():

0 commit comments

Comments
 (0)