diff --git a/.gitignore b/.gitignore index d86e05386..d9972cb01 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,5 @@ node_modules/ web/playwright-tests/auth-utils/auth.json **/.claude/settings.local.json + +**/*.private.* \ No newline at end of file diff --git a/api/libs/query_engine/src/data_source_query_routes/redshift_query.rs b/api/libs/query_engine/src/data_source_query_routes/redshift_query.rs index e2f66c371..6d9223176 100644 --- a/api/libs/query_engine/src/data_source_query_routes/redshift_query.rs +++ b/api/libs/query_engine/src/data_source_query_routes/redshift_query.rs @@ -30,30 +30,30 @@ pub async fn redshift_query( for (i, column) in row.columns().iter().enumerate() { let column_name = column.name(); let type_info = column.type_info().clone().to_string(); + let column_value = match type_info.as_str() { - "BOOL" => DataType::Bool(Some(row.get::(i))), - "BYTEA" => DataType::Bytea(Some(row.get::, _>(i))), - "CHAR" => DataType::Char(Some(row.get::(i))), - "INT8" => DataType::Int8(Some(row.get::(i))), - "INT4" => DataType::Int4(Some(row.get::(i))), - "INT2" => DataType::Int2(Some(row.get::(i))), - "TEXT" | "VARCHAR" => DataType::Text(Some(row.get::(i))), - "FLOAT4" => DataType::Float4(Some(row.get::(i))), - "FLOAT8" => DataType::Float8(Some(row.get::(i))), + "BOOL" => DataType::Bool(row.try_get::, _>(i).unwrap_or(None)), + "BYTEA" => DataType::Bytea(row.try_get::>, _>(i).unwrap_or(None)), + "CHAR" => DataType::Char(row.try_get::, _>(i).unwrap_or(None)), + "INT8" => DataType::Int8(row.try_get::, _>(i).unwrap_or(None)), + "INT4" => DataType::Int4(row.try_get::, _>(i).unwrap_or(None)), + "INT2" => DataType::Int2(row.try_get::, _>(i).unwrap_or(None)), + "TEXT" | "VARCHAR" => DataType::Text(row.try_get::, _>(i).unwrap_or(None)), + "FLOAT4" => DataType::Float4(row.try_get::, _>(i).unwrap_or(None)), + "FLOAT8" => DataType::Float8(row.try_get::, _>(i).unwrap_or(None)), "NUMERIC" => { - let value: BigDecimal = row.get::(i); - let value: f64 = value.to_f64().unwrap(); - DataType::Float8(Some(value)) + match row.try_get::, _>(i).unwrap_or(None) { + Some(value) => DataType::Float8(value.to_f64()), + None => DataType::Float8(None), + } } - "UUID" => DataType::Uuid(Some(row.get::(i))), - "TIMESTAMP" => DataType::Timestamp(Some(row.get::(i))), - "DATE" => DataType::Date(Some(row.get::(i))), - "TIME" => DataType::Time(Some(row.get::(i))), - "TIMESTAMPTZ" => { - DataType::Timestamptz(Some(row.get::, _>(i))) - } - "JSON" | "JSONB" => DataType::Json(Some(row.get::(i))), - _ => DataType::Unknown(Some(row.get::(i))), + "UUID" => DataType::Uuid(row.try_get::, _>(i).unwrap_or(None)), + "TIMESTAMP" => DataType::Timestamp(row.try_get::, _>(i).unwrap_or(None)), + "DATE" => DataType::Date(row.try_get::, _>(i).unwrap_or(None)), + "TIME" => DataType::Time(row.try_get::, _>(i).unwrap_or(None)), + "TIMESTAMPTZ" => DataType::Timestamptz(row.try_get::>, _>(i).unwrap_or(None)), + "JSON" | "JSONB" => DataType::Json(row.try_get::, _>(i).unwrap_or(None)), + _ => DataType::Unknown(row.try_get::, _>(i).unwrap_or(None)), }; row_map.insert(column_name.to_string(), column_value);