feat: Support creating in memory region and writing to memtable (#40)

* chore(store-api): Fix typo in region comments

* feat(storage): Init storage crate

* feat(store-api): Make some method async

* feat(storage): Blank StorageEngine implementation

* feat(storage): StorageEngine returns owned SchemaRef

* feat: pub use arrow in datatypes

* feat(store-api): Implement RegionMetadata

* feat(storage): Impl create region in memory.

* chore(object-store): Format cargo toml

* chore(storage): Log on region created

* feat: Impl CowCell

* feat: Store id to cf meta mapping

* refactor: Refactor version and rename it to VersionControl

* feat: Impl write batch for put, refactor column family

* feat(storage): Skeleton of writing to memtable

* refactor(storage): MemTable returns MemTableSchema

* feat: Add ColumnSchema and conversion between schema and arrow's schema

* feat: Validate put data

* feat: Valid schema of write batch

* feat: insert memtable WIP

* feat: Impl Inserter for memtable

* feat(datatypes): Implement Eq/Ord for Value

feat: Implement Ord/Eq for Bytes/StringBytes and Deref for Bytes

test: Test Value::from()

* feat: Define BTreeMemTable

* Fix: Rename get/get_unchecked to try_get/get and fix get not consider null.

* feat: Impl BTreeMemTable::write()

* refactor: Remove useless ColumnFamilyHandle now

* chore: Clean comment

* feat(common): Add from `String/&str/Vec<u8>/&[u8]` for Value

* test(storage): Add tests for WriteBatch

* chore: Fix clippy

* feat: Add builder for RowKey/ColumnFamilyDescriptor

* test: Add test for metadata

* chore: Fix clippy

* test: Add test for region and engine

* chore: Fix clippy

* chore: Address CR comment
This commit is contained in:
evenyag
2022-06-09 16:50:02 +08:00
committed by GitHub
parent 8fe577649f
commit 4171173b76
64 changed files with 2911 additions and 203 deletions

View File

@@ -99,7 +99,7 @@ mod tests {
for i in 0..3 {
let p: f64 = (values[i] as f64).pow(bases[i] as f64);
assert!(matches!(vector.get_unchecked(i), Value::Float64(v) if v == p));
assert!(matches!(vector.get(i), Value::Float64(v) if v == p));
}
}
}

View File

@@ -198,11 +198,11 @@ mod tests {
// clip([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 3, 6) = [3, 3, 3, 3, 4, 5, 6, 6, 6, 6]
for i in 0..10 {
if i <= 3 {
assert!(matches!(vector.get_unchecked(i), Value::Int64(v) if v == 3));
assert!(matches!(vector.get(i), Value::Int64(v) if v == 3));
} else if i <= 6 {
assert!(matches!(vector.get_unchecked(i), Value::Int64(v) if v == (i as i64)));
assert!(matches!(vector.get(i), Value::Int64(v) if v == (i as i64)));
} else {
assert!(matches!(vector.get_unchecked(i), Value::Int64(v) if v == 6));
assert!(matches!(vector.get(i), Value::Int64(v) if v == 6));
}
}
@@ -225,11 +225,11 @@ mod tests {
// clip([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 3, 6) = [3, 3, 3, 3, 4, 5, 6, 6, 6, 6]
for i in 0..10 {
if i <= 3 {
assert!(matches!(vector.get_unchecked(i), Value::UInt64(v) if v == 3));
assert!(matches!(vector.get(i), Value::UInt64(v) if v == 3));
} else if i <= 6 {
assert!(matches!(vector.get_unchecked(i), Value::UInt64(v) if v == (i as u64)));
assert!(matches!(vector.get(i), Value::UInt64(v) if v == (i as u64)));
} else {
assert!(matches!(vector.get_unchecked(i), Value::UInt64(v) if v == 6));
assert!(matches!(vector.get(i), Value::UInt64(v) if v == 6));
}
}
@@ -252,11 +252,11 @@ mod tests {
// clip([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 3, 6) = [3, 3, 3, 3, 4, 5, 6, 6, 6, 6]
for i in 0..10 {
if i <= 3 {
assert!(matches!(vector.get_unchecked(i), Value::Float64(v) if v == 3.0));
assert!(matches!(vector.get(i), Value::Float64(v) if v == 3.0));
} else if i <= 6 {
assert!(matches!(vector.get_unchecked(i), Value::Float64(v) if v == (i as f64)));
assert!(matches!(vector.get(i), Value::Float64(v) if v == (i as f64)));
} else {
assert!(matches!(vector.get_unchecked(i), Value::Float64(v) if v == 6.0));
assert!(matches!(vector.get(i), Value::Float64(v) if v == 6.0));
}
}
}

View File

@@ -83,9 +83,7 @@ mod tests {
assert_eq!(3, vector.len());
for i in 0..3 {
assert!(
matches!(vector.get_unchecked(i), Value::Boolean(b) if b == (i == 0 || i == 2))
);
assert!(matches!(vector.get(i), Value::Boolean(b) if b == (i == 0 || i == 2)));
}
// create a udf and test it again