Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ibis-server/app/model/metadata/dto.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class RustWrenEngineColumnType(Enum):
INT64 = "INT64"
TIME = "TIME"
NULL = "NULL"
VARIANT = "VARIANT"

# Extension types
## PostGIS
Expand Down
2 changes: 2 additions & 0 deletions ibis-server/app/model/metadata/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
"timestamp": RustWrenEngineColumnType.TIMESTAMP,
"timestamp_ntz": RustWrenEngineColumnType.TIMESTAMP,
"timestamp_tz": RustWrenEngineColumnType.TIMESTAMPTZ,
"variant": RustWrenEngineColumnType.VARIANT,
"object": RustWrenEngineColumnType.JSON,
}


Expand Down
35 changes: 35 additions & 0 deletions ibis-server/resources/function_list/snowflake.csv
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ scalar,add_months,date,"Adds months to date"
scalar,array_compact,array,"Removes null values from array"
scalar,array_insert,array,"Inserts element into array"
scalar,array_size,numeric,"Returns number of elements in array"
scalar,array_contains,boolean,"Tests if array contains element"
scalar,array_construct,array,"Constructs array from elements"
scalar,array_slice,array,"Returns subarray from array"
scalar,base64_encode,string,"Encodes binary to base64"
scalar,base64_decode,binary,"Decodes base64 to binary"
scalar,char,string,"Returns character from ASCII code"
Expand Down Expand Up @@ -52,13 +55,45 @@ scalar,timestampadd,timestamp,"Adds interval to timestamp"
scalar,timestampdiff,interval,"Calculates difference between two timestamps"
scalar,to_array,array,"Converts value to array"
scalar,to_json,string,"Converts to JSON string"
scalar,to_variant,variant,"Converts to VARIANT"
scalar,to_object,object,"Converts to OBJECT"
scalar,to_number,numeric,"Converts to number"
scalar,to_time,time,"Converts to time"
scalar,to_xml,string,"Converts to XML string"
scalar,try_cast,same_as_input,"Safe type conversion"
scalar,to_date,date,"Converts to date"
scalar,to_timestamp,timestamp,"Converts to timestamp"
scalar,to_timestamp_ntz,timestamp,"Converts to timestamp without time zone"
scalar,to_timestamp_ltz,timestamp,"Converts to timestamp with local time zone"
scalar,to_timestamp_tz,timestamp,"Converts to timestamp with time zone"
scalar,to_decimal,decimal,"Converts to decimal"
scalar,to_numeric,numeric,"Converts to numeric"
scalar,to_binary,binary,"Converts to binary"
scalar,to_boolean,boolean,"Converts to boolean"
scalar,to_integer,integer,"Converts to integer"
scalar,to_bigint,bigint,"Converts to bigint"
scalar,to_smallint,smallint,"Converts to smallint"
scalar,to_tinyint,tinyint,"Converts to tinyint"
scalar,to_varchar,string,"Converts to varchar"
scalar,try_to_date,date,"Safe date conversion"
scalar,try_to_time,time,"Safe time conversion"
scalar,try_to_timestamp_ntz,timestamp,"Safe timestamp without time zone conversion"
scalar,try_to_timestamp_ltz,timestamp,"Safe timestamp with local time zone conversion"
scalar,try_to_timestamp_tz,timestamp,"Safe timestamp with time zone conversion"
scalar,try_to_timestmp,timestamp,"Safe timestamp conversion"
scalar,try_to_number,numeric,"Safe number conversion"
scalar,try_to_timestamp,timestamp,"Safe timestamp conversion"
scalar,try_to_decimal,decimal,"Safe decimal conversion"
scalar,try_to_numeric,numeric,"Safe numeric conversion"
scalar,try_to_binary,binary,"Safe binary conversion"
scalar,try_to_boolean,boolean,"Safe boolean conversion"
scalar,try_to_integer,integer,"Safe integer conversion"
scalar,try_to_bigint,bigint,"Safe bigint conversion"
scalar,try_to_smallint,smallint,"Safe smallint conversion"
scalar,try_to_tinyint,tinyint,"Safe tinyint conversion"
scalar,try_to_varchar,string,"Safe varchar conversion"
scalar,uuid_string,string,"Generates UUID"
scalar,xmlget,xml,"Gets XML element"
scalar,get_path,variant,"Extracts value from VARIANT using path"
scalar,get,variant,"Extracts value from OBJECT using key"
window,ratio_to_report,numeric,"Returns ratio to sum"
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,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 + 63
assert len(result) == DATAFUSION_FUNCTION_COUNT + 93
the_func = next(filter(lambda x: x["name"] == "is_null_value", result))
assert the_func == {
"name": "is_null_value",
Expand Down
5 changes: 4 additions & 1 deletion ibis-server/tools/query_local_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import json
import os
from app.custom_sqlglot.dialects.wren import Wren
from app.model import MSSqlConnectionInfo, MySqlConnectionInfo, OracleConnectionInfo, PostgresConnectionInfo
from app.model import MSSqlConnectionInfo, MySqlConnectionInfo, OracleConnectionInfo, PostgresConnectionInfo, SnowflakeConnectionInfo
from app.util import to_json
import sqlglot
import sys
Expand Down Expand Up @@ -105,6 +105,9 @@
elif data_source == "mssql":
connection_info = MSSqlConnectionInfo.model_validate_json(json.dumps(connection_info))
connection = DataSourceExtension.get_mssql_connection(connection_info)
elif data_source == "snowflake":
connection_info = SnowflakeConnectionInfo.model_validate_json(json.dumps(connection_info))
connection = DataSourceExtension.get_snowflake_connection(connection_info)
else:
raise Exception("Unsupported data source:", data_source)

Expand Down
3 changes: 2 additions & 1 deletion wren-core/core/src/mdl/function/remote_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ impl ByPassScalarUDF {
impl From<RemoteFunction> for ByPassScalarUDF {
fn from(func: RemoteFunction) -> Self {
// just panic if the return type is not valid to avoid we input invalid type
let return_type = ReturnType::from_str(&func.return_type).unwrap();
let return_type = ReturnType::from_str(&func.return_type)
.unwrap_or(ReturnType::Specific(DataType::Utf8));
ByPassScalarUDF {
return_type,
signature: func.get_signature(),
Expand Down
Loading