Skip to content

Commit 30d9c8c

Browse files
committed
manual edit
1 parent f5559cc commit 30d9c8c

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ def _(op: ops.base_ops.UnaryOp, expr: TypedExpr) -> sge.Expression:
304304

305305
@UNARY_OP_REGISTRATION.register(ops.iso_day_op)
306306
def _(op: ops.base_ops.UnaryOp, expr: TypedExpr) -> sge.Expression:
307-
return sge.Extract(
308-
this=sge.Identifier(this="DAYOFWEEK"), expression=expr.expr
309-
) + sge.convert(1)
307+
return sge.Extract(this=sge.Identifier(this="DAYOFWEEK"), expression=expr.expr)
310308

311309

312310
@UNARY_OP_REGISTRATION.register(ops.iso_week_op)

tests/unit/core/compile/sqlglot/expressions/test_unary_compiler.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def test_capitalize(scalar_types_df: bpd.DataFrame, snapshot):
9393
def test_ceil(scalar_types_df: bpd.DataFrame, snapshot):
9494
bf_df = scalar_types_df[["float64_col"]]
9595
sql = _apply_unary_op(bf_df, ops.ceil_op, "float64_col")
96+
9697
snapshot.assert_match(sql, "out.sql")
9798

9899

@@ -197,72 +198,84 @@ def test_hash(scalar_types_df: bpd.DataFrame, snapshot):
197198
def test_hour(scalar_types_df: bpd.DataFrame, snapshot):
198199
bf_df = scalar_types_df[["timestamp_col"]]
199200
sql = _apply_unary_op(bf_df, ops.hour_op, "timestamp_col")
201+
200202
snapshot.assert_match(sql, "out.sql")
201203

202204

203205
def test_invert(scalar_types_df: bpd.DataFrame, snapshot):
204206
bf_df = scalar_types_df[["int64_col"]]
205207
sql = _apply_unary_op(bf_df, ops.invert_op, "int64_col")
208+
206209
snapshot.assert_match(sql, "out.sql")
207210

208211

209212
def test_isalnum(scalar_types_df: bpd.DataFrame, snapshot):
210213
bf_df = scalar_types_df[["string_col"]]
211214
sql = _apply_unary_op(bf_df, ops.isalnum_op, "string_col")
215+
212216
snapshot.assert_match(sql, "out.sql")
213217

214218

215219
def test_isalpha(scalar_types_df: bpd.DataFrame, snapshot):
216220
bf_df = scalar_types_df[["string_col"]]
217221
sql = _apply_unary_op(bf_df, ops.isalpha_op, "string_col")
222+
218223
snapshot.assert_match(sql, "out.sql")
219224

220225

221226
def test_isdecimal(scalar_types_df: bpd.DataFrame, snapshot):
222227
bf_df = scalar_types_df[["string_col"]]
223228
sql = _apply_unary_op(bf_df, ops.isdecimal_op, "string_col")
229+
224230
snapshot.assert_match(sql, "out.sql")
225231

226232

227233
def test_isdigit(scalar_types_df: bpd.DataFrame, snapshot):
228234
bf_df = scalar_types_df[["string_col"]]
229235
sql = _apply_unary_op(bf_df, ops.isdigit_op, "string_col")
236+
230237
snapshot.assert_match(sql, "out.sql")
231238

232239

233240
def test_islower(scalar_types_df: bpd.DataFrame, snapshot):
234241
bf_df = scalar_types_df[["string_col"]]
235242
sql = _apply_unary_op(bf_df, ops.islower_op, "string_col")
243+
236244
snapshot.assert_match(sql, "out.sql")
237245

238246

239247
def test_isnumeric(scalar_types_df: bpd.DataFrame, snapshot):
240248
bf_df = scalar_types_df[["string_col"]]
241249
sql = _apply_unary_op(bf_df, ops.isnumeric_op, "string_col")
250+
242251
snapshot.assert_match(sql, "out.sql")
243252

244253

245254
def test_isspace(scalar_types_df: bpd.DataFrame, snapshot):
246255
bf_df = scalar_types_df[["string_col"]]
247256
sql = _apply_unary_op(bf_df, ops.isspace_op, "string_col")
257+
248258
snapshot.assert_match(sql, "out.sql")
249259

250260

251261
def test_isupper(scalar_types_df: bpd.DataFrame, snapshot):
252262
bf_df = scalar_types_df[["string_col"]]
253263
sql = _apply_unary_op(bf_df, ops.isupper_op, "string_col")
264+
254265
snapshot.assert_match(sql, "out.sql")
255266

256267

257268
def test_iso_day(scalar_types_df: bpd.DataFrame, snapshot):
258269
bf_df = scalar_types_df[["timestamp_col"]]
259270
sql = _apply_unary_op(bf_df, ops.iso_day_op, "timestamp_col")
271+
260272
snapshot.assert_match(sql, "out.sql")
261273

262274

263275
def test_iso_week(scalar_types_df: bpd.DataFrame, snapshot):
264276
bf_df = scalar_types_df[["timestamp_col"]]
265277
sql = _apply_unary_op(bf_df, ops.iso_week_op, "timestamp_col")
278+
266279
snapshot.assert_match(sql, "out.sql")
267280

268281

0 commit comments

Comments
 (0)