refactor: fix clippy lints
parent
2f3cc046f6
commit
04a59f825f
|
@ -264,7 +264,7 @@ impl Chunk {
|
||||||
if !table_meta.has_column(column_name) {
|
if !table_meta.has_column(column_name) {
|
||||||
return ColumnDoesNotExistSnafu {
|
return ColumnDoesNotExistSnafu {
|
||||||
column_name: column_name.to_string(),
|
column_name: column_name.to_string(),
|
||||||
table_name: self.table.name().to_string(),
|
table_name: self.table.name().to_owned(),
|
||||||
}
|
}
|
||||||
.fail();
|
.fail();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1543,7 +1543,7 @@ mod test {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
meta,
|
meta,
|
||||||
super::MetaData::<String> {
|
super::MetaData::<String> {
|
||||||
range: Some(("hello".to_string(), "world".to_string())),
|
range: Some(("hello".to_owned(), "world".to_owned())),
|
||||||
properties: ColumnProperties {
|
properties: ColumnProperties {
|
||||||
has_pre_computed_row_ids: true
|
has_pre_computed_row_ids: true
|
||||||
}
|
}
|
||||||
|
@ -1569,7 +1569,7 @@ mod test {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
meta,
|
meta,
|
||||||
super::MetaData::<String> {
|
super::MetaData::<String> {
|
||||||
range: Some(("hello".to_string(), "world".to_string())),
|
range: Some(("hello".to_owned(), "world".to_owned())),
|
||||||
properties: ColumnProperties {
|
properties: ColumnProperties {
|
||||||
has_pre_computed_row_ids: true
|
has_pre_computed_row_ids: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,9 +320,9 @@ mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _push(mut enc: Encoding) {
|
fn _push(mut enc: Encoding) {
|
||||||
enc.push_additional(Some("hello".to_string()), 1);
|
enc.push_additional(Some("hello".to_owned()), 1);
|
||||||
enc.push_additional(None, 3);
|
enc.push_additional(None, 3);
|
||||||
enc.push("world".to_string());
|
enc.push("world".to_owned());
|
||||||
|
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -342,7 +342,7 @@ mod test {
|
||||||
name
|
name
|
||||||
);
|
);
|
||||||
|
|
||||||
enc.push_additional(Some("zoo".to_string()), 3);
|
enc.push_additional(Some("zoo".to_owned()), 3);
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
enc.all_values(vec![]),
|
enc.all_values(vec![]),
|
||||||
|
@ -369,7 +369,7 @@ mod test {
|
||||||
// tests a defect I discovered.
|
// tests a defect I discovered.
|
||||||
#[test]
|
#[test]
|
||||||
fn push_additional_first_run_length() {
|
fn push_additional_first_run_length() {
|
||||||
let dictionary = vec!["world".to_string(), "hello".to_string()]
|
let dictionary = vec!["world".to_owned(), "hello".to_owned()]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect::<BTreeSet<String>>();
|
.collect::<BTreeSet<String>>();
|
||||||
|
|
||||||
|
@ -386,8 +386,8 @@ mod test {
|
||||||
fn _push_additional_first_run_length(mut enc: Encoding) {
|
fn _push_additional_first_run_length(mut enc: Encoding) {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
|
|
||||||
enc.push_additional(Some("world".to_string()), 1);
|
enc.push_additional(Some("world".to_owned()), 1);
|
||||||
enc.push_additional(Some("hello".to_string()), 1);
|
enc.push_additional(Some("hello".to_owned()), 1);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
enc.all_values(vec![]),
|
enc.all_values(vec![]),
|
||||||
|
@ -398,8 +398,8 @@ mod test {
|
||||||
assert_eq!(enc.all_encoded_values(vec![]), vec![2, 1], "{}", name);
|
assert_eq!(enc.all_encoded_values(vec![]), vec![2, 1], "{}", name);
|
||||||
|
|
||||||
enc = Encoding::RLE(RLE::default());
|
enc = Encoding::RLE(RLE::default());
|
||||||
enc.push_additional(Some("hello".to_string()), 1);
|
enc.push_additional(Some("hello".to_owned()), 1);
|
||||||
enc.push_additional(Some("world".to_string()), 1);
|
enc.push_additional(Some("world".to_owned()), 1);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
enc.all_values(vec![]),
|
enc.all_values(vec![]),
|
||||||
|
@ -424,11 +424,11 @@ mod test {
|
||||||
|
|
||||||
fn _row_ids_filter_equal(mut enc: Encoding) {
|
fn _row_ids_filter_equal(mut enc: Encoding) {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
enc.push_additional(Some("east".to_string()), 3); // 0, 1, 2
|
enc.push_additional(Some("east".to_owned()), 3); // 0, 1, 2
|
||||||
enc.push_additional(Some("north".to_string()), 1); // 3
|
enc.push_additional(Some("north".to_owned()), 1); // 3
|
||||||
enc.push_additional(Some("east".to_string()), 5); // 4, 5, 6, 7, 8
|
enc.push_additional(Some("east".to_owned()), 5); // 4, 5, 6, 7, 8
|
||||||
enc.push_none(); // 9
|
enc.push_none(); // 9
|
||||||
enc.push_additional(Some("south".to_string()), 2); // 10, 11
|
enc.push_additional(Some("south".to_owned()), 2); // 10, 11
|
||||||
|
|
||||||
let ids = enc.row_ids_filter("east", &cmp::Operator::Equal, RowIDs::Vector(vec![]));
|
let ids = enc.row_ids_filter("east", &cmp::Operator::Equal, RowIDs::Vector(vec![]));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -471,8 +471,8 @@ mod test {
|
||||||
|
|
||||||
fn _row_ids_filter_equal_no_null(mut enc: Encoding) {
|
fn _row_ids_filter_equal_no_null(mut enc: Encoding) {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
enc.push_additional(Some("east".to_string()), 2);
|
enc.push_additional(Some("east".to_owned()), 2);
|
||||||
enc.push_additional(Some("west".to_string()), 1);
|
enc.push_additional(Some("west".to_owned()), 1);
|
||||||
|
|
||||||
let ids = enc.row_ids_filter("abba", &cmp::Operator::NotEqual, RowIDs::Vector(vec![]));
|
let ids = enc.row_ids_filter("abba", &cmp::Operator::NotEqual, RowIDs::Vector(vec![]));
|
||||||
assert_eq!(ids, RowIDs::Vector(vec![0, 1, 2]), "{}", name);
|
assert_eq!(ids, RowIDs::Vector(vec![0, 1, 2]), "{}", name);
|
||||||
|
@ -493,14 +493,14 @@ mod test {
|
||||||
fn _row_ids_filter_cmp(mut enc: Encoding) {
|
fn _row_ids_filter_cmp(mut enc: Encoding) {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
|
|
||||||
enc.push_additional(Some("east".to_string()), 3); // 0, 1, 2
|
enc.push_additional(Some("east".to_owned()), 3); // 0, 1, 2
|
||||||
enc.push_additional(Some("north".to_string()), 1); // 3
|
enc.push_additional(Some("north".to_owned()), 1); // 3
|
||||||
enc.push_additional(Some("east".to_string()), 5); // 4, 5, 6, 7, 8
|
enc.push_additional(Some("east".to_owned()), 5); // 4, 5, 6, 7, 8
|
||||||
enc.push_additional(Some("south".to_string()), 2); // 9, 10
|
enc.push_additional(Some("south".to_owned()), 2); // 9, 10
|
||||||
enc.push_additional(Some("west".to_string()), 1); // 11
|
enc.push_additional(Some("west".to_owned()), 1); // 11
|
||||||
enc.push_additional(Some("north".to_string()), 1); // 12
|
enc.push_additional(Some("north".to_owned()), 1); // 12
|
||||||
enc.push_none(); // 13
|
enc.push_none(); // 13
|
||||||
enc.push_additional(Some("west".to_string()), 5); // 14, 15, 16, 17, 18
|
enc.push_additional(Some("west".to_owned()), 5); // 14, 15, 16, 17, 18
|
||||||
|
|
||||||
let ids = enc.row_ids_filter("east", &cmp::Operator::LTE, RowIDs::Vector(vec![]));
|
let ids = enc.row_ids_filter("east", &cmp::Operator::LTE, RowIDs::Vector(vec![]));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -625,7 +625,7 @@ mod test {
|
||||||
|
|
||||||
for enc in encodings.iter_mut() {
|
for enc in encodings.iter_mut() {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
enc.push("east".to_string());
|
enc.push("east".to_owned());
|
||||||
|
|
||||||
let ids = enc.row_ids_filter("east", &cmp::Operator::GT, RowIDs::Vector(vec![]));
|
let ids = enc.row_ids_filter("east", &cmp::Operator::GT, RowIDs::Vector(vec![]));
|
||||||
assert!(ids.is_empty(), "{}", name);
|
assert!(ids.is_empty(), "{}", name);
|
||||||
|
@ -661,7 +661,7 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn row_ids_filter_cmp_with_null() {
|
fn row_ids_filter_cmp_with_null() {
|
||||||
let dictionary = vec!["east".to_string(), "south".to_string(), "west".to_string()]
|
let dictionary = vec!["east".to_owned(), "south".to_owned(), "west".to_owned()]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect::<BTreeSet<String>>();
|
.collect::<BTreeSet<String>>();
|
||||||
|
|
||||||
|
@ -672,10 +672,10 @@ mod test {
|
||||||
|
|
||||||
for enc in encodings.iter_mut() {
|
for enc in encodings.iter_mut() {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
enc.push("south".to_string());
|
enc.push("south".to_owned());
|
||||||
enc.push("west".to_string());
|
enc.push("west".to_owned());
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push("east".to_string());
|
enc.push("east".to_owned());
|
||||||
|
|
||||||
let ids = enc.row_ids_filter("west", &cmp::Operator::GT, RowIDs::Vector(vec![]));
|
let ids = enc.row_ids_filter("west", &cmp::Operator::GT, RowIDs::Vector(vec![]));
|
||||||
assert!(ids.is_empty(), "{}", name);
|
assert!(ids.is_empty(), "{}", name);
|
||||||
|
@ -723,11 +723,11 @@ mod test {
|
||||||
|
|
||||||
fn _row_ids_null(mut enc: Encoding) {
|
fn _row_ids_null(mut enc: Encoding) {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
enc.push_additional(Some("east".to_string()), 3); // 0, 1, 2
|
enc.push_additional(Some("east".to_owned()), 3); // 0, 1, 2
|
||||||
enc.push_additional(None, 3); // 3, 4, 5
|
enc.push_additional(None, 3); // 3, 4, 5
|
||||||
enc.push_additional(Some("north".to_string()), 1); // 6
|
enc.push_additional(Some("north".to_owned()), 1); // 6
|
||||||
enc.push_additional(None, 2); // 7, 8
|
enc.push_additional(None, 2); // 7, 8
|
||||||
enc.push_additional(Some("south".to_string()), 2); // 9, 10
|
enc.push_additional(Some("south".to_owned()), 2); // 9, 10
|
||||||
|
|
||||||
// essentially `WHERE value IS NULL`
|
// essentially `WHERE value IS NULL`
|
||||||
let ids = enc.row_ids_null(RowIDs::Vector(vec![]));
|
let ids = enc.row_ids_null(RowIDs::Vector(vec![]));
|
||||||
|
@ -753,10 +753,10 @@ mod test {
|
||||||
fn _group_row_ids(mut enc: Encoding) {
|
fn _group_row_ids(mut enc: Encoding) {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
|
|
||||||
enc.push_additional(Some("east".to_string()), 4); // 0, 1, 2, 3
|
enc.push_additional(Some("east".to_owned()), 4); // 0, 1, 2, 3
|
||||||
enc.push_additional(Some("west".to_string()), 2); // 4, 5
|
enc.push_additional(Some("west".to_owned()), 2); // 4, 5
|
||||||
enc.push_none(); // 6
|
enc.push_none(); // 6
|
||||||
enc.push_additional(Some("zoo".to_string()), 1); // 7
|
enc.push_additional(Some("zoo".to_owned()), 1); // 7
|
||||||
|
|
||||||
match enc {
|
match enc {
|
||||||
Encoding::RLE(_) => {
|
Encoding::RLE(_) => {
|
||||||
|
@ -804,10 +804,10 @@ mod test {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
assert!(enc.dictionary().is_empty());
|
assert!(enc.dictionary().is_empty());
|
||||||
|
|
||||||
enc.push_additional(Some("east".to_string()), 23);
|
enc.push_additional(Some("east".to_owned()), 23);
|
||||||
enc.push_additional(Some("west".to_string()), 2);
|
enc.push_additional(Some("west".to_owned()), 2);
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push_additional(Some("zoo".to_string()), 1);
|
enc.push_additional(Some("zoo".to_owned()), 1);
|
||||||
|
|
||||||
assert_eq!(enc.dictionary(), vec!["east", "west", "zoo"], "{}", name);
|
assert_eq!(enc.dictionary(), vec!["east", "west", "zoo"], "{}", name);
|
||||||
}
|
}
|
||||||
|
@ -825,15 +825,15 @@ mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _value(mut enc: Encoding) {
|
fn _value(mut enc: Encoding) {
|
||||||
enc.push_additional(Some("east".to_string()), 3); // 0, 1, 2
|
enc.push_additional(Some("east".to_owned()), 3); // 0, 1, 2
|
||||||
enc.push_additional(Some("north".to_string()), 1); // 3
|
enc.push_additional(Some("north".to_owned()), 1); // 3
|
||||||
enc.push_additional(Some("east".to_string()), 5); // 4, 5, 6, 7, 8
|
enc.push_additional(Some("east".to_owned()), 5); // 4, 5, 6, 7, 8
|
||||||
enc.push_additional(Some("south".to_string()), 2); // 9, 10
|
enc.push_additional(Some("south".to_owned()), 2); // 9, 10
|
||||||
enc.push_none(); // 11
|
enc.push_none(); // 11
|
||||||
|
|
||||||
assert_eq!(enc.value(3), Some(&"north".to_string()));
|
assert_eq!(enc.value(3), Some(&"north".to_owned()));
|
||||||
assert_eq!(enc.value(0), Some(&"east".to_string()));
|
assert_eq!(enc.value(0), Some(&"east".to_owned()));
|
||||||
assert_eq!(enc.value(10), Some(&"south".to_string()));
|
assert_eq!(enc.value(10), Some(&"south".to_owned()));
|
||||||
assert_eq!(enc.value(11), None);
|
assert_eq!(enc.value(11), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,11 +841,11 @@ mod test {
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn value_bounds() {
|
fn value_bounds() {
|
||||||
let mut enc = RLE::default();
|
let mut enc = RLE::default();
|
||||||
enc.push("b".to_string());
|
enc.push("b".to_owned());
|
||||||
enc.value(100);
|
enc.value(100);
|
||||||
|
|
||||||
let mut enc = Dictionary::default();
|
let mut enc = Dictionary::default();
|
||||||
enc.push("b".to_string());
|
enc.push("b".to_owned());
|
||||||
enc.value(100);
|
enc.value(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -864,10 +864,10 @@ mod test {
|
||||||
fn _values(mut enc: Encoding) {
|
fn _values(mut enc: Encoding) {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
|
|
||||||
enc.push_additional(Some("east".to_string()), 3); // 0, 1, 2
|
enc.push_additional(Some("east".to_owned()), 3); // 0, 1, 2
|
||||||
enc.push_additional(Some("north".to_string()), 1); // 3
|
enc.push_additional(Some("north".to_owned()), 1); // 3
|
||||||
enc.push_additional(Some("east".to_string()), 5); // 4, 5, 6, 7, 8
|
enc.push_additional(Some("east".to_owned()), 5); // 4, 5, 6, 7, 8
|
||||||
enc.push_additional(Some("south".to_string()), 2); // 9, 10
|
enc.push_additional(Some("south".to_owned()), 2); // 9, 10
|
||||||
enc.push_none(); // 11
|
enc.push_none(); // 11
|
||||||
|
|
||||||
let mut dst = Vec::with_capacity(1000);
|
let mut dst = Vec::with_capacity(1000);
|
||||||
|
@ -925,10 +925,10 @@ mod test {
|
||||||
fn _encoded_values(mut enc: Encoding) {
|
fn _encoded_values(mut enc: Encoding) {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
|
|
||||||
enc.push_additional(Some("east".to_string()), 3); // 0, 1, 2
|
enc.push_additional(Some("east".to_owned()), 3); // 0, 1, 2
|
||||||
enc.push_additional(Some("north".to_string()), 1); // 3
|
enc.push_additional(Some("north".to_owned()), 1); // 3
|
||||||
enc.push_additional(Some("east".to_string()), 5); // 4, 5, 6, 7, 8
|
enc.push_additional(Some("east".to_owned()), 5); // 4, 5, 6, 7, 8
|
||||||
enc.push_additional(Some("south".to_string()), 2); // 9, 10
|
enc.push_additional(Some("south".to_owned()), 2); // 9, 10
|
||||||
enc.push_none(); // 11
|
enc.push_none(); // 11
|
||||||
|
|
||||||
let mut encoded = enc.encoded_values(&[0], vec![]);
|
let mut encoded = enc.encoded_values(&[0], vec![]);
|
||||||
|
@ -956,9 +956,9 @@ mod test {
|
||||||
fn _all_encoded_values(mut enc: Encoding) {
|
fn _all_encoded_values(mut enc: Encoding) {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
|
|
||||||
enc.push_additional(Some("east".to_string()), 3);
|
enc.push_additional(Some("east".to_owned()), 3);
|
||||||
enc.push_additional(None, 2);
|
enc.push_additional(None, 2);
|
||||||
enc.push_additional(Some("north".to_string()), 2);
|
enc.push_additional(Some("north".to_owned()), 2);
|
||||||
|
|
||||||
let dst = Vec::with_capacity(100);
|
let dst = Vec::with_capacity(100);
|
||||||
let dst = enc.all_encoded_values(dst);
|
let dst = enc.all_encoded_values(dst);
|
||||||
|
@ -1026,7 +1026,7 @@ mod test {
|
||||||
fn _distinct_values(mut enc: Encoding) {
|
fn _distinct_values(mut enc: Encoding) {
|
||||||
let name = enc.debug_name();
|
let name = enc.debug_name();
|
||||||
|
|
||||||
enc.push_additional(Some("east".to_string()), 3);
|
enc.push_additional(Some("east".to_owned()), 3);
|
||||||
|
|
||||||
let values = enc.distinct_values((0..3).collect::<Vec<_>>().into_iter(), BTreeSet::new());
|
let values = enc.distinct_values((0..3).collect::<Vec<_>>().into_iter(), BTreeSet::new());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -1036,9 +1036,9 @@ mod test {
|
||||||
name,
|
name,
|
||||||
);
|
);
|
||||||
|
|
||||||
enc.push_additional(Some("north".to_string()), 1); // 3
|
enc.push_additional(Some("north".to_owned()), 1); // 3
|
||||||
enc.push_additional(Some("east".to_string()), 5); // 4, 5, 6, 7, 8
|
enc.push_additional(Some("east".to_owned()), 5); // 4, 5, 6, 7, 8
|
||||||
enc.push_additional(Some("south".to_string()), 2); // 9, 10
|
enc.push_additional(Some("south".to_owned()), 2); // 9, 10
|
||||||
enc.push_none(); // 11
|
enc.push_none(); // 11
|
||||||
|
|
||||||
let values = enc.distinct_values((0..12).collect::<Vec<_>>().into_iter(), BTreeSet::new());
|
let values = enc.distinct_values((0..12).collect::<Vec<_>>().into_iter(), BTreeSet::new());
|
||||||
|
@ -1112,10 +1112,10 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn has_non_null_value() {
|
fn has_non_null_value() {
|
||||||
let mut enc = Encoding::RLE(RLE::default());
|
let mut enc = Encoding::RLE(RLE::default());
|
||||||
enc.push_additional(Some("east".to_string()), 3); // 0, 1, 2
|
enc.push_additional(Some("east".to_owned()), 3); // 0, 1, 2
|
||||||
enc.push_additional(Some("north".to_string()), 1); // 3
|
enc.push_additional(Some("north".to_owned()), 1); // 3
|
||||||
enc.push_additional(Some("east".to_string()), 5); // 4, 5, 6, 7, 8
|
enc.push_additional(Some("east".to_owned()), 5); // 4, 5, 6, 7, 8
|
||||||
enc.push_additional(Some("south".to_string()), 2); // 9, 10
|
enc.push_additional(Some("south".to_owned()), 2); // 9, 10
|
||||||
enc.push_none(); // 11
|
enc.push_none(); // 11
|
||||||
|
|
||||||
assert!(enc.has_non_null_value(&[0]));
|
assert!(enc.has_non_null_value(&[0]));
|
||||||
|
@ -1135,13 +1135,13 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn min() {
|
fn min() {
|
||||||
let mut enc = Encoding::RLE(RLE::default());
|
let mut enc = Encoding::RLE(RLE::default());
|
||||||
enc.push_additional(Some("east".to_string()), 3); // 0, 1, 2
|
enc.push_additional(Some("east".to_owned()), 3); // 0, 1, 2
|
||||||
enc.push_additional(None, 2); // 3, 4
|
enc.push_additional(None, 2); // 3, 4
|
||||||
enc.push_additional(Some("north".to_string()), 2); // 5, 6
|
enc.push_additional(Some("north".to_owned()), 2); // 5, 6
|
||||||
|
|
||||||
assert_eq!(enc.min(&[0, 1, 2]), Some(&"east".to_string()));
|
assert_eq!(enc.min(&[0, 1, 2]), Some(&"east".to_owned()));
|
||||||
assert_eq!(enc.min(&[0, 1, 2, 3, 4, 5, 6]), Some(&"east".to_string()));
|
assert_eq!(enc.min(&[0, 1, 2, 3, 4, 5, 6]), Some(&"east".to_owned()));
|
||||||
assert_eq!(enc.min(&[4, 5, 6]), Some(&"north".to_string()));
|
assert_eq!(enc.min(&[4, 5, 6]), Some(&"north".to_owned()));
|
||||||
assert_eq!(enc.min(&[3]), None);
|
assert_eq!(enc.min(&[3]), None);
|
||||||
assert_eq!(enc.min(&[3, 4]), None);
|
assert_eq!(enc.min(&[3, 4]), None);
|
||||||
|
|
||||||
|
@ -1153,13 +1153,13 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn max() {
|
fn max() {
|
||||||
let mut enc = Encoding::RLE(RLE::default());
|
let mut enc = Encoding::RLE(RLE::default());
|
||||||
enc.push_additional(Some("east".to_string()), 3); // 0, 1, 2
|
enc.push_additional(Some("east".to_owned()), 3); // 0, 1, 2
|
||||||
enc.push_additional(None, 2); // 3, 4
|
enc.push_additional(None, 2); // 3, 4
|
||||||
enc.push_additional(Some("north".to_string()), 2); // 5, 6
|
enc.push_additional(Some("north".to_owned()), 2); // 5, 6
|
||||||
|
|
||||||
assert_eq!(enc.max(&[0, 1, 2]), Some(&"east".to_string()));
|
assert_eq!(enc.max(&[0, 1, 2]), Some(&"east".to_owned()));
|
||||||
assert_eq!(enc.max(&[0, 1, 2, 3, 4, 5, 6]), Some(&"north".to_string()));
|
assert_eq!(enc.max(&[0, 1, 2, 3, 4, 5, 6]), Some(&"north".to_owned()));
|
||||||
assert_eq!(enc.max(&[4, 5, 6]), Some(&"north".to_string()));
|
assert_eq!(enc.max(&[4, 5, 6]), Some(&"north".to_owned()));
|
||||||
assert_eq!(enc.max(&[3]), None);
|
assert_eq!(enc.max(&[3]), None);
|
||||||
assert_eq!(enc.max(&[3, 4]), None);
|
assert_eq!(enc.max(&[3, 4]), None);
|
||||||
|
|
||||||
|
@ -1174,9 +1174,9 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn count() {
|
fn count() {
|
||||||
let mut enc = Encoding::RLE(RLE::default());
|
let mut enc = Encoding::RLE(RLE::default());
|
||||||
enc.push_additional(Some("east".to_string()), 3); // 0, 1, 2
|
enc.push_additional(Some("east".to_owned()), 3); // 0, 1, 2
|
||||||
enc.push_additional(None, 2); // 3, 4
|
enc.push_additional(None, 2); // 3, 4
|
||||||
enc.push_additional(Some("north".to_string()), 2); // 5, 6
|
enc.push_additional(Some("north".to_owned()), 2); // 5, 6
|
||||||
|
|
||||||
assert_eq!(enc.count(&[0, 1, 2]), 3);
|
assert_eq!(enc.count(&[0, 1, 2]), 3);
|
||||||
assert_eq!(enc.count(&[0, 1, 2, 3, 4, 5, 6]), 5);
|
assert_eq!(enc.count(&[0, 1, 2, 3, 4, 5, 6]), 5);
|
||||||
|
|
|
@ -796,7 +796,7 @@ impl<'a> From<Vec<&str>> for Dictionary {
|
||||||
fn from(vec: Vec<&str>) -> Self {
|
fn from(vec: Vec<&str>) -> Self {
|
||||||
let mut enc = Self::default();
|
let mut enc = Self::default();
|
||||||
for v in vec {
|
for v in vec {
|
||||||
enc.push(v.to_string());
|
enc.push(v.to_owned());
|
||||||
}
|
}
|
||||||
enc
|
enc
|
||||||
}
|
}
|
||||||
|
@ -817,7 +817,7 @@ impl<'a> From<Vec<Option<&str>>> for Dictionary {
|
||||||
let mut drle = Self::default();
|
let mut drle = Self::default();
|
||||||
for v in vec {
|
for v in vec {
|
||||||
match v {
|
match v {
|
||||||
Some(x) => drle.push(x.to_string()),
|
Some(x) => drle.push(x.to_owned()),
|
||||||
None => drle.push_none(),
|
None => drle.push_none(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -874,23 +874,23 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn with_dictionary() {
|
fn with_dictionary() {
|
||||||
let mut dictionary = BTreeSet::new();
|
let mut dictionary = BTreeSet::new();
|
||||||
dictionary.insert("hello".to_string());
|
dictionary.insert("hello".to_owned());
|
||||||
dictionary.insert("world".to_string());
|
dictionary.insert("world".to_owned());
|
||||||
|
|
||||||
let enc = Dictionary::with_dictionary(dictionary);
|
let enc = Dictionary::with_dictionary(dictionary);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
enc.entries,
|
enc.entries,
|
||||||
vec![None, Some("hello".to_string()), Some("world".to_string()),]
|
vec![None, Some("hello".to_owned()), Some("world".to_owned()),]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn size() {
|
fn size() {
|
||||||
let mut enc = Dictionary::default();
|
let mut enc = Dictionary::default();
|
||||||
enc.push_additional(Some("east".to_string()), 3);
|
enc.push_additional(Some("east".to_owned()), 3);
|
||||||
enc.push_additional(Some("north".to_string()), 1);
|
enc.push_additional(Some("north".to_owned()), 1);
|
||||||
enc.push_additional(Some("east".to_string()), 5);
|
enc.push_additional(Some("east".to_owned()), 5);
|
||||||
enc.push_additional(Some("south".to_string()), 2);
|
enc.push_additional(Some("south".to_owned()), 2);
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
|
@ -909,9 +909,9 @@ mod test {
|
||||||
enc.entries,
|
enc.entries,
|
||||||
vec![
|
vec![
|
||||||
None,
|
None,
|
||||||
Some("east".to_string()),
|
Some("east".to_owned()),
|
||||||
Some("north".to_string()),
|
Some("north".to_owned()),
|
||||||
Some("south".to_string())
|
Some("south".to_owned())
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -923,10 +923,10 @@ mod test {
|
||||||
let mut enc = Dictionary::default();
|
let mut enc = Dictionary::default();
|
||||||
enc.encoded_data.reserve_exact(40);
|
enc.encoded_data.reserve_exact(40);
|
||||||
enc.entries.reserve_exact(39); // account for already-allocated NULL element
|
enc.entries.reserve_exact(39); // account for already-allocated NULL element
|
||||||
enc.push_additional(Some("east".to_string()), 3);
|
enc.push_additional(Some("east".to_owned()), 3);
|
||||||
enc.push_additional(Some("north".to_string()), 1);
|
enc.push_additional(Some("north".to_owned()), 1);
|
||||||
enc.push_additional(Some("east".to_string()), 5);
|
enc.push_additional(Some("east".to_owned()), 5);
|
||||||
enc.push_additional(Some("south".to_string()), 2);
|
enc.push_additional(Some("south".to_owned()), 2);
|
||||||
enc.push_additional(None, 4);
|
enc.push_additional(None, 4);
|
||||||
|
|
||||||
// Self - 24+24+8 = 56 bytes (two vectors, a bool and padding)
|
// Self - 24+24+8 = 56 bytes (two vectors, a bool and padding)
|
||||||
|
@ -941,10 +941,10 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn null_count() {
|
fn null_count() {
|
||||||
let mut enc = Dictionary::default();
|
let mut enc = Dictionary::default();
|
||||||
enc.push_additional(Some("east".to_string()), 3);
|
enc.push_additional(Some("east".to_owned()), 3);
|
||||||
assert_eq!(enc.null_count(), 0);
|
assert_eq!(enc.null_count(), 0);
|
||||||
|
|
||||||
enc.push_additional(Some("west".to_string()), 1);
|
enc.push_additional(Some("west".to_owned()), 1);
|
||||||
assert_eq!(enc.null_count(), 0);
|
assert_eq!(enc.null_count(), 0);
|
||||||
|
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
|
@ -958,8 +958,8 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn size_raw() {
|
fn size_raw() {
|
||||||
let mut enc = Dictionary::default();
|
let mut enc = Dictionary::default();
|
||||||
enc.push_additional(Some("a longer string".to_string()), 3);
|
enc.push_additional(Some("a longer string".to_owned()), 3);
|
||||||
enc.push_additional(Some("south".to_string()), 2);
|
enc.push_additional(Some("south".to_owned()), 2);
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
|
@ -984,8 +984,8 @@ mod test {
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn push_wrong_order() {
|
fn push_wrong_order() {
|
||||||
let mut enc = Dictionary::default();
|
let mut enc = Dictionary::default();
|
||||||
enc.push("b".to_string());
|
enc.push("b".to_owned());
|
||||||
enc.push("a".to_string());
|
enc.push("a".to_owned());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -996,7 +996,7 @@ mod test {
|
||||||
|
|
||||||
assert!(!enc.has_non_null_value(&[0, 1]));
|
assert!(!enc.has_non_null_value(&[0, 1]));
|
||||||
|
|
||||||
enc.push("b".to_string());
|
enc.push("b".to_owned());
|
||||||
assert!(enc.has_non_null_value(&[0, 1, 2]));
|
assert!(enc.has_non_null_value(&[0, 1, 2]));
|
||||||
assert!(enc.has_non_null_value(&[2]));
|
assert!(enc.has_non_null_value(&[2]));
|
||||||
assert!(!enc.has_non_null_value(&[0, 1]));
|
assert!(!enc.has_non_null_value(&[0, 1]));
|
||||||
|
@ -1010,7 +1010,7 @@ mod test {
|
||||||
|
|
||||||
assert!(!enc.has_any_non_null_value());
|
assert!(!enc.has_any_non_null_value());
|
||||||
|
|
||||||
enc.push("b".to_string());
|
enc.push("b".to_owned());
|
||||||
assert!(enc.has_any_non_null_value());
|
assert!(enc.has_any_non_null_value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ impl Default for RLE {
|
||||||
assert_eq!(NULL_ID, 0);
|
assert_eq!(NULL_ID, 0);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
index_entries: vec!["".to_string()],
|
index_entries: vec!["".to_owned()],
|
||||||
index_row_ids: vec![RowIDs::new_bitmap()], // index 0 for NULL value
|
index_row_ids: vec![RowIDs::new_bitmap()], // index 0 for NULL value
|
||||||
run_lengths: Vec::new(),
|
run_lengths: Vec::new(),
|
||||||
contains_null: false,
|
contains_null: false,
|
||||||
|
@ -910,7 +910,7 @@ impl<'a> From<Vec<&str>> for RLE {
|
||||||
fn from(vec: Vec<&str>) -> Self {
|
fn from(vec: Vec<&str>) -> Self {
|
||||||
let mut drle = Self::default();
|
let mut drle = Self::default();
|
||||||
for v in vec {
|
for v in vec {
|
||||||
drle.push(v.to_string());
|
drle.push(v.to_owned());
|
||||||
}
|
}
|
||||||
drle
|
drle
|
||||||
}
|
}
|
||||||
|
@ -931,7 +931,7 @@ impl<'a> From<Vec<Option<&str>>> for RLE {
|
||||||
let mut drle = Self::default();
|
let mut drle = Self::default();
|
||||||
for v in vec {
|
for v in vec {
|
||||||
match v {
|
match v {
|
||||||
Some(x) => drle.push(x.to_string()),
|
Some(x) => drle.push(x.to_owned()),
|
||||||
None => drle.push_none(),
|
None => drle.push_none(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -959,7 +959,7 @@ impl<'a> From<StringArray> for RLE {
|
||||||
if arr.is_null(i) {
|
if arr.is_null(i) {
|
||||||
drle.push_none();
|
drle.push_none();
|
||||||
} else {
|
} else {
|
||||||
drle.push(arr.value(i).to_string());
|
drle.push(arr.value(i).to_owned());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drle
|
drle
|
||||||
|
@ -990,8 +990,8 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn with_dictionary() {
|
fn with_dictionary() {
|
||||||
let mut dictionary = BTreeSet::new();
|
let mut dictionary = BTreeSet::new();
|
||||||
dictionary.insert("hello".to_string());
|
dictionary.insert("hello".to_owned());
|
||||||
dictionary.insert("world".to_string());
|
dictionary.insert("world".to_owned());
|
||||||
|
|
||||||
let drle = RLE::with_dictionary(dictionary);
|
let drle = RLE::with_dictionary(dictionary);
|
||||||
assert_eq!(drle.index_entries.as_slice(), &["", "hello", "world"]);
|
assert_eq!(drle.index_entries.as_slice(), &["", "hello", "world"]);
|
||||||
|
@ -1001,10 +1001,10 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn size() {
|
fn size() {
|
||||||
let mut enc = RLE::default();
|
let mut enc = RLE::default();
|
||||||
enc.push_additional(Some("east".to_string()), 3);
|
enc.push_additional(Some("east".to_owned()), 3);
|
||||||
enc.push_additional(Some("north".to_string()), 1);
|
enc.push_additional(Some("north".to_owned()), 1);
|
||||||
enc.push_additional(Some("east".to_string()), 5);
|
enc.push_additional(Some("east".to_owned()), 5);
|
||||||
enc.push_additional(Some("south".to_string()), 2);
|
enc.push_additional(Some("south".to_owned()), 2);
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
|
@ -1022,10 +1022,10 @@ mod test {
|
||||||
enc.index_entries.reserve_exact(39); // account for already-allocated NULL element
|
enc.index_entries.reserve_exact(39); // account for already-allocated NULL element
|
||||||
enc.run_lengths.reserve_exact(40);
|
enc.run_lengths.reserve_exact(40);
|
||||||
|
|
||||||
enc.push_additional(Some("east".to_string()), 3);
|
enc.push_additional(Some("east".to_owned()), 3);
|
||||||
enc.push_additional(Some("north".to_string()), 1);
|
enc.push_additional(Some("north".to_owned()), 1);
|
||||||
enc.push_additional(Some("east".to_string()), 5);
|
enc.push_additional(Some("east".to_owned()), 5);
|
||||||
enc.push_additional(Some("south".to_string()), 2);
|
enc.push_additional(Some("south".to_owned()), 2);
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
|
@ -1042,10 +1042,10 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn null_count() {
|
fn null_count() {
|
||||||
let mut enc = RLE::default();
|
let mut enc = RLE::default();
|
||||||
enc.push_additional(Some("east".to_string()), 3);
|
enc.push_additional(Some("east".to_owned()), 3);
|
||||||
assert_eq!(enc.null_count(), 0);
|
assert_eq!(enc.null_count(), 0);
|
||||||
|
|
||||||
enc.push_additional(Some("west".to_string()), 1);
|
enc.push_additional(Some("west".to_owned()), 1);
|
||||||
assert_eq!(enc.null_count(), 0);
|
assert_eq!(enc.null_count(), 0);
|
||||||
|
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
|
@ -1059,8 +1059,8 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn size_raw() {
|
fn size_raw() {
|
||||||
let mut enc = RLE::default();
|
let mut enc = RLE::default();
|
||||||
enc.push_additional(Some("a longer string".to_string()), 3);
|
enc.push_additional(Some("a longer string".to_owned()), 3);
|
||||||
enc.push_additional(Some("south".to_string()), 2);
|
enc.push_additional(Some("south".to_owned()), 2);
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
enc.push_none();
|
enc.push_none();
|
||||||
|
@ -1085,7 +1085,7 @@ mod test {
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn push_wrong_order() {
|
fn push_wrong_order() {
|
||||||
let mut enc = RLE::default();
|
let mut enc = RLE::default();
|
||||||
enc.push("b".to_string());
|
enc.push("b".to_owned());
|
||||||
enc.push("a".to_string());
|
enc.push("a".to_owned());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,7 +271,7 @@ impl From<&[f64]> for FloatEncoding {
|
||||||
NoOpTranscoder {}, // No transcoding of values (store as physical type f64)
|
NoOpTranscoder {}, // No transcoding of values (store as physical type f64)
|
||||||
));
|
));
|
||||||
let name = enc.name();
|
let name = enc.name();
|
||||||
return Self::F64(enc, name.to_string());
|
return Self::F64(enc, name.to_owned());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't apply a compression encoding to the column
|
// Don't apply a compression encoding to the column
|
||||||
|
|
|
@ -445,7 +445,7 @@ impl From<arrow::array::StringArray> for StringEncoding {
|
||||||
}
|
}
|
||||||
|
|
||||||
match prev {
|
match prev {
|
||||||
Some(x) => data.push_additional(Some(x.to_string()), count),
|
Some(x) => data.push_additional(Some(x.to_owned()), count),
|
||||||
None => data.push_additional(None, count),
|
None => data.push_additional(None, count),
|
||||||
}
|
}
|
||||||
prev = next;
|
prev = next;
|
||||||
|
@ -454,7 +454,7 @@ impl From<arrow::array::StringArray> for StringEncoding {
|
||||||
|
|
||||||
// Add final batch to column if any
|
// Add final batch to column if any
|
||||||
match prev {
|
match prev {
|
||||||
Some(x) => data.push_additional(Some(x.to_string()), count),
|
Some(x) => data.push_additional(Some(x.to_owned()), count),
|
||||||
None => data.push_additional(None, count),
|
None => data.push_additional(None, count),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ impl From<arrow::array::DictionaryArray<arrow::datatypes::Int32Type>> for String
|
||||||
}
|
}
|
||||||
|
|
||||||
match prev {
|
match prev {
|
||||||
Some(x) => data.push_additional(Some(values.value(x as usize).to_string()), count),
|
Some(x) => data.push_additional(Some(values.value(x as usize).to_owned()), count),
|
||||||
None => data.push_additional(None, count),
|
None => data.push_additional(None, count),
|
||||||
}
|
}
|
||||||
prev = next;
|
prev = next;
|
||||||
|
@ -519,7 +519,7 @@ impl From<arrow::array::DictionaryArray<arrow::datatypes::Int32Type>> for String
|
||||||
|
|
||||||
// Add final batch to column if any
|
// Add final batch to column if any
|
||||||
match prev {
|
match prev {
|
||||||
Some(x) => data.push_additional(Some(values.value(x as usize).to_string()), count),
|
Some(x) => data.push_additional(Some(values.value(x as usize).to_owned()), count),
|
||||||
None => data.push_additional(None, count),
|
None => data.push_additional(None, count),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2552,9 +2552,9 @@ mod test {
|
||||||
fn size() {
|
fn size() {
|
||||||
let mut columns = vec![];
|
let mut columns = vec![];
|
||||||
let rc = ColumnType::Tag(Column::from(&[Some("west"), Some("west"), None, None][..]));
|
let rc = ColumnType::Tag(Column::from(&[Some("west"), Some("west"), None, None][..]));
|
||||||
columns.push(("region".to_string(), rc));
|
columns.push(("region".to_owned(), rc));
|
||||||
let tc = ColumnType::Time(Column::from(&[100_i64, 200, 500, 600][..]));
|
let tc = ColumnType::Time(Column::from(&[100_i64, 200, 500, 600][..]));
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
|
|
||||||
let row_group = RowGroup::new(4, columns);
|
let row_group = RowGroup::new(4, columns);
|
||||||
|
|
||||||
|
@ -2566,9 +2566,9 @@ mod test {
|
||||||
let track = ColumnType::Tag(Column::from(
|
let track = ColumnType::Tag(Column::from(
|
||||||
&[Some("Thinking"), Some("of"), Some("a"), Some("place")][..],
|
&[Some("Thinking"), Some("of"), Some("a"), Some("place")][..],
|
||||||
));
|
));
|
||||||
columns.push(("track".to_string(), track));
|
columns.push(("track".to_owned(), track));
|
||||||
let tc = ColumnType::Time(Column::from(&[100_i64, 200, 500, 600][..]));
|
let tc = ColumnType::Time(Column::from(&[100_i64, 200, 500, 600][..]));
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
|
|
||||||
let row_group = RowGroup::new(4, columns);
|
let row_group = RowGroup::new(4, columns);
|
||||||
|
|
||||||
|
@ -2579,11 +2579,11 @@ mod test {
|
||||||
fn row_ids_from_predicates() {
|
fn row_ids_from_predicates() {
|
||||||
let mut columns = vec![];
|
let mut columns = vec![];
|
||||||
let tc = ColumnType::Time(Column::from(&[100_i64, 200, 500, 600, 300, 300][..]));
|
let tc = ColumnType::Time(Column::from(&[100_i64, 200, 500, 600, 300, 300][..]));
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
let rc = ColumnType::Tag(Column::from(
|
let rc = ColumnType::Tag(Column::from(
|
||||||
&["west", "west", "east", "west", "south", "north"][..],
|
&["west", "west", "east", "west", "south", "north"][..],
|
||||||
));
|
));
|
||||||
columns.push(("region".to_string(), rc));
|
columns.push(("region".to_owned(), rc));
|
||||||
let row_group = RowGroup::new(6, columns);
|
let row_group = RowGroup::new(6, columns);
|
||||||
|
|
||||||
// Closed partially covering "time range" predicate
|
// Closed partially covering "time range" predicate
|
||||||
|
@ -2662,11 +2662,11 @@ mod test {
|
||||||
fn row_ids_from_delete_predicates() {
|
fn row_ids_from_delete_predicates() {
|
||||||
let mut columns = vec![];
|
let mut columns = vec![];
|
||||||
let tc = ColumnType::Time(Column::from(&[100_i64, 200, 500, 600, 300, 300][..]));
|
let tc = ColumnType::Time(Column::from(&[100_i64, 200, 500, 600, 300, 300][..]));
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
let rc = ColumnType::Tag(Column::from(
|
let rc = ColumnType::Tag(Column::from(
|
||||||
&["west", "west", "east", "west", "south", "north"][..],
|
&["west", "west", "east", "west", "south", "north"][..],
|
||||||
));
|
));
|
||||||
columns.push(("region".to_string(), rc));
|
columns.push(("region".to_owned(), rc));
|
||||||
let row_group = RowGroup::new(6, columns);
|
let row_group = RowGroup::new(6, columns);
|
||||||
|
|
||||||
// No predicates means nothing to delete
|
// No predicates means nothing to delete
|
||||||
|
@ -2759,7 +2759,7 @@ mod test {
|
||||||
fn _read_filter_setup() -> RowGroup {
|
fn _read_filter_setup() -> RowGroup {
|
||||||
let mut columns = vec![];
|
let mut columns = vec![];
|
||||||
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5, 6, 8][..]));
|
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5, 6, 8][..]));
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
|
|
||||||
let rc = ColumnType::Tag(Column::from(
|
let rc = ColumnType::Tag(Column::from(
|
||||||
&[
|
&[
|
||||||
|
@ -2772,15 +2772,15 @@ mod test {
|
||||||
None,
|
None,
|
||||||
][..],
|
][..],
|
||||||
));
|
));
|
||||||
columns.push(("region".to_string(), rc));
|
columns.push(("region".to_owned(), rc));
|
||||||
|
|
||||||
let mc = ColumnType::Tag(Column::from(
|
let mc = ColumnType::Tag(Column::from(
|
||||||
&["GET", "POST", "POST", "POST", "PUT", "GET", "PATCH"][..],
|
&["GET", "POST", "POST", "POST", "PUT", "GET", "PATCH"][..],
|
||||||
));
|
));
|
||||||
columns.push(("method".to_string(), mc));
|
columns.push(("method".to_owned(), mc));
|
||||||
|
|
||||||
let fc = ColumnType::Field(Column::from(&[100_u64, 101, 200, 203, 203, 10, 29][..]));
|
let fc = ColumnType::Field(Column::from(&[100_u64, 101, 200, 203, 203, 10, 29][..]));
|
||||||
columns.push(("count".to_string(), fc));
|
columns.push(("count".to_owned(), fc));
|
||||||
|
|
||||||
RowGroup::new(7, columns)
|
RowGroup::new(7, columns)
|
||||||
}
|
}
|
||||||
|
@ -2918,25 +2918,25 @@ POST,west,2
|
||||||
fn read_filter_bug_1860() {
|
fn read_filter_bug_1860() {
|
||||||
let mut columns = vec![];
|
let mut columns = vec![];
|
||||||
let tc = ColumnType::Time(Column::from(&[200_i64, 300, 400, 500, 600][..]));
|
let tc = ColumnType::Time(Column::from(&[200_i64, 300, 400, 500, 600][..]));
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
|
|
||||||
let city = ColumnType::Tag(Column::from(
|
let city = ColumnType::Tag(Column::from(
|
||||||
&[Some("Boston"), None, None, Some("NYC"), Some("NYC")][..],
|
&[Some("Boston"), None, None, Some("NYC"), Some("NYC")][..],
|
||||||
));
|
));
|
||||||
columns.push(("city".to_string(), city));
|
columns.push(("city".to_owned(), city));
|
||||||
|
|
||||||
let state = ColumnType::Tag(Column::from(
|
let state = ColumnType::Tag(Column::from(
|
||||||
&[Some("MA"), Some("CA"), Some("NY"), Some("NY"), Some("NY")][..],
|
&[Some("MA"), Some("CA"), Some("NY"), Some("NY"), Some("NY")][..],
|
||||||
));
|
));
|
||||||
columns.push(("state".to_string(), state));
|
columns.push(("state".to_owned(), state));
|
||||||
|
|
||||||
let borough = ColumnType::Tag(Column::from(
|
let borough = ColumnType::Tag(Column::from(
|
||||||
&[None, None, None, None, Some("Brooklyn")][..],
|
&[None, None, None, None, Some("Brooklyn")][..],
|
||||||
));
|
));
|
||||||
columns.push(("borough".to_string(), borough));
|
columns.push(("borough".to_owned(), borough));
|
||||||
|
|
||||||
let temp = ColumnType::Field(Column::from(&[50.4, 79.0, 60.8, 61.0, 61.0][..]));
|
let temp = ColumnType::Field(Column::from(&[50.4, 79.0, 60.8, 61.0, 61.0][..]));
|
||||||
columns.push(("temp".to_string(), temp));
|
columns.push(("temp".to_owned(), temp));
|
||||||
|
|
||||||
let row_group = RowGroup::new(5, columns);
|
let row_group = RowGroup::new(5, columns);
|
||||||
|
|
||||||
|
@ -3019,17 +3019,17 @@ POST,west,2
|
||||||
fn read_aggregate() {
|
fn read_aggregate() {
|
||||||
let mut columns = vec![];
|
let mut columns = vec![];
|
||||||
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5, 6][..]));
|
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5, 6][..]));
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
|
|
||||||
let rc = ColumnType::Tag(Column::from(
|
let rc = ColumnType::Tag(Column::from(
|
||||||
&["west", "west", "east", "west", "south", "north"][..],
|
&["west", "west", "east", "west", "south", "north"][..],
|
||||||
));
|
));
|
||||||
columns.push(("region".to_string(), rc));
|
columns.push(("region".to_owned(), rc));
|
||||||
|
|
||||||
let mc = ColumnType::Tag(Column::from(
|
let mc = ColumnType::Tag(Column::from(
|
||||||
&["GET", "POST", "POST", "POST", "PUT", "GET"][..],
|
&["GET", "POST", "POST", "POST", "PUT", "GET"][..],
|
||||||
));
|
));
|
||||||
columns.push(("method".to_string(), mc));
|
columns.push(("method".to_owned(), mc));
|
||||||
|
|
||||||
let ec = ColumnType::Tag(Column::from(
|
let ec = ColumnType::Tag(Column::from(
|
||||||
&[
|
&[
|
||||||
|
@ -3041,20 +3041,20 @@ POST,west,2
|
||||||
None,
|
None,
|
||||||
][..],
|
][..],
|
||||||
));
|
));
|
||||||
columns.push(("env".to_string(), ec));
|
columns.push(("env".to_owned(), ec));
|
||||||
|
|
||||||
let c = ColumnType::Tag(Column::from(
|
let c = ColumnType::Tag(Column::from(
|
||||||
&["Alpha", "Alpha", "Bravo", "Bravo", "Alpha", "Alpha"][..],
|
&["Alpha", "Alpha", "Bravo", "Bravo", "Alpha", "Alpha"][..],
|
||||||
));
|
));
|
||||||
columns.push(("letters".to_string(), c));
|
columns.push(("letters".to_owned(), c));
|
||||||
|
|
||||||
let c = ColumnType::Tag(Column::from(
|
let c = ColumnType::Tag(Column::from(
|
||||||
&["one", "two", "two", "two", "one", "three"][..],
|
&["one", "two", "two", "two", "one", "three"][..],
|
||||||
));
|
));
|
||||||
columns.push(("numbers".to_string(), c));
|
columns.push(("numbers".to_owned(), c));
|
||||||
|
|
||||||
let fc = ColumnType::Field(Column::from(&[100_u64, 101, 200, 203, 203, 10][..]));
|
let fc = ColumnType::Field(Column::from(&[100_u64, 101, 200, 203, 203, 10][..]));
|
||||||
columns.push(("counter".to_string(), fc));
|
columns.push(("counter".to_owned(), fc));
|
||||||
|
|
||||||
let row_group = RowGroup::new(6, columns);
|
let row_group = RowGroup::new(6, columns);
|
||||||
|
|
||||||
|
@ -3251,17 +3251,17 @@ west,POST,304,101,203
|
||||||
fn row_aggregate_could_satisfy_predicate() {
|
fn row_aggregate_could_satisfy_predicate() {
|
||||||
let mut columns = vec![];
|
let mut columns = vec![];
|
||||||
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5, 6][..]));
|
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5, 6][..]));
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
|
|
||||||
let rc = ColumnType::Tag(Column::from(
|
let rc = ColumnType::Tag(Column::from(
|
||||||
&["west", "west", "east", "west", "south", "north"][..],
|
&["west", "west", "east", "west", "south", "north"][..],
|
||||||
));
|
));
|
||||||
columns.push(("region".to_string(), rc));
|
columns.push(("region".to_owned(), rc));
|
||||||
|
|
||||||
let mc = ColumnType::Tag(Column::from(
|
let mc = ColumnType::Tag(Column::from(
|
||||||
&["GET", "GET", "GET", "GET", "GET", "GET"][..],
|
&["GET", "GET", "GET", "GET", "GET", "GET"][..],
|
||||||
));
|
));
|
||||||
columns.push(("method".to_string(), mc));
|
columns.push(("method".to_owned(), mc));
|
||||||
|
|
||||||
let row_group = RowGroup::new(6, columns);
|
let row_group = RowGroup::new(6, columns);
|
||||||
|
|
||||||
|
@ -3307,17 +3307,17 @@ west,POST,304,101,203
|
||||||
fn row_aggregate_satisfies_predicate() {
|
fn row_aggregate_satisfies_predicate() {
|
||||||
let mut columns = vec![];
|
let mut columns = vec![];
|
||||||
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5, 6][..]));
|
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5, 6][..]));
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
|
|
||||||
let rc = ColumnType::Tag(Column::from(
|
let rc = ColumnType::Tag(Column::from(
|
||||||
&["west", "west", "east", "west", "south", "north"][..],
|
&["west", "west", "east", "west", "south", "north"][..],
|
||||||
));
|
));
|
||||||
columns.push(("region".to_string(), rc));
|
columns.push(("region".to_owned(), rc));
|
||||||
|
|
||||||
let mc = ColumnType::Tag(Column::from(
|
let mc = ColumnType::Tag(Column::from(
|
||||||
&["GET", "GET", "GET", "GET", "GET", "GET"][..],
|
&["GET", "GET", "GET", "GET", "GET", "GET"][..],
|
||||||
));
|
));
|
||||||
columns.push(("method".to_string(), mc));
|
columns.push(("method".to_owned(), mc));
|
||||||
|
|
||||||
let row_group = RowGroup::new(6, columns);
|
let row_group = RowGroup::new(6, columns);
|
||||||
|
|
||||||
|
@ -3723,18 +3723,18 @@ west,host-c,pro,10,6
|
||||||
fn column_names_setup() -> RowGroup {
|
fn column_names_setup() -> RowGroup {
|
||||||
let mut columns = vec![];
|
let mut columns = vec![];
|
||||||
let rc = ColumnType::Tag(Column::from(&[Some("west"), Some("west"), None, None][..]));
|
let rc = ColumnType::Tag(Column::from(&[Some("west"), Some("west"), None, None][..]));
|
||||||
columns.push(("region".to_string(), rc));
|
columns.push(("region".to_owned(), rc));
|
||||||
let track = ColumnType::Tag(Column::from(
|
let track = ColumnType::Tag(Column::from(
|
||||||
&[Some("Thinking"), Some("of"), Some("a"), Some("place")][..],
|
&[Some("Thinking"), Some("of"), Some("a"), Some("place")][..],
|
||||||
));
|
));
|
||||||
columns.push(("track".to_string(), track));
|
columns.push(("track".to_owned(), track));
|
||||||
let temp = ColumnType::Field(Column::from(
|
let temp = ColumnType::Field(Column::from(
|
||||||
&[Some("hot"), Some("cold"), Some("cold"), Some("warm")][..],
|
&[Some("hot"), Some("cold"), Some("cold"), Some("warm")][..],
|
||||||
));
|
));
|
||||||
columns.push(("temp".to_string(), temp));
|
columns.push(("temp".to_owned(), temp));
|
||||||
|
|
||||||
let tc = ColumnType::Time(Column::from(&[100_i64, 200, 500, 600][..]));
|
let tc = ColumnType::Time(Column::from(&[100_i64, 200, 500, 600][..]));
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
RowGroup::new(4, columns)
|
RowGroup::new(4, columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3789,12 +3789,12 @@ west,host-c,pro,10,6
|
||||||
// part of the result-set from the row group.
|
// part of the result-set from the row group.
|
||||||
let mut columns = vec![];
|
let mut columns = vec![];
|
||||||
let rc = ColumnType::Tag(Column::from(&[Some("prod")][..]));
|
let rc = ColumnType::Tag(Column::from(&[Some("prod")][..]));
|
||||||
columns.push(("env".to_string(), rc));
|
columns.push(("env".to_owned(), rc));
|
||||||
let tc = ColumnType::Time(Column::from(&[100_i64][..]));
|
let tc = ColumnType::Time(Column::from(&[100_i64][..]));
|
||||||
let temp = ColumnType::Field(Column::from(&[Some("hot")][..]));
|
let temp = ColumnType::Field(Column::from(&[Some("hot")][..]));
|
||||||
columns.push(("temp".to_string(), temp));
|
columns.push(("temp".to_owned(), temp));
|
||||||
|
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
let row_group = RowGroup::new(1, columns);
|
let row_group = RowGroup::new(1, columns);
|
||||||
|
|
||||||
row_group.column_names(&Predicate::default(), &[], Selection::All, &mut dst);
|
row_group.column_names(&Predicate::default(), &[], Selection::All, &mut dst);
|
||||||
|
@ -3960,13 +3960,13 @@ west,host-c,pro,10,6
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_map(arr: Vec<(&str, &[&str])>) -> BTreeMap<String, BTreeSet<String>> {
|
fn to_map(arr: Vec<(&str, &[&str])>) -> BTreeMap<String, BTreeSet<String>> {
|
||||||
arr.iter()
|
arr.into_iter()
|
||||||
.map(|(k, values)| {
|
.map(|(k, values)| {
|
||||||
(
|
(
|
||||||
k.to_string(),
|
k.to_owned(),
|
||||||
values
|
values
|
||||||
.iter()
|
.iter()
|
||||||
.map(|s| s.to_string())
|
.map(|&s| s.to_owned())
|
||||||
.collect::<BTreeSet<_>>(),
|
.collect::<BTreeSet<_>>(),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -3978,13 +3978,13 @@ west,host-c,pro,10,6
|
||||||
// Build a row group.
|
// Build a row group.
|
||||||
let mut columns = vec![];
|
let mut columns = vec![];
|
||||||
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3][..]));
|
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3][..]));
|
||||||
columns.push(("time".to_string(), tc));
|
columns.push(("time".to_owned(), tc));
|
||||||
|
|
||||||
let rc = ColumnType::Tag(Column::from(&["west", "south", "north"][..]));
|
let rc = ColumnType::Tag(Column::from(&["west", "south", "north"][..]));
|
||||||
columns.push(("region".to_string(), rc));
|
columns.push(("region".to_owned(), rc));
|
||||||
|
|
||||||
let ec = ColumnType::Tag(Column::from(&["prod", "stag", "stag"][..]));
|
let ec = ColumnType::Tag(Column::from(&["prod", "stag", "stag"][..]));
|
||||||
columns.push(("env".to_string(), ec));
|
columns.push(("env".to_owned(), ec));
|
||||||
|
|
||||||
let rg = RowGroup::new(3, columns);
|
let rg = RowGroup::new(3, columns);
|
||||||
|
|
||||||
|
|
|
@ -370,7 +370,7 @@ impl Table {
|
||||||
matches!(ct, ColumnType::Tag(_)),
|
matches!(ct, ColumnType::Tag(_)),
|
||||||
UnsupportedColumnOperationSnafu {
|
UnsupportedColumnOperationSnafu {
|
||||||
msg: format!("column type must be ColumnType::Tag, got {:?}", ct),
|
msg: format!("column type must be ColumnType::Tag, got {:?}", ct),
|
||||||
column_name: ct.as_str().to_string(),
|
column_name: ct.as_str().to_owned(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1121,12 +1121,9 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn meta_data_update_with() {
|
fn meta_data_update_with() {
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
|
("time".to_owned(), ColumnType::create_time(&[100, 200, 300])),
|
||||||
(
|
(
|
||||||
"time".to_string(),
|
"region".to_owned(),
|
||||||
ColumnType::create_time(&[100, 200, 300]),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"region".to_string(),
|
|
||||||
ColumnType::create_tag(&["west", "west", "north"]),
|
ColumnType::create_tag(&["west", "west", "north"]),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
@ -1145,9 +1142,9 @@ mod test {
|
||||||
);
|
);
|
||||||
|
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
("time".to_string(), ColumnType::create_time(&[10, 400])),
|
("time".to_owned(), ColumnType::create_time(&[10, 400])),
|
||||||
(
|
(
|
||||||
"region".to_string(),
|
"region".to_owned(),
|
||||||
ColumnType::create_tag(&["east", "south"]),
|
ColumnType::create_tag(&["east", "south"]),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
@ -1175,12 +1172,12 @@ mod test {
|
||||||
let col_e = ColumnType::Field(Column::from(BooleanArray::from(vec![true])));
|
let col_e = ColumnType::Field(Column::from(BooleanArray::from(vec![true])));
|
||||||
|
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
("time".to_string(), time),
|
("time".to_owned(), time),
|
||||||
("i64_col".to_string(), col_a),
|
("i64_col".to_owned(), col_a),
|
||||||
("u64_col".to_string(), col_b),
|
("u64_col".to_owned(), col_b),
|
||||||
("f64_col".to_string(), col_c),
|
("f64_col".to_owned(), col_c),
|
||||||
("str_col".to_string(), col_d),
|
("str_col".to_owned(), col_d),
|
||||||
("bool_col".to_string(), col_e),
|
("bool_col".to_owned(), col_e),
|
||||||
];
|
];
|
||||||
let row_group = RowGroup::new(1, columns);
|
let row_group = RowGroup::new(1, columns);
|
||||||
|
|
||||||
|
@ -1233,12 +1230,9 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn meta_data_update_with_null() {
|
fn meta_data_update_with_null() {
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
|
("time".to_owned(), ColumnType::create_time(&[100, 200, 300])),
|
||||||
(
|
(
|
||||||
"time".to_string(),
|
"region".to_owned(),
|
||||||
ColumnType::create_time(&[100, 200, 300]),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"region".to_string(),
|
|
||||||
ColumnType::create_tag_opt(&[None, None, None]),
|
ColumnType::create_tag_opt(&[None, None, None]),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
@ -1249,9 +1243,9 @@ mod test {
|
||||||
|
|
||||||
// add a second column
|
// add a second column
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
("time".to_string(), ColumnType::create_time(&[10, 400])),
|
("time".to_owned(), ColumnType::create_time(&[10, 400])),
|
||||||
(
|
(
|
||||||
"region".to_string(),
|
"region".to_owned(),
|
||||||
ColumnType::create_tag(&["east", "south"]),
|
ColumnType::create_tag(&["east", "south"]),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
@ -1271,7 +1265,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn add_remove_row_groups() {
|
fn add_remove_row_groups() {
|
||||||
let tc = ColumnType::Time(Column::from(&[0_i64, 2, 3][..]));
|
let tc = ColumnType::Time(Column::from(&[0_i64, 2, 3][..]));
|
||||||
let columns = vec![("time".to_string(), tc)];
|
let columns = vec![("time".to_owned(), tc)];
|
||||||
|
|
||||||
let rg = RowGroup::new(3, columns);
|
let rg = RowGroup::new(3, columns);
|
||||||
let mut table = Table::with_row_group("cpu", rg);
|
let mut table = Table::with_row_group("cpu", rg);
|
||||||
|
@ -1280,7 +1274,7 @@ mod test {
|
||||||
|
|
||||||
// add another row group
|
// add another row group
|
||||||
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5][..]));
|
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5][..]));
|
||||||
let columns = vec![("time".to_string(), tc)];
|
let columns = vec![("time".to_owned(), tc)];
|
||||||
let rg = RowGroup::new(5, columns);
|
let rg = RowGroup::new(5, columns);
|
||||||
table.add_row_group(rg);
|
table.add_row_group(rg);
|
||||||
|
|
||||||
|
@ -1314,14 +1308,14 @@ mod test {
|
||||||
fn column_sizes() {
|
fn column_sizes() {
|
||||||
let tc = ColumnType::Time(Column::from(&[10_i64, 20, 30][..]));
|
let tc = ColumnType::Time(Column::from(&[10_i64, 20, 30][..]));
|
||||||
let fc = ColumnType::Field(Column::from(&[1000_u64, 1002, 1200][..]));
|
let fc = ColumnType::Field(Column::from(&[1000_u64, 1002, 1200][..]));
|
||||||
let columns = vec![("time".to_string(), tc), ("count".to_string(), fc)];
|
let columns = vec![("time".to_owned(), tc), ("count".to_owned(), fc)];
|
||||||
let row_group = RowGroup::new(3, columns);
|
let row_group = RowGroup::new(3, columns);
|
||||||
let mut table = Table::with_row_group("cpu", row_group);
|
let mut table = Table::with_row_group("cpu", row_group);
|
||||||
|
|
||||||
// add another row group
|
// add another row group
|
||||||
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5, 6][..]));
|
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3, 4, 5, 6][..]));
|
||||||
let fc = ColumnType::Field(Column::from(&[100_u64, 101, 200, 203, 203, 10][..]));
|
let fc = ColumnType::Field(Column::from(&[100_u64, 101, 200, 203, 203, 10][..]));
|
||||||
let columns = vec![("time".to_string(), tc), ("count".to_string(), fc)];
|
let columns = vec![("time".to_owned(), tc), ("count".to_owned(), fc)];
|
||||||
let rg = RowGroup::new(6, columns);
|
let rg = RowGroup::new(6, columns);
|
||||||
table.add_row_group(rg);
|
table.add_row_group(rg);
|
||||||
|
|
||||||
|
@ -1345,9 +1339,9 @@ mod test {
|
||||||
let rc = ColumnType::Tag(Column::from(&["south", "north", "east"][..]));
|
let rc = ColumnType::Tag(Column::from(&["south", "north", "east"][..]));
|
||||||
let fc = ColumnType::Field(Column::from(&[1000_u64, 1002, 1200][..]));
|
let fc = ColumnType::Field(Column::from(&[1000_u64, 1002, 1200][..]));
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
("time".to_string(), tc),
|
("time".to_owned(), tc),
|
||||||
("region".to_string(), rc),
|
("region".to_owned(), rc),
|
||||||
("count".to_string(), fc),
|
("count".to_owned(), fc),
|
||||||
];
|
];
|
||||||
let row_group = RowGroup::new(3, columns);
|
let row_group = RowGroup::new(3, columns);
|
||||||
let mut table = Table::with_row_group("cpu", row_group);
|
let mut table = Table::with_row_group("cpu", row_group);
|
||||||
|
@ -1359,9 +1353,9 @@ mod test {
|
||||||
));
|
));
|
||||||
let fc = ColumnType::Field(Column::from(&[100_u64, 101, 200, 203, 203, 10][..]));
|
let fc = ColumnType::Field(Column::from(&[100_u64, 101, 200, 203, 203, 10][..]));
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
("time".to_string(), tc),
|
("time".to_owned(), tc),
|
||||||
("region".to_string(), rc),
|
("region".to_owned(), rc),
|
||||||
("count".to_string(), fc),
|
("count".to_owned(), fc),
|
||||||
];
|
];
|
||||||
let rg = RowGroup::new(6, columns);
|
let rg = RowGroup::new(6, columns);
|
||||||
table.add_row_group(rg);
|
table.add_row_group(rg);
|
||||||
|
@ -1427,9 +1421,9 @@ mod test {
|
||||||
));
|
));
|
||||||
let fc = ColumnType::Field(Column::from(&[100_u64, 101, 200, 203, 203, 10][..]));
|
let fc = ColumnType::Field(Column::from(&[100_u64, 101, 200, 203, 203, 10][..]));
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
("time".to_string(), tc),
|
("time".to_owned(), tc),
|
||||||
("region".to_string(), rc),
|
("region".to_owned(), rc),
|
||||||
("count".to_string(), fc),
|
("count".to_owned(), fc),
|
||||||
];
|
];
|
||||||
|
|
||||||
let rg = RowGroup::new(6, columns);
|
let rg = RowGroup::new(6, columns);
|
||||||
|
@ -1457,9 +1451,9 @@ mod test {
|
||||||
let rc = ColumnType::Tag(Column::from(&["south", "north", "east"][..]));
|
let rc = ColumnType::Tag(Column::from(&["south", "north", "east"][..]));
|
||||||
let fc = ColumnType::Field(Column::from(&[1000_u64, 1002, 1200][..]));
|
let fc = ColumnType::Field(Column::from(&[1000_u64, 1002, 1200][..]));
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
("time".to_string(), tc),
|
("time".to_owned(), tc),
|
||||||
("region".to_string(), rc),
|
("region".to_owned(), rc),
|
||||||
("count".to_string(), fc),
|
("count".to_owned(), fc),
|
||||||
];
|
];
|
||||||
let row_group = RowGroup::new(3, columns);
|
let row_group = RowGroup::new(3, columns);
|
||||||
table.add_row_group(row_group);
|
table.add_row_group(row_group);
|
||||||
|
@ -1558,12 +1552,9 @@ mod test {
|
||||||
fn read_aggregate_no_groups() {
|
fn read_aggregate_no_groups() {
|
||||||
// Build first row group.
|
// Build first row group.
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
|
("time".to_owned(), ColumnType::create_time(&[100, 200, 300])),
|
||||||
(
|
(
|
||||||
"time".to_string(),
|
"region".to_owned(),
|
||||||
ColumnType::create_time(&[100, 200, 300]),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"region".to_string(),
|
|
||||||
ColumnType::create_tag(&["west", "west", "east"]),
|
ColumnType::create_tag(&["west", "west", "east"]),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
@ -1572,9 +1563,9 @@ mod test {
|
||||||
|
|
||||||
// Build another row group.
|
// Build another row group.
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
("time".to_string(), ColumnType::create_time(&[2, 3])),
|
("time".to_owned(), ColumnType::create_time(&[2, 3])),
|
||||||
(
|
(
|
||||||
"region".to_string(),
|
"region".to_owned(),
|
||||||
ColumnType::create_tag(&["north", "north"]),
|
ColumnType::create_tag(&["north", "north"]),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
@ -1707,7 +1698,7 @@ west,host-b,100
|
||||||
// Build a row group.
|
// Build a row group.
|
||||||
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3][..]));
|
let tc = ColumnType::Time(Column::from(&[1_i64, 2, 3][..]));
|
||||||
let rc = ColumnType::Tag(Column::from(&["west", "south", "north"][..]));
|
let rc = ColumnType::Tag(Column::from(&["west", "south", "north"][..]));
|
||||||
let columns = vec![("time".to_string(), tc), ("region".to_string(), rc)];
|
let columns = vec![("time".to_owned(), tc), ("region".to_owned(), rc)];
|
||||||
|
|
||||||
let rg = RowGroup::new(3, columns);
|
let rg = RowGroup::new(3, columns);
|
||||||
let mut table = Table::with_row_group("cpu", rg);
|
let mut table = Table::with_row_group("cpu", rg);
|
||||||
|
@ -1715,7 +1706,7 @@ west,host-b,100
|
||||||
// add another row group
|
// add another row group
|
||||||
let tc = ColumnType::Time(Column::from(&[200_i64, 300, 400][..]));
|
let tc = ColumnType::Time(Column::from(&[200_i64, 300, 400][..]));
|
||||||
let rc = ColumnType::Tag(Column::from(vec![Some("north"), None, None].as_slice()));
|
let rc = ColumnType::Tag(Column::from(vec![Some("north"), None, None].as_slice()));
|
||||||
let columns = vec![("time".to_string(), tc), ("region".to_string(), rc)];
|
let columns = vec![("time".to_owned(), tc), ("region".to_owned(), rc)];
|
||||||
|
|
||||||
let rg = RowGroup::new(3, columns);
|
let rg = RowGroup::new(3, columns);
|
||||||
table.add_row_group(rg);
|
table.add_row_group(rg);
|
||||||
|
@ -1797,8 +1788,8 @@ west,host-b,100
|
||||||
let tc = ColumnType::Time(Column::from(&[-29_i64, -100, 3, 2][..]));
|
let tc = ColumnType::Time(Column::from(&[-29_i64, -100, 3, 2][..]));
|
||||||
let rc = ColumnType::Tag(Column::from(&["west", "south", "north", "west"][..]));
|
let rc = ColumnType::Tag(Column::from(&["west", "south", "north", "west"][..]));
|
||||||
let columns = vec![
|
let columns = vec![
|
||||||
(row_group::TIME_COLUMN_NAME.to_string(), tc),
|
(row_group::TIME_COLUMN_NAME.to_owned(), tc),
|
||||||
("region".to_string(), rc),
|
("region".to_owned(), rc),
|
||||||
];
|
];
|
||||||
|
|
||||||
let rg = RowGroup::new(4, columns);
|
let rg = RowGroup::new(4, columns);
|
||||||
|
|
|
@ -1912,9 +1912,9 @@ mod test {
|
||||||
|
|
||||||
// bytes
|
// bytes
|
||||||
let arr = vec![
|
let arr = vec![
|
||||||
"Pop Song 89".to_string(),
|
"Pop Song 89".to_owned(),
|
||||||
"Orange Crush".to_string(),
|
"Orange Crush".to_owned(),
|
||||||
"Stand".to_string(),
|
"Stand".to_owned(),
|
||||||
];
|
];
|
||||||
let values = Values::ByteArray(vec![
|
let values = Values::ByteArray(vec![
|
||||||
Some(arr[0].as_bytes()),
|
Some(arr[0].as_bytes()),
|
||||||
|
@ -1990,7 +1990,7 @@ mod test {
|
||||||
let eleven = OwnedValue::Scalar(Scalar::I64(11));
|
let eleven = OwnedValue::Scalar(Scalar::I64(11));
|
||||||
let twenty_two = OwnedValue::Scalar(Scalar::I64(22));
|
let twenty_two = OwnedValue::Scalar(Scalar::I64(22));
|
||||||
let thirty_three = OwnedValue::Scalar(Scalar::I64(33));
|
let thirty_three = OwnedValue::Scalar(Scalar::I64(33));
|
||||||
let string = OwnedValue::String("foo".to_string());
|
let string = OwnedValue::String("foo".to_owned());
|
||||||
|
|
||||||
let mut v1 = OwnedValue::new_null();
|
let mut v1 = OwnedValue::new_null();
|
||||||
|
|
||||||
|
@ -2020,7 +2020,7 @@ mod test {
|
||||||
let eleven = OwnedValue::Scalar(Scalar::I64(11));
|
let eleven = OwnedValue::Scalar(Scalar::I64(11));
|
||||||
let twenty_two = OwnedValue::Scalar(Scalar::I64(22));
|
let twenty_two = OwnedValue::Scalar(Scalar::I64(22));
|
||||||
let thirty_three = OwnedValue::Scalar(Scalar::I64(33));
|
let thirty_three = OwnedValue::Scalar(Scalar::I64(33));
|
||||||
let string = OwnedValue::String("foo".to_string());
|
let string = OwnedValue::String("foo".to_owned());
|
||||||
|
|
||||||
let mut v1 = OwnedValue::new_null();
|
let mut v1 = OwnedValue::new_null();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue