mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-24 17:00:37 +00:00
feat: impl insert for DistTable (#406)
* feat: impl insert for dist_table in frontend * add the logic of decode region id in datanode.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
use std::ops::Deref;
|
||||
|
||||
use api::v1::codec::RegionId;
|
||||
use api::v1::{
|
||||
admin_expr, codec::InsertBatch, insert_expr, object_expr, select_expr, AdminExpr, AdminResult,
|
||||
ObjectExpr, ObjectResult, SelectExpr,
|
||||
@@ -200,6 +203,18 @@ impl GrpcQueryHandler for Instance {
|
||||
.context(servers::error::InvalidQuerySnafu {
|
||||
reason: "missing `expr` in `InsertExpr`",
|
||||
})?;
|
||||
|
||||
// TODO(fys): _region_id is for later use.
|
||||
let _region_id: Option<RegionId> = insert_expr
|
||||
.options
|
||||
.get("region_id")
|
||||
.map(|id| {
|
||||
id.deref()
|
||||
.try_into()
|
||||
.context(servers::error::DecodeRegionIdSnafu)
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
match expr {
|
||||
insert_expr::Expr::Values(values) => {
|
||||
self.handle_insert(table_name, values).await
|
||||
|
||||
Reference in New Issue
Block a user