jrossthomson / bigquery-utils

Useful scripts, udfs, views, and other utilities for migration and data warehouse operations in BigQuery.
https://cloud.google.com/bigquery/
Apache License 2.0
0 stars 0 forks source link

sqrt function #6

Closed boaguilar closed 3 years ago

boaguilar commented 3 years ago

HI there:

When testing the new corr_pvalue udf, I got an error related to sqrt function which is used in the function as "Math.sqrt( ... ". The following is the error message:

E google.api_core.exceptions.BadRequest: 400 TypeError: "cgc-05-0042.Math_test_local_test.sqrt" is not a function at UDF$1(FLOAT64, INT64) line 8, columns 59-60 E
E (job ID: 17d370af-a9f0-45ce-a681-f282f0ea9fe3) E
E -----Query Job SQL Follows-----
E
E | . | . | . | . | . | . | . | . | . | . | E 1:SELECT fn_test_local_test.corr_pvalue( CAST(0.9 AS FLOAT64), CAST(25 AS INT64) ) AS actual_result_rows E | . | . | . | . | . | . | . | . | . | . |

venv/lib/python3.8/site-packages/google/api_core/future/polling.py:134: BadRequest

jrossthomson commented 3 years ago

@danieldeleo

Any thoughts on how to work around the renaming of the core Math javascript library? The tests fail because the library is being renamed.

Thanks!

jrossthomson commented 3 years ago

Resolved by calling javascript from Math.sqrt to Math["sqrt"]