Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions rust/cubestore/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions rust/cubestore/cubedatasketches/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ impl Display for DataSketchesError {

impl DataSketchesError {
pub fn new<Str: ToString>(message: Str) -> Self {
return Self {
Self {
message: message.to_string(),
};
}
}
}

impl From<std::io::Error> for DataSketchesError {
fn from(err: std::io::Error) -> Self {
return DataSketchesError::new(err);
DataSketchesError::new(err)
}
}

#[cfg(not(target_os = "windows"))]
impl From<dsrs::DataSketchesError> for DataSketchesError {
fn from(err: dsrs::DataSketchesError) -> Self {
return DataSketchesError::new(err);
DataSketchesError::new(err)
}
}
16 changes: 8 additions & 8 deletions rust/cubestore/cubedatasketches/src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ impl Debug for HLLDataSketch {

impl HLLDataSketch {
pub fn read(data: &[u8]) -> Result<Self> {
return Ok(Self {
Ok(Self {
instance: HLLSketch::deserialize(data)?,
});
})
}

pub fn cardinality(&self) -> u64 {
return self.instance.estimate().round() as u64;
self.instance.estimate().round() as u64
}

pub fn get_lg_config_k(&self) -> u8 {
return self.instance.get_lg_config_k();
self.instance.get_lg_config_k()
}

pub fn write(&self) -> Vec<u8> {
// TODO(ovr): Better way?
self.instance.serialize().as_ref().iter().copied().collect()
self.instance.serialize().as_ref().to_vec()
}
}

Expand Down Expand Up @@ -80,13 +80,13 @@ impl HLLUnionDataSketch {
}

pub fn get_lg_config_k(&self) -> u8 {
return self.instance.get_lg_config_k();
self.instance.get_lg_config_k()
}

pub fn write(&self) -> Vec<u8> {
let sketch = self.instance.sketch(HLLType::HLL_4);
// TODO(ovr): Better way?
sketch.serialize().as_ref().iter().copied().collect()
sketch.serialize().as_ref().to_vec()
}

pub fn merge_with(&mut self, other: HLLDataSketch) -> Result<()> {
Expand All @@ -107,6 +107,6 @@ impl HLLUnionDataSketch {
//
// This function is supposed to be exact, but it is not exact.

return 32 + k;
32 + k
}
}
8 changes: 4 additions & 4 deletions rust/cubestore/cubehll/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ impl Display for HllError {

impl HllError {
pub fn new<Str: ToString>(message: Str) -> HllError {
return HllError {
HllError {
message: message.to_string(),
};
}
}
}

impl From<std::io::Error> for HllError {
fn from(err: std::io::Error) -> Self {
return HllError::new(err);
HllError::new(err)
}
}

impl From<serde_json::Error> for HllError {
fn from(err: serde_json::Error) -> Self {
return HllError::new(err);
HllError::new(err)
}
}
Loading
Loading