Skip to content

Commit ff9a27e

Browse files
committed
Fix UDF Error
1 parent c0436a3 commit ff9a27e

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

asap-sketch-ingest/templates/udfs/hydrakll_.rs.j2

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn hydrakll_(keys: Vec<&str>, values: Vec<f64>) -> Option<Vec<u8>> {
7979
}
8080
}
8181

82-
let sketch_data: Vec<Vec<KllSketchData>> = sketches
82+
let sketch_data: Option<Vec<Vec<KllSketchData>>> = sketches
8383
.iter()
8484
.map(|row| {
8585
row.iter()
@@ -90,9 +90,10 @@ fn hydrakll_(keys: Vec<&str>, values: Vec<f64>) -> Option<Vec<u8>> {
9090
sketch_bytes,
9191
})
9292
})
93-
.collect::<Option<Vec<_>>>()?
93+
.collect::<Option<Vec<_>>>()
9494
})
95-
.collect::<Option<Vec<_>>>()?;
95+
.collect::<Option<Vec<_>>>();
96+
let sketch_data = sketch_data?;
9697

9798
let hydra_data = HydraKllSketchData {
9899
row_num: ROW_NUM,
@@ -105,10 +106,13 @@ fn hydrakll_(keys: Vec<&str>, values: Vec<f64>) -> Option<Vec<u8>> {
105106
Some(buf)
106107
} else {
107108
// Legacy dsrs backed implementation
108-
let mut sketches: Vec<Vec<KllDoubleSketch>> = vec![
109-
vec![KllDoubleSketch::with_k(DEFAULT_K); COL_NUM];
110-
ROW_NUM
111-
];
109+
let mut sketches: Vec<Vec<KllDoubleSketch>> = (0..ROW_NUM)
110+
.map(|_| {
111+
(0..COL_NUM)
112+
.map(|_| KllDoubleSketch::with_k(DEFAULT_K))
113+
.collect()
114+
})
115+
.collect();
112116

113117
for (i, &key) in keys.iter().enumerate() {
114118
if i >= values.len() {

0 commit comments

Comments
 (0)