Skip to content
Open
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
54 changes: 36 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand All @@ -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"] }

3 changes: 3 additions & 0 deletions crates/asap_types/src/table_population.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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 } => {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)?;
Expand Down Expand Up @@ -955,6 +964,9 @@ fn cell_cmp(left: &Cell, right: &Cell) -> Option<Ordering> {

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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}}",
Expand Down Expand Up @@ -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)]);
}
Expand Down
Loading