Skip to content

Commit bf90bb3

Browse files
committed
chore(cubestore): Upgrade DF: fix UDF style and organization, lowercase names
1 parent 94a0288 commit bf90bb3

File tree

5 files changed

+71
-121
lines changed

5 files changed

+71
-121
lines changed

rust/cubestore/cubehll/src/instance.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ impl SparseHll {
593593
}
594594
vec_alloc_size(&self.entries)
595595
}
596-
597596
}
598597

599598
#[derive(Debug, Clone)]
@@ -1163,7 +1162,9 @@ impl DenseHll {
11631162
fn vec_alloc_size<T: Copy>(v: &Vec<T>) -> usize {
11641163
v.capacity() * size_of::<T>()
11651164
}
1166-
vec_alloc_size(&self.deltas) + vec_alloc_size(&self.overflow_buckets) + vec_alloc_size(&self.overflow_values)
1165+
vec_alloc_size(&self.deltas)
1166+
+ vec_alloc_size(&self.overflow_buckets)
1167+
+ vec_alloc_size(&self.overflow_values)
11671168
}
11681169
}
11691170

rust/cubestore/cubestore/src/queryplanner/mod.rs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -484,32 +484,13 @@ impl ContextProvider for MetaStoreSchemaProvider {
484484
}
485485

486486
fn get_function_meta(&self, name: &str) -> Option<Arc<ScalarUDF>> {
487-
// TODO upgrade DF
488-
let kind = match name {
489-
"cardinality" | "CARDINALITY" => CubeScalarUDFKind::HllCardinality,
490-
"unix_timestamp" | "UNIX_TIMESTAMP" => CubeScalarUDFKind::UnixTimestamp,
491-
"date_add" | "DATE_ADD" => CubeScalarUDFKind::DateAdd,
492-
"date_sub" | "DATE_SUB" => CubeScalarUDFKind::DateSub,
493-
"date_bin" | "DATE_BIN" => CubeScalarUDFKind::DateBin,
494-
_ => return self.session_state.scalar_functions().get(name).cloned(),
495-
};
496-
return Some(scalar_udf_by_kind(kind));
487+
let name = name.to_ascii_lowercase();
488+
self.session_state.scalar_functions().get(&name).cloned()
497489
}
498490

499491
fn get_aggregate_meta(&self, name_param: &str) -> Option<Arc<AggregateUDF>> {
500-
// HyperLogLog.
501-
// TODO: case-insensitive names.
502-
/*
503-
let (_kind, name) = match name {
504-
"merge" | "MERGE" => (CubeAggregateUDFKind::MergeHll, "MERGE"),
505-
_ => return None,
506-
};
507-
*/
508492
let name = name_param.to_ascii_lowercase();
509-
510-
let aggregate_udf_by_registry: Option<&Arc<AggregateUDF>> = self.session_state.aggregate_functions().get(&name);
511-
512-
aggregate_udf_by_registry.map(|arc| arc.clone())
493+
self.session_state.aggregate_functions().get(&name).cloned()
513494
}
514495

515496
fn get_window_meta(&self, name: &str) -> Option<Arc<WindowUDF>> {

rust/cubestore/cubestore/src/queryplanner/serialized_plan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::queryplanner::query_executor::{CubeTable, InlineTableId, InlineTableP
99
use crate::queryplanner::topk::{ClusterAggregateTopK, SortColumn};
1010
use crate::queryplanner::udfs::aggregate_udf_by_kind;
1111
use crate::queryplanner::udfs::{
12-
aggregate_kind_by_name, scalar_kind_by_name, scalar_udf_by_kind, CubeAggregateUDFKind,
12+
aggregate_kind_by_name, scalar_udf_by_kind, CubeAggregateUDFKind,
1313
CubeScalarUDFKind,
1414
};
1515
use crate::queryplanner::{CubeTableLogical, InfoSchemaTableProvider};

rust/cubestore/cubestore/src/queryplanner/topk/plan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::queryplanner::planning::{ClusterSendNode, CubeExtensionPlanner};
22
// use crate::queryplanner::topk::execute::{AggregateTopKExec, TopKAggregateFunction};
33
use crate::queryplanner::topk::{ClusterAggregateTopK, SortColumn, MIN_TOPK_STREAM_ROWS};
44
use crate::queryplanner::udfs::{
5-
aggregate_kind_by_name, scalar_kind_by_name, scalar_udf_by_kind, CubeAggregateUDFKind,
5+
aggregate_kind_by_name, scalar_udf_by_kind, CubeAggregateUDFKind,
66
CubeScalarUDFKind,
77
};
88
use datafusion::arrow::datatypes::{DataType, Schema};

0 commit comments

Comments
 (0)