From e9e50cfbbfad28f07b9a32209ae0ee19e24d18a5 Mon Sep 17 00:00:00 2001 From: Jax Liu Date: Fri, 25 Apr 2025 15:12:12 +0800 Subject: [PATCH 1/3] fix bigquery query test --- .../routers/v3/connector/bigquery/test_query.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ibis-server/tests/routers/v3/connector/bigquery/test_query.py b/ibis-server/tests/routers/v3/connector/bigquery/test_query.py index ebdd0fac8..b5f371b0a 100644 --- a/ibis-server/tests/routers/v3/connector/bigquery/test_query.py +++ b/ibis-server/tests/routers/v3/connector/bigquery/test_query.py @@ -78,16 +78,16 @@ async def test_query(client, manifest_str, connection_info): assert len(result["columns"]) == len(manifest["models"][0]["columns"]) assert len(result["data"]) == 1 assert result["data"][0] == [ + 36485, + 1202, + "F", + "356711.63", + "1992-06-06 00:00:00.000000", + "36485_1202", "2024-01-01 23:59:59.000000", "2024-01-01 23:59:59.000000 UTC", "2024-01-16 04:00:00.000000 UTC", # utc-5 "2024-07-16 03:00:00.000000 UTC", # utc-4 - "36485_1202", - 1202, - "1992-06-06 00:00:00.000000", - 36485, - "F", - "356711.63", ] assert result["dtypes"] == { "o_orderkey": "int64", @@ -141,7 +141,6 @@ async def test_query_with_invalid_manifest_str(client, connection_info): }, ) assert response.status_code == 422 - assert response.text == "Base64 decode error: Invalid padding" async def test_query_without_manifest(client, connection_info): From bcfc5a820abbb328b0e271e3d8bb6c94208bd18b Mon Sep 17 00:00:00 2001 From: Jax Liu Date: Fri, 25 Apr 2025 15:12:53 +0800 Subject: [PATCH 2/3] alian the env with config --- ibis-server/tools/query_local_run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibis-server/tools/query_local_run.py b/ibis-server/tools/query_local_run.py index fd07ceed6..d90accf1b 100644 --- a/ibis-server/tools/query_local_run.py +++ b/ibis-server/tools/query_local_run.py @@ -58,7 +58,7 @@ print("### Starting the session context ###") print("#") -session_context = SessionContext(encoded_str, function_list_path) +session_context = SessionContext(encoded_str, function_list_path + f"{data_source}.csv") planned_sql = session_context.transform_sql(sql) print("# Planned SQL:\n", planned_sql) From eec3f7cea9494dc607bf72a54ff5174d4ac74ad0 Mon Sep 17 00:00:00 2001 From: Jax Liu Date: Fri, 25 Apr 2025 15:15:05 +0800 Subject: [PATCH 3/3] add timestamp func --- ibis-server/resources/function_list/bigquery.csv | 1 + .../tests/routers/v3/connector/bigquery/test_functions.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ibis-server/resources/function_list/bigquery.csv b/ibis-server/resources/function_list/bigquery.csv index 57c3c7452..5e34520c6 100644 --- a/ibis-server/resources/function_list/bigquery.csv +++ b/ibis-server/resources/function_list/bigquery.csv @@ -17,6 +17,7 @@ scalar,timestamp_trunc,timestamp,,"timestamp,granularity","Truncates a timestamp scalar,timestamp_micros,timestamp,,"int64","Converts the number of microseconds since 1970-01-01 00:00:00 UTC to a TIMESTAMP." scalar,timestamp_millis,timestamp,,"int64","Converts the number of milliseconds since 1970-01-01 00:00:00 UTC to a TIMESTAMP." scalar,timestamp_seconds,timestamp,,"int64","Converts the number of seconds since 1970-01-01 00:00:00 UTC to a TIMESTAMP." +scalar,timestamp,timestamp,,"text","Converts a string to a TIMESTAMP." scalar,format_date,string,,"string,date","Formats a date according to the specified format string." scalar,format_timestamp,string,,"string,timestamp","Formats a timestamp according to the specified format string." scalar,parse_date,date,,"text,text","Parses a date from a string." diff --git a/ibis-server/tests/routers/v3/connector/bigquery/test_functions.py b/ibis-server/tests/routers/v3/connector/bigquery/test_functions.py index 16b99bbfa..90103e680 100644 --- a/ibis-server/tests/routers/v3/connector/bigquery/test_functions.py +++ b/ibis-server/tests/routers/v3/connector/bigquery/test_functions.py @@ -45,7 +45,7 @@ async def test_function_list(client): response = await client.get(url=f"{base_url}/functions") assert response.status_code == 200 result = response.json() - assert len(result) == DATAFUSION_FUNCTION_COUNT + 34 + assert len(result) == DATAFUSION_FUNCTION_COUNT + 35 the_func = next( filter( lambda x: x["name"] == "string_agg",