diff --git a/Cargo.lock b/Cargo.lock index e173aa68..12e94e46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -364,9 +364,10 @@ dependencies = [ [[package]] name = "asap-aware-mapping" version = "0.1.0" -source = "git+https://github.com/ProjectASAP/ASAPPlanner?rev=029ff2fe041172c94c2d32c90b185bc83c5e8a57#029ff2fe041172c94c2d32c90b185bc83c5e8a57" +source = "git+https://github.com/ProjectASAP/ASAPPlanner?branch=main#8b90f04c25c8a48b0fe594e50d67646150955e02" dependencies = [ "asap-types", + "asap_sketchlib 0.3.0 (git+https://github.com/ProjectASAP/asap_sketchlib?rev=da3635a80f8f854d47b772d49d5a9e5fb6927d8e)", "serde", "serde_json", "thiserror 2.0.20", @@ -375,7 +376,7 @@ dependencies = [ [[package]] name = "asap-frontend-promql" version = "0.1.0" -source = "git+https://github.com/ProjectASAP/ASAPPlanner?rev=029ff2fe041172c94c2d32c90b185bc83c5e8a57#029ff2fe041172c94c2d32c90b185bc83c5e8a57" +source = "git+https://github.com/ProjectASAP/ASAPPlanner?branch=main#8b90f04c25c8a48b0fe594e50d67646150955e02" dependencies = [ "asap-types", "promql-parser 0.10.0 (git+https://github.com/ProjectASAP/promql-parser?rev=9fede7eecca923c9882fe256484d00d37f8706cb)", @@ -384,7 +385,7 @@ dependencies = [ [[package]] name = "asap-frontend-sql" version = "0.1.0" -source = "git+https://github.com/ProjectASAP/ASAPPlanner?rev=029ff2fe041172c94c2d32c90b185bc83c5e8a57#029ff2fe041172c94c2d32c90b185bc83c5e8a57" +source = "git+https://github.com/ProjectASAP/ASAPPlanner?branch=main#8b90f04c25c8a48b0fe594e50d67646150955e02" dependencies = [ "asap-sql-function-catalog", "asap-types", @@ -397,7 +398,7 @@ name = "asap-precompute-rs" version = "0.1.0" source = "git+https://github.com/ProjectASAP/ASAPCollector?branch=main#1d8efd07e40fc151cbd4678a5c6aa9774b1aed34" dependencies = [ - "asap_sketchlib", + "asap_sketchlib 0.3.0 (git+https://github.com/ProjectASAP/asap_sketchlib?branch=main)", "prost", "serde", "serde_json", @@ -407,12 +408,12 @@ dependencies = [ [[package]] name = "asap-sql-function-catalog" version = "0.1.0" -source = "git+https://github.com/ProjectASAP/ASAPPlanner?rev=029ff2fe041172c94c2d32c90b185bc83c5e8a57#029ff2fe041172c94c2d32c90b185bc83c5e8a57" +source = "git+https://github.com/ProjectASAP/ASAPPlanner?branch=main#8b90f04c25c8a48b0fe594e50d67646150955e02" [[package]] name = "asap-types" version = "0.1.0" -source = "git+https://github.com/ProjectASAP/ASAPPlanner?rev=029ff2fe041172c94c2d32c90b185bc83c5e8a57#029ff2fe041172c94c2d32c90b185bc83c5e8a57" +source = "git+https://github.com/ProjectASAP/ASAPPlanner?branch=main#8b90f04c25c8a48b0fe594e50d67646150955e02" dependencies = [ "serde", "serde_json", @@ -447,6 +448,23 @@ dependencies = [ "xxhash-rust", ] +[[package]] +name = "asap_sketchlib" +version = "0.3.0" +source = "git+https://github.com/ProjectASAP/asap_sketchlib?rev=da3635a80f8f854d47b772d49d5a9e5fb6927d8e#da3635a80f8f854d47b772d49d5a9e5fb6927d8e" +dependencies = [ + "bytes", + "prost", + "rand 0.9.5", + "rmp-serde", + "serde", + "serde-big-array", + "serde_bytes", + "smallvec", + "twox-hash 2.1.4", + "xxhash-rust", +] + [[package]] name = "asap_types" version = "0.1.0" @@ -1144,7 +1162,7 @@ dependencies = [ "asap-precompute-rs", "asap-types", "asap_otel_proto", - "asap_sketchlib", + "asap_sketchlib 0.3.0 (git+https://github.com/ProjectASAP/asap_sketchlib?branch=main)", "asap_types", "async-trait", "axum", @@ -1642,7 +1660,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2073,7 +2091,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.5", + "socket2 0.5.10", "tokio", "tower-service", "tracing", @@ -2259,7 +2277,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2606,7 +2624,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3184,7 +3202,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.6.5", + "socket2 0.5.10", "thiserror 2.0.20", "tokio", "tracing", @@ -3222,9 +3240,9 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.6.5", + "socket2 0.5.10", "tracing", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3500,7 +3518,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3945,7 +3963,7 @@ dependencies = [ "getrandom 0.4.3", "once_cell", "rustix 1.1.4", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -4457,7 +4475,7 @@ version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5283634e518fe9e82c7b20520bb4bc209009fd16c82077c802f8111ecbb0117a" dependencies = [ - "rand 0.10.2", + "rand 0.9.5", ] [[package]] @@ -4720,7 +4738,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ae7e90f8..418d638a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,12 +18,12 @@ version = "0.1.0" asap_sketchlib = { git = "https://github.com/ProjectASAP/asap_sketchlib", branch = "main" } [workspace.dependencies] -# Keep Planner frontends, selection, and IR on the same immutable revision (current-series Planner PR). +# Track Planner main for frontends, selection, and IR. # Alias upstream asap-types because this workspace also defines asap_types. -planner-types = { package = "asap-types", git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "029ff2fe041172c94c2d32c90b185bc83c5e8a57" } -asap-aware-mapping = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "029ff2fe041172c94c2d32c90b185bc83c5e8a57" } -asap-frontend-promql = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "029ff2fe041172c94c2d32c90b185bc83c5e8a57" } -asap-frontend-sql = { git = "https://github.com/ProjectASAP/ASAPPlanner", rev = "029ff2fe041172c94c2d32c90b185bc83c5e8a57" } +planner-types = { package = "asap-types", git = "https://github.com/ProjectASAP/ASAPPlanner", branch = "main" } +asap-aware-mapping = { git = "https://github.com/ProjectASAP/ASAPPlanner", branch = "main" } +asap-frontend-promql = { git = "https://github.com/ProjectASAP/ASAPPlanner", branch = "main" } +asap-frontend-sql = { git = "https://github.com/ProjectASAP/ASAPPlanner", branch = "main" } # Shared external deps (used by 2+ crates) serde = { version = "1.0", features = ["derive"] } @@ -46,4 +46,3 @@ reqwest = { version = "0.12", default-features = false, features = ["json", "rus asap_types = { path = "crates/asap_types" } asap_otel_proto = { path = "crates/asap_otel_proto" } indexmap = { version = "2.0", features = ["serde"] } - diff --git a/crates/asap_types/src/table_population.rs b/crates/asap_types/src/table_population.rs index 946813cf..37655d92 100644 --- a/crates/asap_types/src/table_population.rs +++ b/crates/asap_types/src/table_population.rs @@ -37,6 +37,9 @@ impl TablePopulation { { return Err("table population requires a finite non-null literal".into()); } + if matches!(predicate.value, ScalarValue::Interval { .. }) { + return Err("table population interval literals are unsupported".into()); + } } Ok(()) } diff --git a/data_plane/src/query_engines/asap_clickhouse_query_engine/relational_adapter.rs b/data_plane/src/query_engines/asap_clickhouse_query_engine/relational_adapter.rs index e3395668..a52c588b 100644 --- a/data_plane/src/query_engines/asap_clickhouse_query_engine/relational_adapter.rs +++ b/data_plane/src/query_engines/asap_clickhouse_query_engine/relational_adapter.rs @@ -10,7 +10,7 @@ use arrow::{ ArrayRef, BooleanArray, Float64Array, Int64Array, MapArray, NullArray, StringArray, StructArray, TimestampMillisecondArray, }, - datatypes::{DataType as ArrowDataType, Field, Schema}, + datatypes::{DataType as ArrowDataType, Field, IntervalUnit, Schema}, record_batch::RecordBatch, }; use chrono::{DateTime, NaiveDateTime, TimeZone}; @@ -61,6 +61,9 @@ fn json_cell( )) }; match dtype { + DataType::Date | DataType::Interval => Err(ClickHouseRelationalError::Unsupported( + format!("{dtype:?} values"), + )), DataType::Null if value.is_null() => Ok(Cell::Null), DataType::Null => Err(invalid()), DataType::List { element } => { @@ -330,6 +333,7 @@ fn clickhouse_type_matches(actual: Option<&str>, expected: &DataType, nullable: return false; } match expected { + DataType::Date | DataType::Interval => false, DataType::Null => actual == "Nothing", DataType::List { element } => { !nullable @@ -578,6 +582,11 @@ fn eval( ScalarValue::Utf8(value) => Cell::Utf8(value.clone()), ScalarValue::Boolean(value) => Cell::Bool(*value), ScalarValue::Null => Cell::Null, + ScalarValue::Interval { .. } => { + return Err(ClickHouseRelationalError::Unsupported( + "interval literals".into(), + )) + } }), QueryExpr::Compare { left, op, right } => { let left = eval(left, row, schema)?; @@ -955,6 +964,9 @@ fn cell_cmp(left: &Cell, right: &Cell) -> Option { fn arrow_type(dtype: &DataType) -> ArrowDataType { match dtype { + // Declared only; json_cell and build_array reject these values. + DataType::Date => ArrowDataType::Date32, + DataType::Interval => ArrowDataType::Interval(IntervalUnit::MonthDayNano), DataType::Null => ArrowDataType::Null, DataType::List { element } => ArrowDataType::List(Arc::new(Field::new( &element.name, @@ -1031,6 +1043,11 @@ fn build_array( "collection value transport".into(), )) } + DataType::Date | DataType::Interval => { + return Err(ClickHouseRelationalError::Unsupported(format!( + "{dtype:?} value transport" + ))) + } DataType::Int64 => Arc::new(Int64Array::from(values!(Int64))) as ArrayRef, DataType::Float64 => Arc::new(Float64Array::from(values!(Float64))) as ArrayRef, DataType::Utf8 => Arc::new(StringArray::from(values!(Utf8))) as ArrayRef, diff --git a/data_plane/src/storage_engines/sketch_db/backfill/clickhouse_reader.rs b/data_plane/src/storage_engines/sketch_db/backfill/clickhouse_reader.rs index d19aad0e..acea6498 100644 --- a/data_plane/src/storage_engines/sketch_db/backfill/clickhouse_reader.rs +++ b/data_plane/src/storage_engines/sketch_db/backfill/clickhouse_reader.rs @@ -129,7 +129,9 @@ impl ClickHouseReader { ScalarValue::Int64(_) => "Int64", ScalarValue::Float64(_) => "Float64", ScalarValue::Boolean(_) => "Bool", - ScalarValue::Null => unreachable!("validated table literal"), + ScalarValue::Null | ScalarValue::Interval { .. } => { + unreachable!("validated table literal") + } }; format!( "{} {operator} {{population_{index}:{kind}}}", @@ -302,7 +304,9 @@ impl RawSampleReader for ClickHouseReader { ScalarValue::Int64(value) => value.to_string(), ScalarValue::Float64(value) => value.to_string(), ScalarValue::Boolean(value) => value.to_string(), - ScalarValue::Null => unreachable!("validated table literal"), + ScalarValue::Null | ScalarValue::Interval { .. } => { + unreachable!("validated table literal") + } }; request = request.query(&[(format!("param_population_{index}"), value)]); }