Skip to content

Commit 869ca98

Browse files
committed
refactor(cubesql): Extract MEASURE UDAF name to const
1 parent fcab541 commit 869ca98

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

rust/cubesql/cubesql/src/compile/engine/udf/common.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2259,6 +2259,8 @@ pub fn create_pg_get_constraintdef_udf() -> ScalarUDF {
22592259
)
22602260
}
22612261

2262+
pub const MEASURE_UDAF_NAME: &str = "measure";
2263+
22622264
pub fn create_measure_udaf() -> AggregateUDF {
22632265
let signature = Signature::any(1, Volatility::Immutable);
22642266

@@ -2279,7 +2281,7 @@ pub fn create_measure_udaf() -> AggregateUDF {
22792281
let state_type: StateTypeFunction = Arc::new(move |_| Ok(state_type.clone()));
22802282

22812283
AggregateUDF::new(
2282-
"measure",
2284+
MEASURE_UDAF_NAME,
22832285
&signature,
22842286
&return_type,
22852287
&accumulator,

rust/cubesql/cubesql/src/compile/rewrite/analysis.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::{
22
compile::{
3+
engine::udf::MEASURE_UDAF_NAME,
34
rewrite::{
45
converter::{is_expr_node, node_to_expr, LogicalPlanToLanguageConverter},
56
expr_column_name,
@@ -389,7 +390,7 @@ impl LogicalPlanAnalysis {
389390
Some(trivial)
390391
}
391392
LogicalPlanLanguage::AggregateUDFExprFun(AggregateUDFExprFun(fun)) => {
392-
if fun.to_lowercase() == "measure" {
393+
if fun.to_lowercase() == MEASURE_UDAF_NAME {
393394
Some(0)
394395
} else {
395396
None

0 commit comments

Comments
 (0)