Skip to content

Commit 3793d53

Browse files
b41shBohuTANG
andauthored
refactor(query): Optimize the array_agg function to reduce memory usage (#18607)
* refactor(query): Optimize the `array_agg` function to reduce memory usage * fix * Fix expected results in aggregate list test cases --------- Co-authored-by: Bohu <[email protected]>
1 parent 02a82ae commit 3793d53

File tree

7 files changed

+356
-398
lines changed

7 files changed

+356
-398
lines changed

src/query/expression/src/values.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,18 @@ impl Scalar {
514514
_ => None,
515515
}
516516
}
517+
518+
pub fn as_bytes(&self) -> Option<&[u8]> {
519+
match self {
520+
Scalar::String(val) => Some(val.as_bytes()),
521+
Scalar::Geography(val) => Some(val.0.as_slice()),
522+
Scalar::Binary(val)
523+
| Scalar::Bitmap(val)
524+
| Scalar::Variant(val)
525+
| Scalar::Geometry(val) => Some(val.as_slice()),
526+
_ => None,
527+
}
528+
}
517529
}
518530

519531
impl ScalarRef<'_> {

0 commit comments

Comments
 (0)