Skip to content

Commit 75cc833

Browse files
fix sql fallback test to use fn that will never be in polars probably
1 parent 31cb193 commit 75cc833

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/system/small/test_polars_execution.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
import math
15+
1416
import pytest
1517

1618
import bigframes
19+
import bigframes.bigquery
1720
from bigframes.testing.utils import assert_pandas_df_equal
1821

1922
polars = pytest.importorskip("polars")
@@ -63,13 +66,9 @@ def test_polar_execution_unsupported_sql_fallback(
6366
execution_count_before = session_w_polars._metrics.execution_count
6467
bf_df = session_w_polars.read_pandas(scalars_pandas_df_index)
6568

66-
pd_df = scalars_pandas_df_index.copy()
67-
pd_df["str_len_col"] = pd_df.string_col.str.len()
68-
pd_result = pd_df
69-
70-
bf_df["str_len_col"] = bf_df.string_col.str.len()
69+
bf_df["geo_area"] = bigframes.bigquery.st_length(bf_df.geography_col)
7170
bf_result = bf_df.to_pandas()
7271

73-
# str len not supported by polar engine yet, so falls back to bq execution
72+
# geo fns not supported by polar engine yet, so falls back to bq execution
7473
assert session_w_polars._metrics.execution_count == (execution_count_before + 1)
75-
assert_pandas_df_equal(bf_result, pd_result)
74+
assert math.isclose(bf_result.geo_area.sum(), 70.52332050, rel_tol=0.00001)

0 commit comments

Comments
 (0)