mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-23 16:30:39 +00:00
feat: struct value and vector (#7033)
* feat: struct value Signed-off-by: Ning Sun <sunning@greptime.com> * feat: update for proto module * feat: wip struct type * feat: implement more vector operations * feat: make datatype and api * feat: reoslve some compilation issues * feat: resolve all compilation issues * chore: format update * test: resolve tests * test: test and refactor value-to-pb * feat: add more tests and fix for value types * chore: remove dbg * feat: test and fix iterator * fix: resolve struct_type issue * refactor: use vec for struct items * chore: update proto to main branch * refactor: address some of review issues * refactor: update for further review * Add validation on new methods * feat: update struct/list json serialization * refactor: reimplement get in struct_vector * refactor: struct vector functions * refactor: fix lint issue * refactor: address review comments --------- Signed-off-by: Ning Sun <sunning@greptime.com>
This commit is contained in:
@@ -112,7 +112,7 @@ fn validate_rows(rows: &Option<Rows>) -> Result<()> {
|
||||
|
||||
for (col_idx, schema) in rows.schema.iter().enumerate() {
|
||||
let column_type =
|
||||
ColumnDataTypeWrapper::try_new(schema.datatype, schema.datatype_extension)
|
||||
ColumnDataTypeWrapper::try_new(schema.datatype, schema.datatype_extension.clone())
|
||||
.context(ColumnDataTypeSnafu)?
|
||||
.into();
|
||||
|
||||
@@ -172,7 +172,7 @@ pub fn columns_to_rows(columns: Vec<Column>, row_count: u32) -> Result<Rows> {
|
||||
column_name: column.column_name.clone(),
|
||||
datatype: column.datatype,
|
||||
semantic_type: column.semantic_type,
|
||||
datatype_extension: column.datatype_extension,
|
||||
datatype_extension: column.datatype_extension.clone(),
|
||||
options: column.options.clone(),
|
||||
};
|
||||
schema.push(column_schema);
|
||||
@@ -292,6 +292,8 @@ fn push_column_to_rows(column: Column, rows: &mut [Row]) -> Result<()> {
|
||||
),
|
||||
(Decimal128, Decimal128Value, decimal128_values),
|
||||
(Vector, BinaryValue, binary_values),
|
||||
(List, ListValue, list_values),
|
||||
(Struct, StructValue, struct_values),
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -38,7 +38,7 @@ pub fn find_all_impure_columns(table_info: &TableInfo) -> Vec<ColumnSchema> {
|
||||
|
||||
/// Fill impure default values in the request
|
||||
pub struct ImpureDefaultFiller {
|
||||
impure_columns: HashMap<String, (api::v1::ColumnSchema, Option<api::v1::Value>)>,
|
||||
impure_columns: HashMap<String, (api::v1::ColumnSchema, api::v1::Value)>,
|
||||
}
|
||||
|
||||
impl ImpureDefaultFiller {
|
||||
@@ -100,7 +100,7 @@ impl ImpureDefaultFiller {
|
||||
.iter()
|
||||
.filter_map(|(name, (schema, val))| {
|
||||
if !impure_columns_in_reqs.contains(name) {
|
||||
Some((schema.clone(), val.clone().unwrap_or_default()))
|
||||
Some((schema.clone(), val.clone()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ fn values_to_vectors_by_valid_types(
|
||||
fn value_to_vector(value: Value) -> VectorRef {
|
||||
let data_type = value.data_type();
|
||||
let mut mutable_vector = data_type.create_mutable_vector(1);
|
||||
mutable_vector.push_value_ref(value.as_value_ref());
|
||||
mutable_vector.push_value_ref(&value.as_value_ref());
|
||||
|
||||
mutable_vector.to_vector()
|
||||
}
|
||||
|
||||
@@ -1784,7 +1784,7 @@ fn find_partition_entries(
|
||||
.unwrap();
|
||||
let column_name = &column.name;
|
||||
let data_type = ConcreteDataType::from(
|
||||
ColumnDataTypeWrapper::try_new(column.data_type, column.datatype_extension)
|
||||
ColumnDataTypeWrapper::try_new(column.data_type, column.datatype_extension.clone())
|
||||
.context(ColumnDataTypeSnafu)?,
|
||||
);
|
||||
Ok((column_name, data_type))
|
||||
|
||||
Reference in New Issue
Block a user