From a2852affebeeb2c51f278ac3eb45f75df9c07fee Mon Sep 17 00:00:00 2001 From: Yohan Wal Date: Fri, 15 Nov 2024 14:58:26 +0800 Subject: [PATCH] chore: rename change to modify (#5000) * chore: rename change to modify * chore: proto rev --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/common/grpc-expr/src/alter.rs | 36 ++++++------- .../src/ddl/alter_table/region_request.rs | 16 +++--- .../src/ddl/alter_table/update_metadata.rs | 2 +- src/operator/src/expr_factory.rs | 28 +++++----- src/sql/src/parsers/alter_parser.rs | 16 +++--- src/sql/src/statements/alter.rs | 4 +- .../src/statements/transform/type_alias.rs | 2 +- src/store-api/src/metadata.rs | 12 ++--- src/store-api/src/region_request.rs | 52 +++++++++---------- src/table/src/metadata.rs | 28 +++++----- src/table/src/requests.rs | 6 +-- 13 files changed, 103 insertions(+), 103 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7e9dd2720c67..894d2c607690 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4595,7 +4595,7 @@ dependencies = [ [[package]] name = "greptime-proto" version = "0.1.0" -source = "git+https://github.com/GreptimeTeam/greptime-proto.git?rev=e1070ad3e7ad3d89f8dd1e20756b0c0cc26f3365#e1070ad3e7ad3d89f8dd1e20756b0c0cc26f3365" +source = "git+https://github.com/GreptimeTeam/greptime-proto.git?rev=fb4e2146b1ea8816148304f1f258e7a73736a905#fb4e2146b1ea8816148304f1f258e7a73736a905" dependencies = [ "prost 0.12.6", "serde", diff --git a/Cargo.toml b/Cargo.toml index ee02ab0b71cb..c683c54412a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -122,7 +122,7 @@ etcd-client = "0.13" fst = "0.4.7" futures = "0.3" futures-util = "0.3" -greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", rev = "e1070ad3e7ad3d89f8dd1e20756b0c0cc26f3365" } +greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", rev = "fb4e2146b1ea8816148304f1f258e7a73736a905" } hex = "0.4" humantime = "2.1" humantime-serde = "1.1" diff --git a/src/common/grpc-expr/src/alter.rs b/src/common/grpc-expr/src/alter.rs index ea95a62e9933..5627e4fd691d 100644 --- a/src/common/grpc-expr/src/alter.rs +++ b/src/common/grpc-expr/src/alter.rs @@ -17,15 +17,15 @@ use api::v1::add_column_location::LocationType; use api::v1::alter_expr::Kind; use api::v1::column_def::as_fulltext_option; use api::v1::{ - column_def, AddColumnLocation as Location, AlterExpr, Analyzer, ChangeColumnTypes, - CreateTableExpr, DropColumns, RenameTable, SemanticType, + column_def, AddColumnLocation as Location, AlterExpr, Analyzer, CreateTableExpr, DropColumns, + ModifyColumnTypes, RenameTable, SemanticType, }; use common_query::AddColumnLocation; use datatypes::schema::{ColumnSchema, FulltextOptions, RawSchema}; use snafu::{ensure, OptionExt, ResultExt}; use store_api::region_request::ChangeOption; use table::metadata::TableId; -use table::requests::{AddColumnRequest, AlterKind, AlterTableRequest, ChangeColumnTypeRequest}; +use table::requests::{AddColumnRequest, AlterKind, AlterTableRequest, ModifyColumnTypeRequest}; use crate::error::{ InvalidChangeFulltextOptionRequestSnafu, InvalidChangeTableOptionRequestSnafu, @@ -68,25 +68,25 @@ pub fn alter_expr_to_request(table_id: TableId, expr: AlterExpr) -> Result { - let change_column_type_requests = change_column_types + let modify_column_type_requests = modify_column_types .into_iter() .map(|cct| { let target_type = ColumnDataTypeWrapper::new(cct.target_type(), cct.target_type_extension) .into(); - Ok(ChangeColumnTypeRequest { + Ok(ModifyColumnTypeRequest { column_name: cct.column_name, target_type, }) }) .collect::>>()?; - AlterKind::ChangeColumnTypes { - columns: change_column_type_requests, + AlterKind::ModifyColumnTypes { + columns: modify_column_type_requests, } } Kind::DropColumns(DropColumns { drop_columns }) => AlterKind::DropColumns { @@ -183,7 +183,7 @@ fn parse_location(location: Option) -> Result columns, + let mut modify_column_types = match alter_request.alter_kind { + AlterKind::ModifyColumnTypes { columns } => columns, _ => unreachable!(), }; - let change_column_type = change_column_types.pop().unwrap(); - assert_eq!("mem_usage", change_column_type.column_name); + let modify_column_type = modify_column_types.pop().unwrap(); + assert_eq!("mem_usage", modify_column_type.column_name); assert_eq!( ConcreteDataType::string_datatype(), - change_column_type.target_type + modify_column_type.target_type ); } diff --git a/src/common/meta/src/ddl/alter_table/region_request.rs b/src/common/meta/src/ddl/alter_table/region_request.rs index 06c93c786f7b..8d8092cf646a 100644 --- a/src/common/meta/src/ddl/alter_table/region_request.rs +++ b/src/common/meta/src/ddl/alter_table/region_request.rs @@ -91,7 +91,7 @@ fn create_proto_alter_kind( add_columns, }))) } - Kind::ChangeColumnTypes(x) => Ok(Some(alter_request::Kind::ChangeColumnTypes(x.clone()))), + Kind::ModifyColumnTypes(x) => Ok(Some(alter_request::Kind::ModifyColumnTypes(x.clone()))), Kind::DropColumns(x) => { let drop_columns = x .drop_columns @@ -123,8 +123,8 @@ mod tests { use api::v1::region::region_request::Body; use api::v1::region::RegionColumnDef; use api::v1::{ - region, AddColumn, AddColumnLocation, AddColumns, AlterExpr, ChangeColumnType, - ChangeColumnTypes, ColumnDataType, ColumnDef as PbColumnDef, SemanticType, + region, AddColumn, AddColumnLocation, AddColumns, AlterExpr, ColumnDataType, + ColumnDef as PbColumnDef, ModifyColumnType, ModifyColumnTypes, SemanticType, }; use common_catalog::consts::{DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME}; use store_api::storage::{RegionId, TableId}; @@ -284,8 +284,8 @@ mod tests { catalog_name: DEFAULT_CATALOG_NAME.to_string(), schema_name: DEFAULT_SCHEMA_NAME.to_string(), table_name, - kind: Some(Kind::ChangeColumnTypes(ChangeColumnTypes { - change_column_types: vec![ChangeColumnType { + kind: Some(Kind::ModifyColumnTypes(ModifyColumnTypes { + modify_column_types: vec![ModifyColumnType { column_name: "cpu".to_string(), target_type: ColumnDataType::String as i32, target_type_extension: None, @@ -306,9 +306,9 @@ mod tests { assert_eq!(alter_region_request.schema_version, 1); assert_eq!( alter_region_request.kind, - Some(region::alter_request::Kind::ChangeColumnTypes( - ChangeColumnTypes { - change_column_types: vec![ChangeColumnType { + Some(region::alter_request::Kind::ModifyColumnTypes( + ModifyColumnTypes { + modify_column_types: vec![ModifyColumnType { column_name: "cpu".to_string(), target_type: ColumnDataType::String as i32, target_type_extension: None, diff --git a/src/common/meta/src/ddl/alter_table/update_metadata.rs b/src/common/meta/src/ddl/alter_table/update_metadata.rs index 3b5c5a0215d5..06fd1832f739 100644 --- a/src/common/meta/src/ddl/alter_table/update_metadata.rs +++ b/src/common/meta/src/ddl/alter_table/update_metadata.rs @@ -52,7 +52,7 @@ impl AlterTableProcedure { new_info.name = new_table_name.to_string(); } AlterKind::DropColumns { .. } - | AlterKind::ChangeColumnTypes { .. } + | AlterKind::ModifyColumnTypes { .. } | AlterKind::ChangeTableOptions { .. } | AlterKind::ChangeColumnFulltext { .. } => {} } diff --git a/src/operator/src/expr_factory.rs b/src/operator/src/expr_factory.rs index d4316a142871..540561b65b8b 100644 --- a/src/operator/src/expr_factory.rs +++ b/src/operator/src/expr_factory.rs @@ -18,9 +18,9 @@ use api::helper::ColumnDataTypeWrapper; use api::v1::alter_expr::Kind; use api::v1::column_def::options_from_column_schema; use api::v1::{ - AddColumn, AddColumns, AlterExpr, Analyzer, ChangeColumnFulltext, ChangeColumnType, - ChangeColumnTypes, ChangeTableOptions, ColumnDataType, ColumnDataTypeExtension, CreateFlowExpr, - CreateTableExpr, CreateViewExpr, DropColumn, DropColumns, ExpireAfter, RenameTable, + AddColumn, AddColumns, AlterExpr, Analyzer, ChangeColumnFulltext, ChangeTableOptions, + ColumnDataType, ColumnDataTypeExtension, CreateFlowExpr, CreateTableExpr, CreateViewExpr, + DropColumn, DropColumns, ExpireAfter, ModifyColumnType, ModifyColumnTypes, RenameTable, SemanticType, TableName, }; use common_error::ext::BoxedError; @@ -501,7 +501,7 @@ pub(crate) fn to_alter_expr( location: location.as_ref().map(From::from), }], }), - AlterTableOperation::ChangeColumnType { + AlterTableOperation::ModifyColumnType { column_name, target_type, } => { @@ -510,8 +510,8 @@ pub(crate) fn to_alter_expr( let (target_type, target_type_extension) = ColumnDataTypeWrapper::try_from(target_type) .map(|w| w.to_parts()) .context(ColumnDataTypeSnafu)?; - Kind::ChangeColumnTypes(ChangeColumnTypes { - change_column_types: vec![ChangeColumnType { + Kind::ModifyColumnTypes(ModifyColumnTypes { + modify_column_types: vec![ModifyColumnType { column_name: column_name.value, target_type: target_type as i32, target_type_extension, @@ -803,7 +803,7 @@ mod tests { } #[test] - fn test_to_alter_change_column_type_expr() { + fn test_to_alter_modify_column_type_expr() { let sql = "ALTER TABLE monitor MODIFY COLUMN mem_usage STRING;"; let stmt = ParserContext::create_with_dialect(sql, &GreptimeDbDialect {}, ParseOptions::default()) @@ -819,22 +819,22 @@ mod tests { let expr = to_alter_expr(alter_table.clone(), &QueryContext::arc()).unwrap(); let kind = expr.kind.unwrap(); - let Kind::ChangeColumnTypes(ChangeColumnTypes { - change_column_types, + let Kind::ModifyColumnTypes(ModifyColumnTypes { + modify_column_types, }) = kind else { unreachable!() }; - assert_eq!(1, change_column_types.len()); - let change_column_type = &change_column_types[0]; + assert_eq!(1, modify_column_types.len()); + let modify_column_type = &modify_column_types[0]; - assert_eq!("mem_usage", change_column_type.column_name); + assert_eq!("mem_usage", modify_column_type.column_name); assert_eq!( ColumnDataType::String as i32, - change_column_type.target_type + modify_column_type.target_type ); - assert!(change_column_type.target_type_extension.is_none()); + assert!(modify_column_type.target_type_extension.is_none()); } fn new_test_table_names() -> Vec { diff --git a/src/sql/src/parsers/alter_parser.rs b/src/sql/src/parsers/alter_parser.rs index f368fa9f4376..dbf0fc3a6b3e 100644 --- a/src/sql/src/parsers/alter_parser.rs +++ b/src/sql/src/parsers/alter_parser.rs @@ -170,7 +170,7 @@ impl ParserContext<'_> { self.parse_alter_column_fulltext(column_name) } else { let data_type = self.parser.parse_data_type().context(error::SyntaxSnafu)?; - Ok(AlterTableOperation::ChangeColumnType { + Ok(AlterTableOperation::ModifyColumnType { column_name, target_type: data_type, }) @@ -399,7 +399,7 @@ mod tests { } #[test] - fn test_parse_alter_change_column_type() { + fn test_parse_alter_modify_column_type() { let sql_1 = "ALTER TABLE my_metric_1 MODIFY COLUMN a STRING"; let result_1 = ParserContext::create_with_dialect( sql_1, @@ -427,10 +427,10 @@ mod tests { let alter_operation = alter_table.alter_operation(); assert_matches!( alter_operation, - AlterTableOperation::ChangeColumnType { .. } + AlterTableOperation::ModifyColumnType { .. } ); match alter_operation { - AlterTableOperation::ChangeColumnType { + AlterTableOperation::ModifyColumnType { column_name, target_type, } => { @@ -461,10 +461,10 @@ mod tests { let alter_operation = alter_table.alter_operation(); assert_matches!( alter_operation, - AlterTableOperation::ChangeColumnType { .. } + AlterTableOperation::ModifyColumnType { .. } ); match alter_operation { - AlterTableOperation::ChangeColumnType { + AlterTableOperation::ModifyColumnType { column_name, target_type, } => { @@ -492,10 +492,10 @@ mod tests { let alter_operation = alter_table.alter_operation(); assert_matches!( alter_operation, - AlterTableOperation::ChangeColumnType { .. } + AlterTableOperation::ModifyColumnType { .. } ); match alter_operation { - AlterTableOperation::ChangeColumnType { + AlterTableOperation::ModifyColumnType { column_name, target_type, } => { diff --git a/src/sql/src/statements/alter.rs b/src/sql/src/statements/alter.rs index 180b1ee65c42..b75ec728e15d 100644 --- a/src/sql/src/statements/alter.rs +++ b/src/sql/src/statements/alter.rs @@ -66,7 +66,7 @@ pub enum AlterTableOperation { location: Option, }, /// `MODIFY [target_type]` - ChangeColumnType { + ModifyColumnType { column_name: Ident, target_type: DataType, }, @@ -101,7 +101,7 @@ impl Display for AlterTableOperation { AlterTableOperation::RenameTable { new_table_name } => { write!(f, r#"RENAME {new_table_name}"#) } - AlterTableOperation::ChangeColumnType { + AlterTableOperation::ModifyColumnType { column_name, target_type, } => { diff --git a/src/sql/src/statements/transform/type_alias.rs b/src/sql/src/statements/transform/type_alias.rs index dac5b627645a..04756e761755 100644 --- a/src/sql/src/statements/transform/type_alias.rs +++ b/src/sql/src/statements/transform/type_alias.rs @@ -53,7 +53,7 @@ impl TransformRule for TypeAliasTransformRule { .for_each(|column| replace_type_alias(column.mut_data_type())); } Statement::Alter(alter_table) => { - if let AlterTableOperation::ChangeColumnType { target_type, .. } = + if let AlterTableOperation::ModifyColumnType { target_type, .. } = alter_table.alter_operation_mut() { replace_type_alias(target_type) diff --git a/src/store-api/src/metadata.rs b/src/store-api/src/metadata.rs index bb68df458332..3a06b111d8f6 100644 --- a/src/store-api/src/metadata.rs +++ b/src/store-api/src/metadata.rs @@ -33,7 +33,7 @@ use serde::de::Error; use serde::{Deserialize, Deserializer, Serialize}; use snafu::{ensure, Location, OptionExt, ResultExt, Snafu}; -use crate::region_request::{AddColumn, AddColumnLocation, AlterKind, ChangeColumnType}; +use crate::region_request::{AddColumn, AddColumnLocation, AlterKind, ModifyColumnType}; use crate::storage::consts::is_internal_column; use crate::storage::{ColumnId, RegionId}; @@ -552,7 +552,7 @@ impl RegionMetadataBuilder { match kind { AlterKind::AddColumns { columns } => self.add_columns(columns)?, AlterKind::DropColumns { names } => self.drop_columns(&names), - AlterKind::ChangeColumnTypes { columns } => self.change_column_types(columns), + AlterKind::ModifyColumnTypes { columns } => self.modify_column_types(columns), AlterKind::ChangeColumnFulltext { column_name, options, @@ -642,11 +642,11 @@ impl RegionMetadataBuilder { } /// Changes columns type to the metadata if exist. - fn change_column_types(&mut self, columns: Vec) { + fn modify_column_types(&mut self, columns: Vec) { let mut change_type_map: HashMap<_, _> = columns .into_iter() .map( - |ChangeColumnType { + |ModifyColumnType { column_name, target_type, }| (column_name, target_type), @@ -1265,8 +1265,8 @@ mod test { let mut builder = RegionMetadataBuilder::from_existing(metadata); builder - .alter(AlterKind::ChangeColumnTypes { - columns: vec![ChangeColumnType { + .alter(AlterKind::ModifyColumnTypes { + columns: vec![ModifyColumnType { column_name: "b".to_string(), target_type: ConcreteDataType::string_datatype(), }], diff --git a/src/store-api/src/region_request.rs b/src/store-api/src/region_request.rs index ce4ab9a5c93e..4d742a1426ee 100644 --- a/src/store-api/src/region_request.rs +++ b/src/store-api/src/region_request.rs @@ -408,9 +408,9 @@ pub enum AlterKind { names: Vec, }, /// Change columns datatype form the region, only fields are allowed to change. - ChangeColumnTypes { + ModifyColumnTypes { /// Columns to change. - columns: Vec, + columns: Vec, }, /// Change region options. ChangeRegionOptions { options: Vec }, @@ -437,7 +437,7 @@ impl AlterKind { Self::validate_column_to_drop(name, metadata)?; } } - AlterKind::ChangeColumnTypes { columns } => { + AlterKind::ModifyColumnTypes { columns } => { for col_to_change in columns { col_to_change.validate(metadata)?; } @@ -460,7 +460,7 @@ impl AlterKind { AlterKind::DropColumns { names } => names .iter() .any(|name| metadata.column_by_name(name).is_some()), - AlterKind::ChangeColumnTypes { columns } => columns + AlterKind::ModifyColumnTypes { columns } => columns .iter() .any(|col_to_change| col_to_change.need_alter(metadata)), AlterKind::ChangeRegionOptions { .. } => { @@ -529,13 +529,13 @@ impl TryFrom for AlterKind { .collect::>>()?; AlterKind::AddColumns { columns } } - alter_request::Kind::ChangeColumnTypes(x) => { + alter_request::Kind::ModifyColumnTypes(x) => { let columns = x - .change_column_types + .modify_column_types .into_iter() .map(|x| x.into()) .collect::>(); - AlterKind::ChangeColumnTypes { columns } + AlterKind::ModifyColumnTypes { columns } } alter_request::Kind::DropColumns(x) => { let names = x.drop_columns.into_iter().map(|x| x.name).collect(); @@ -663,14 +663,14 @@ impl TryFrom for AddColumnLocation { /// Change a column's datatype. #[derive(Debug, PartialEq, Eq, Clone)] -pub struct ChangeColumnType { +pub struct ModifyColumnType { /// Schema of the column to modify. pub column_name: String, /// Column will be changed to this type. pub target_type: ConcreteDataType, } -impl ChangeColumnType { +impl ModifyColumnType { /// Returns an error if the column's datatype to change is invalid. pub fn validate(&self, metadata: &RegionMetadata) -> Result<()> { let column_meta = metadata @@ -711,16 +711,16 @@ impl ChangeColumnType { } } -impl From for ChangeColumnType { - fn from(change_column_type: v1::ChangeColumnType) -> Self { +impl From for ModifyColumnType { + fn from(modify_column_type: v1::ModifyColumnType) -> Self { let target_type = ColumnDataTypeWrapper::new( - change_column_type.target_type(), - change_column_type.target_type_extension, + modify_column_type.target_type(), + modify_column_type.target_type_extension, ) .into(); - ChangeColumnType { - column_name: change_column_type.column_name, + ModifyColumnType { + column_name: modify_column_type.column_name, target_type, } } @@ -1072,10 +1072,10 @@ mod tests { } #[test] - fn test_validate_change_column_type() { + fn test_validate_modify_column_type() { let metadata = new_metadata(); - AlterKind::ChangeColumnTypes { - columns: vec![ChangeColumnType { + AlterKind::ModifyColumnTypes { + columns: vec![ModifyColumnType { column_name: "xxxx".to_string(), target_type: ConcreteDataType::string_datatype(), }], @@ -1083,8 +1083,8 @@ mod tests { .validate(&metadata) .unwrap_err(); - AlterKind::ChangeColumnTypes { - columns: vec![ChangeColumnType { + AlterKind::ModifyColumnTypes { + columns: vec![ModifyColumnType { column_name: "field_1".to_string(), target_type: ConcreteDataType::date_datatype(), }], @@ -1092,8 +1092,8 @@ mod tests { .validate(&metadata) .unwrap_err(); - AlterKind::ChangeColumnTypes { - columns: vec![ChangeColumnType { + AlterKind::ModifyColumnTypes { + columns: vec![ModifyColumnType { column_name: "ts".to_string(), target_type: ConcreteDataType::date_datatype(), }], @@ -1101,8 +1101,8 @@ mod tests { .validate(&metadata) .unwrap_err(); - AlterKind::ChangeColumnTypes { - columns: vec![ChangeColumnType { + AlterKind::ModifyColumnTypes { + columns: vec![ModifyColumnType { column_name: "tag_0".to_string(), target_type: ConcreteDataType::date_datatype(), }], @@ -1110,8 +1110,8 @@ mod tests { .validate(&metadata) .unwrap_err(); - let kind = AlterKind::ChangeColumnTypes { - columns: vec![ChangeColumnType { + let kind = AlterKind::ModifyColumnTypes { + columns: vec![ModifyColumnType { column_name: "field_0".to_string(), target_type: ConcreteDataType::int32_datatype(), }], diff --git a/src/table/src/metadata.rs b/src/table/src/metadata.rs index 88c9ab11f098..af13fe40d5e4 100644 --- a/src/table/src/metadata.rs +++ b/src/table/src/metadata.rs @@ -32,7 +32,7 @@ use store_api::region_request::ChangeOption; use store_api::storage::{ColumnDescriptor, ColumnDescriptorBuilder, ColumnId, RegionId}; use crate::error::{self, Result}; -use crate::requests::{AddColumnRequest, AlterKind, ChangeColumnTypeRequest, TableOptions}; +use crate::requests::{AddColumnRequest, AlterKind, ModifyColumnTypeRequest, TableOptions}; pub type TableId = u32; pub type TableVersion = u64; @@ -201,8 +201,8 @@ impl TableMeta { self.add_columns(table_name, columns, add_if_not_exists) } AlterKind::DropColumns { names } => self.remove_columns(table_name, names), - AlterKind::ChangeColumnTypes { columns } => { - self.change_column_types(table_name, columns) + AlterKind::ModifyColumnTypes { columns } => { + self.modify_column_types(table_name, columns) } // No need to rebuild table meta when renaming tables. AlterKind::RenameTable { .. } => Ok(self.new_meta_builder()), @@ -579,15 +579,15 @@ impl TableMeta { Ok(meta_builder) } - fn change_column_types( + fn modify_column_types( &self, table_name: &str, - requests: &[ChangeColumnTypeRequest], + requests: &[ModifyColumnTypeRequest], ) -> Result { let table_schema = &self.schema; let mut meta_builder = self.new_meta_builder(); - let mut change_column_types = HashMap::with_capacity(requests.len()); + let mut modify_column_types = HashMap::with_capacity(requests.len()); let timestamp_index = table_schema.timestamp_index(); for col_to_change in requests { @@ -628,7 +628,7 @@ impl TableMeta { } ensure!( - change_column_types + modify_column_types .insert(&col_to_change.column_name, col_to_change) .is_none(), error::InvalidAlterRequestSnafu { @@ -670,7 +670,7 @@ impl TableMeta { .iter() .cloned() .map(|mut column| { - if let Some(change_column) = change_column_types.get(&column.name) { + if let Some(change_column) = modify_column_types.get(&column.name) { column.data_type = change_column.target_type.clone(); } column @@ -1298,8 +1298,8 @@ mod tests { .build() .unwrap(); - let alter_kind = AlterKind::ChangeColumnTypes { - columns: vec![ChangeColumnTypeRequest { + let alter_kind = AlterKind::ModifyColumnTypes { + columns: vec![ModifyColumnTypeRequest { column_name: "unknown".to_string(), target_type: ConcreteDataType::string_datatype(), }], @@ -1358,8 +1358,8 @@ mod tests { .unwrap(); // Remove column in primary key. - let alter_kind = AlterKind::ChangeColumnTypes { - columns: vec![ChangeColumnTypeRequest { + let alter_kind = AlterKind::ModifyColumnTypes { + columns: vec![ModifyColumnTypeRequest { column_name: "col1".to_string(), target_type: ConcreteDataType::string_datatype(), }], @@ -1372,8 +1372,8 @@ mod tests { assert_eq!(StatusCode::InvalidArguments, err.status_code()); // Remove timestamp column. - let alter_kind = AlterKind::ChangeColumnTypes { - columns: vec![ChangeColumnTypeRequest { + let alter_kind = AlterKind::ModifyColumnTypes { + columns: vec![ModifyColumnTypeRequest { column_name: "ts".to_string(), target_type: ConcreteDataType::string_datatype(), }], diff --git a/src/table/src/requests.rs b/src/table/src/requests.rs index d37bd7ca7326..43adc5199486 100644 --- a/src/table/src/requests.rs +++ b/src/table/src/requests.rs @@ -194,7 +194,7 @@ pub struct AddColumnRequest { /// Change column datatype request #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ChangeColumnTypeRequest { +pub struct ModifyColumnTypeRequest { pub column_name: String, pub target_type: ConcreteDataType, } @@ -207,8 +207,8 @@ pub enum AlterKind { DropColumns { names: Vec, }, - ChangeColumnTypes { - columns: Vec, + ModifyColumnTypes { + columns: Vec, }, RenameTable { new_table_name: String,