Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def _(
else:
result = apply_window_if_present(result, window)

if op.should_floor_result:
if op.should_floor_result or column.dtype == dtypes.TIMEDELTA_DTYPE:
result = sge.Cast(this=sge.func("FLOOR", result), to="INT64")
return result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def _cast_to_json(expr: TypedExpr, op: ops.AsTypeOp) -> sge.Expression:
sg_expr = expr.expr

if from_type == dtypes.STRING_DTYPE:
func_name = "PARSE_JSON_IN_SAFE" if op.safe else "PARSE_JSON"
func_name = "SAFE.PARSE_JSON" if op.safe else "PARSE_JSON"
return sge.func(func_name, sg_expr)
if from_type in (dtypes.INT_DTYPE, dtypes.BOOL_DTYPE, dtypes.FLOAT_DTYPE):
sg_expr = sge.Cast(this=sg_expr, to="STRING")
Expand Down
2 changes: 1 addition & 1 deletion tests/system/small/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def test_read_gbq_w_primary_keys_table(
pd.testing.assert_frame_equal(result, sorted_result)

# Verify that we're working from a snapshot rather than a copy of the table.
assert "FOR SYSTEM_TIME AS OF TIMESTAMP" in df.sql
assert "FOR SYSTEM_TIME AS OF" in df.sql


def test_read_gbq_w_primary_keys_table_and_filters(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WITH `bfcte_0` AS (
PARSE_JSON(CAST(`bool_col` AS STRING)) AS `bfcol_6`,
PARSE_JSON(`string_col`) AS `bfcol_7`,
PARSE_JSON(CAST(`bool_col` AS STRING)) AS `bfcol_8`,
PARSE_JSON_IN_SAFE(`string_col`) AS `bfcol_9`
SAFE.PARSE_JSON(`string_col`) AS `bfcol_9`
FROM `bfcte_0`
)
SELECT
Expand Down
Loading