Skip to content

Commit 2ff8760

Browse files
committed
CachedIds for functions
1 parent bd6fc3e commit 2ff8760

31 files changed

Lines changed: 99 additions & 43 deletions

File tree

vortex-array/src/scalar_fn/fns/between/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use vortex_error::VortexResult;
1313
use vortex_error::vortex_bail;
1414
use vortex_proto::expr as pb;
1515
use vortex_session::VortexSession;
16+
use vortex_session::registry::CachedId;
1617

1718
use crate::ArrayRef;
1819
use crate::Canonical;
@@ -176,7 +177,8 @@ impl ScalarFnVTable for Between {
176177
type Options = BetweenOptions;
177178

178179
fn id(&self) -> ScalarFnId {
179-
ScalarFnId::new("vortex.between")
180+
static ID: CachedId = CachedId::new("vortex.between");
181+
*ID
180182
}
181183

182184
fn serialize(&self, instance: &Self::Options) -> VortexResult<Option<Vec<u8>>> {

vortex-array/src/scalar_fn/fns/binary/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use vortex_error::VortexResult;
1212
use vortex_error::vortex_bail;
1313
use vortex_proto::expr as pb;
1414
use vortex_session::VortexSession;
15+
use vortex_session::registry::CachedId;
1516

1617
use crate::ArrayRef;
1718
use crate::ExecutionCtx;
@@ -52,7 +53,8 @@ impl ScalarFnVTable for Binary {
5253
type Options = Operator;
5354

5455
fn id(&self) -> ScalarFnId {
55-
ScalarFnId::new("vortex.binary")
56+
static ID: CachedId = CachedId::new("vortex.binary");
57+
*ID
5658
}
5759

5860
fn serialize(&self, instance: &Self::Options) -> VortexResult<Option<Vec<u8>>> {

vortex-array/src/scalar_fn/fns/case_when.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use vortex_mask::AllOr;
2222
use vortex_mask::Mask;
2323
use vortex_proto::expr as pb;
2424
use vortex_session::VortexSession;
25+
use vortex_session::registry::CachedId;
2526

2627
use crate::ArrayRef;
2728
use crate::ExecutionCtx;
@@ -79,7 +80,8 @@ impl ScalarFnVTable for CaseWhen {
7980
type Options = CaseWhenOptions;
8081

8182
fn id(&self) -> ScalarFnId {
82-
ScalarFnId::new("vortex.case_when")
83+
static ID: CachedId = CachedId::new("vortex.case_when");
84+
*ID
8385
}
8486

8587
fn serialize(&self, _options: &Self::Options) -> VortexResult<Option<Vec<u8>>> {

vortex-array/src/scalar_fn/fns/cast/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use vortex_error::vortex_bail;
1212
use vortex_error::vortex_err;
1313
use vortex_proto::expr as pb;
1414
use vortex_session::VortexSession;
15+
use vortex_session::registry::CachedId;
1516

1617
use crate::AnyColumnar;
1718
use crate::ArrayRef;
@@ -53,7 +54,8 @@ impl ScalarFnVTable for Cast {
5354
type Options = DType;
5455

5556
fn id(&self) -> ScalarFnId {
56-
ScalarFnId::new("vortex.cast")
57+
static ID: CachedId = CachedId::new("vortex.cast");
58+
*ID
5759
}
5860

5961
fn serialize(&self, dtype: &DType) -> VortexResult<Option<Vec<u8>>> {

vortex-array/src/scalar_fn/fns/dynamic.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use parking_lot::Mutex;
1212
use vortex_error::VortexExpect;
1313
use vortex_error::VortexResult;
1414
use vortex_error::vortex_bail;
15+
use vortex_session::registry::CachedId;
1516

1617
use crate::ArrayRef;
1718
use crate::ExecutionCtx;
@@ -46,7 +47,8 @@ impl ScalarFnVTable for DynamicComparison {
4647
type Options = DynamicComparisonExpr;
4748

4849
fn id(&self) -> ScalarFnId {
49-
ScalarFnId::from("vortex.dynamic")
50+
static ID: CachedId = CachedId::new("vortex.dynamic");
51+
*ID
5052
}
5153

5254
fn arity(&self, _options: &Self::Options) -> Arity {

vortex-array/src/scalar_fn/fns/fill_null/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use vortex_error::vortex_bail;
99
use vortex_error::vortex_ensure;
1010
use vortex_error::vortex_err;
1111
use vortex_session::VortexSession;
12+
use vortex_session::registry::CachedId;
1213

1314
use crate::AnyColumnar;
1415
use crate::ArrayRef;
@@ -37,7 +38,8 @@ impl ScalarFnVTable for FillNull {
3738
type Options = EmptyOptions;
3839

3940
fn id(&self) -> ScalarFnId {
40-
ScalarFnId::new("vortex.fill_null")
41+
static ID: CachedId = CachedId::new("vortex.fill_null");
42+
*ID
4143
}
4244

4345
fn serialize(&self, _options: &Self::Options) -> VortexResult<Option<Vec<u8>>> {

vortex-array/src/scalar_fn/fns/get_item.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use vortex_error::VortexResult;
88
use vortex_error::vortex_err;
99
use vortex_proto::expr as pb;
1010
use vortex_session::VortexSession;
11+
use vortex_session::registry::CachedId;
1112

1213
use crate::ArrayRef;
1314
use crate::ExecutionCtx;
@@ -44,7 +45,8 @@ impl ScalarFnVTable for GetItem {
4445
type Options = FieldName;
4546

4647
fn id(&self) -> ScalarFnId {
47-
ScalarFnId::new("vortex.get_item")
48+
static ID: CachedId = CachedId::new("vortex.get_item");
49+
*ID
4850
}
4951

5052
fn serialize(&self, instance: &Self::Options) -> VortexResult<Option<Vec<u8>>> {

vortex-array/src/scalar_fn/fns/is_not_null.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::fmt::Formatter;
66
use vortex_array::scalar_fn::internal::row_count::RowCount;
77
use vortex_error::VortexResult;
88
use vortex_session::VortexSession;
9+
use vortex_session::registry::CachedId;
910

1011
use crate::ArrayRef;
1112
use crate::ExecutionCtx;
@@ -34,7 +35,8 @@ impl ScalarFnVTable for IsNotNull {
3435
type Options = EmptyOptions;
3536

3637
fn id(&self) -> ScalarFnId {
37-
ScalarFnId::new("vortex.is_not_null")
38+
static ID: CachedId = CachedId::new("vortex.is_not_null");
39+
*ID
3840
}
3941

4042
fn serialize(&self, _instance: &Self::Options) -> VortexResult<Option<Vec<u8>>> {

vortex-array/src/scalar_fn/fns/is_null.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use vortex_error::VortexResult;
55
use vortex_session::VortexSession;
6+
use vortex_session::registry::CachedId;
67

78
use crate::ArrayRef;
89
use crate::ExecutionCtx;
@@ -32,7 +33,8 @@ impl ScalarFnVTable for IsNull {
3233
type Options = EmptyOptions;
3334

3435
fn id(&self) -> ScalarFnId {
35-
ScalarFnId::from("vortex.is_null")
36+
static ID: CachedId = CachedId::new("vortex.is_null");
37+
*ID
3638
}
3739

3840
fn serialize(&self, _instance: &Self::Options) -> VortexResult<Option<Vec<u8>>> {

vortex-array/src/scalar_fn/fns/like/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use vortex_error::VortexResult;
1313
use vortex_error::vortex_bail;
1414
use vortex_proto::expr as pb;
1515
use vortex_session::VortexSession;
16+
use vortex_session::registry::CachedId;
1617

1718
use crate::ArrayRef;
1819
use crate::ExecutionCtx;
@@ -63,7 +64,8 @@ impl ScalarFnVTable for Like {
6364
type Options = LikeOptions;
6465

6566
fn id(&self) -> ScalarFnId {
66-
ScalarFnId::new("vortex.like")
67+
static ID: CachedId = CachedId::new("vortex.like");
68+
*ID
6769
}
6870

6971
fn serialize(&self, instance: &Self::Options) -> VortexResult<Option<Vec<u8>>> {

0 commit comments

Comments
 (0)