Prerequisites
Question
Hello,
I've noticed that BigQuery tools return fractions in the JSON payload when NUMERIC type is provided. For example, "95/10" instead of 9.5. I would like to confirm this is expected and switching to float is the only way to avoid this?
Thanks,
Philippe
Code
Here is the code to reproduce the fraction payload
Create the following table with numeric content:
CREATE TABLE tmp.test_fraction(
id INTEGER NOT NULL,
numeric_value NUMERIC NOT NULL
);
INSERT INTO tmp.test_fraction
SELECT 1, CAST(9.5 AS NUMERIC)
UNION ALL
SELECT 2, CAST(1/3 AS NUMERIC)
UNION ALL
SELECT 3, CAST(1.0 AS NUMERIC)
UNION ALL
SELECT 4, CAST(1234.10 AS NUMERIC)
Define the following tool:
sources:
test-bigquery-source:
kind: bigquery
project: ${GOOGLE_CLOUD_PROJECT}
location: us
tools:
# ---- Entity Lookup Tools ----
test-fraction:
kind: bigquery-sql
source: test-bigquery-source
description: "Test a fraction"
statement: >-
SELECT *
FROM tmp.test_fraction
toolsets:
test:
- test-fraction
Additional Details
No response
Prerequisites
Question
Hello,
I've noticed that BigQuery tools return fractions in the JSON payload when NUMERIC type is provided. For example, "95/10" instead of 9.5. I would like to confirm this is expected and switching to float is the only way to avoid this?
Thanks,
Philippe
Code
Here is the code to reproduce the fraction payload
Create the following table with numeric content:
Define the following tool:
Additional Details
No response