Skip to content

Commit 3cc859c

Browse files
chalmerlowepartheajskeetdaniel-sanchecodyoss
authored
test: enables assorted tests (#16611)
This PR seeks to enable a number of tests to help ensure full validation. See #16489 for additional details. --------- Co-authored-by: Anthonios Partheniou <partheniou@google.com> Co-authored-by: Jon Skeet <jonskeet@google.com> Co-authored-by: Daniel Sanche <sanche@google.com> Co-authored-by: Cody Oss <6331106+codyoss@users.noreply.github.com> Co-authored-by: TrevorBergeron <tbergeron@google.com>
1 parent 849afe3 commit 3cc859c

File tree

24 files changed

+235
-106
lines changed

24 files changed

+235
-106
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Only run these nox sessions.
4+
env_vars: {
5+
key: "NOX_SESSION"
6+
value: "e2e load system_prerelease notebook system_noextras"
7+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Only run this nox session.
4+
env_vars: {
5+
key: "NOX_SESSION"
6+
value: "cleanup doctest"
7+
}
8+
9+
env_vars: {
10+
key: "GOOGLE_CLOUD_PROJECT"
11+
value: "bigframes-testing"
12+
}

.kokoro/system.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ run_package_test() {
4343
local PROJECT_ID
4444
local GOOGLE_APPLICATION_CREDENTIALS
4545
local NOX_FILE
46-
local NOX_SESSION
46+
# Inherit NOX_SESSION from environment to allow configs (like prerelease.cfg) to pass it in
47+
local NOX_SESSION="${NOX_SESSION}"
4748

4849
echo "------------------------------------------------------------"
4950
echo "Configuring environment for: ${package_name}"
@@ -66,7 +67,8 @@ run_package_test() {
6667
PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
6768
GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_GFILE_DIR}/service-account.json"
6869
NOX_FILE="noxfile.py"
69-
NOX_SESSION="system-3.12"
70+
# Use inherited NOX_SESSION if set, otherwise fallback to system-3.12
71+
NOX_SESSION="${NOX_SESSION:-system-3.12}"
7072
;;
7173
esac
7274

packages/bigframes/bigframes/core/blocks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,6 +2796,7 @@ def _is_monotonic(
27962796
)
27972797
block = block.drop_columns([equal_monotonic_id, strict_monotonic_id])
27982798

2799+
assert last_result_id is not None
27992800
block, monotonic_result_id = block.apply_binary_op(
28002801
last_result_id,
28012802
last_notna_id,

packages/bigframes/bigframes/core/compile/ibis_compiler/aggregate_compiler.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,9 @@ def _(
528528
column: ibis_types.Column,
529529
window=None,
530530
) -> ibis_types.Value:
531+
# Ibis FirstNonNullValue expects Value[Any, Columnar], Mypy struggles to see Column as compatible.
531532
return _apply_window_if_present(
532-
ibis_ops.FirstNonNullValue(column).to_expr(),
533+
ibis_ops.FirstNonNullValue(column).to_expr(), # type: ignore[arg-type]
533534
window, # type: ignore
534535
)
535536

@@ -549,8 +550,9 @@ def _(
549550
column: ibis_types.Column,
550551
window=None,
551552
) -> ibis_types.Value:
553+
# Ibis LastNonNullValue expects Value[Any, Columnar], Mypy struggles to see Column as compatible.
552554
return _apply_window_if_present(
553-
ibis_ops.LastNonNullValue(column).to_expr(),
555+
ibis_ops.LastNonNullValue(column).to_expr(), # type: ignore[arg-type]
554556
window, # type: ignore
555557
)
556558

@@ -803,8 +805,9 @@ def _to_ibis_boundary(
803805
) -> Optional[ibis_expr_window.WindowBoundary]:
804806
if boundary is None:
805807
return None
808+
# WindowBoundary expects Value[Any, Any], ibis_types.literal returns Scalar which Mypy doesn't see as compatible.
806809
return ibis_expr_window.WindowBoundary(
807-
abs(boundary),
810+
ibis_types.literal(boundary if boundary >= 0 else -boundary), # type: ignore[arg-type]
808811
preceding=boundary <= 0, # type:ignore
809812
)
810813

packages/bigframes/bigframes/core/compile/ibis_compiler/ibis_compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def compile_sql(request: configs.CompileRequest) -> configs.CompileResult:
4949
# Can only pullup slice if we are doing ORDER BY in outermost SELECT
5050
# Need to do this before replacing unsupported ops, as that will rewrite slice ops
5151
result_node = rewrites.pull_up_limits(result_node)
52-
result_node = _replace_unsupported_ops(result_node)
53-
result_node = result_node.bottom_up(rewrites.simplify_join)
52+
result_node = cast(nodes.ResultNode, _replace_unsupported_ops(result_node))
53+
result_node = cast(nodes.ResultNode, result_node.bottom_up(rewrites.simplify_join))
5454
# prune before pulling up order to avoid unnnecessary row_number() ops
5555
result_node = cast(nodes.ResultNode, rewrites.column_pruning(result_node))
5656
result_node = rewrites.defer_order(

packages/bigframes/bigframes/core/compile/ibis_compiler/operations/geo_ops.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ def st_buffer(
182182

183183
@ibis_udf.scalar.builtin
184184
def st_distance(
185-
a: ibis_dtypes.geography, b: ibis_dtypes.geography, use_spheroid: bool
185+
a: ibis_dtypes.geography, # type: ignore
186+
b: ibis_dtypes.geography, # type: ignore
187+
use_spheroid: bool, # type: ignore
186188
) -> ibis_dtypes.float: # type: ignore
187189
"""Convert string to geography."""
188190

packages/bigframes/bigframes/core/compile/ibis_compiler/scalar_op_registry.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,9 +2168,12 @@ def obj_make_ref_json(objectref_json: ibis_dtypes.JSON) -> _OBJ_REF_IBIS_DTYPE:
21682168

21692169

21702170
@ibis_udf.scalar.builtin(name="OBJ.GET_ACCESS_URL")
2171-
def obj_get_access_url(
2172-
obj_ref: _OBJ_REF_IBIS_DTYPE, mode: ibis_dtypes.String
2173-
) -> ibis_dtypes.JSON: # type: ignore
2171+
# Stub for BigQuery UDF, empty body is intentional.
2172+
# _OBJ_REF_IBIS_DTYPE is a variable holding a type, Mypy complains about it being used as type hint.
2173+
def obj_get_access_url( # type: ignore[empty-body]
2174+
obj_ref: _OBJ_REF_IBIS_DTYPE, # type: ignore[valid-type]
2175+
mode: ibis_dtypes.String,
2176+
) -> ibis_dtypes.JSON:
21742177
"""Get access url (as ObjectRefRumtime JSON) from ObjectRef."""
21752178

21762179

packages/bigframes/bigframes/core/compile/sqlglot/compiler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ def compile_sql(request: configs.CompileRequest) -> configs.CompileResult:
5353
# Can only pullup slice if we are doing ORDER BY in outermost SELECT
5454
# Need to do this before replacing unsupported ops, as that will rewrite slice ops
5555
result_node = rewrite.pull_up_limits(result_node)
56-
result_node = _replace_unsupported_ops(result_node)
57-
result_node = result_node.bottom_up(rewrite.simplify_join)
56+
result_node = typing.cast(nodes.ResultNode, _replace_unsupported_ops(result_node))
57+
result_node = typing.cast(
58+
nodes.ResultNode, result_node.bottom_up(rewrite.simplify_join)
59+
)
5860
# prune before pulling up order to avoid unnnecessary row_number() ops
5961
result_node = typing.cast(nodes.ResultNode, rewrite.column_pruning(result_node))
6062
result_node = rewrite.defer_order(

packages/bigframes/bigframes/core/expression_factoring.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,12 @@ def factor_aggregation(root: nodes.ColumnDef) -> FactoredAggregation:
243243
}
244244

245245
root_scalar_expr = nodes.ColumnDef(
246-
sub_expressions(root.expression, agg_outputs_dict),
246+
sub_expressions(
247+
root.expression,
248+
cast(
249+
Mapping[expression.Expression, expression.Expression], agg_outputs_dict
250+
),
251+
),
247252
root.id, # type: ignore
248253
)
249254

0 commit comments

Comments
 (0)