mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-22 22:20:02 +00:00
chore: specify import style in rustfmt (#460)
Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
221
Cargo.lock
generated
221
Cargo.lock
generated
@@ -119,7 +119,6 @@ name = "api"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"common-base",
|
||||
"common-error",
|
||||
"common-time",
|
||||
"datatypes",
|
||||
"prost 0.11.0",
|
||||
@@ -277,36 +276,6 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-io"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7"
|
||||
dependencies = [
|
||||
"async-lock",
|
||||
"autocfg",
|
||||
"concurrent-queue",
|
||||
"futures-lite",
|
||||
"libc",
|
||||
"log",
|
||||
"parking",
|
||||
"polling",
|
||||
"slab",
|
||||
"socket2",
|
||||
"waker-fn",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-lock"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685"
|
||||
dependencies = [
|
||||
"event-listener",
|
||||
"futures-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-stream"
|
||||
version = "0.3.3"
|
||||
@@ -688,12 +657,6 @@ version = "3.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
|
||||
|
||||
[[package]]
|
||||
name = "bytecount"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.12.1"
|
||||
@@ -735,37 +698,6 @@ version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
|
||||
|
||||
[[package]]
|
||||
name = "camino"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88ad0e1e3e88dd237a156ab9f571021b8a158caa0ae44b1968a241efb5144c1e"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-platform"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo_metadata"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa"
|
||||
dependencies = [
|
||||
"camino",
|
||||
"cargo-platform",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "caseless"
|
||||
version = "0.2.1"
|
||||
@@ -1026,7 +958,6 @@ dependencies = [
|
||||
"common-base",
|
||||
"common-error",
|
||||
"common-grpc",
|
||||
"common-insert",
|
||||
"common-query",
|
||||
"common-recordbatch",
|
||||
"common-time",
|
||||
@@ -1729,7 +1660,6 @@ dependencies = [
|
||||
"datafusion",
|
||||
"datafusion-common",
|
||||
"datatypes",
|
||||
"frontend",
|
||||
"futures",
|
||||
"hyper",
|
||||
"log-store",
|
||||
@@ -1948,15 +1878,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "error-chain"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc"
|
||||
dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "error-code"
|
||||
version = "2.3.1"
|
||||
@@ -2094,13 +2015,11 @@ dependencies = [
|
||||
"async-stream",
|
||||
"async-trait",
|
||||
"catalog",
|
||||
"chrono",
|
||||
"client",
|
||||
"common-base",
|
||||
"common-catalog",
|
||||
"common-error",
|
||||
"common-grpc",
|
||||
"common-insert",
|
||||
"common-query",
|
||||
"common-recordbatch",
|
||||
"common-runtime",
|
||||
@@ -2112,11 +2031,8 @@ dependencies = [
|
||||
"datanode",
|
||||
"datatypes",
|
||||
"futures",
|
||||
"futures-util",
|
||||
"itertools",
|
||||
"meta-client",
|
||||
"meta-srv",
|
||||
"moka",
|
||||
"openmetrics-parser",
|
||||
"prost 0.11.0",
|
||||
"query",
|
||||
@@ -2258,21 +2174,6 @@ version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68"
|
||||
|
||||
[[package]]
|
||||
name = "futures-lite"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"memchr",
|
||||
"parking",
|
||||
"pin-project-lite",
|
||||
"waker-fn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.24"
|
||||
@@ -3044,7 +2945,6 @@ dependencies = [
|
||||
"futures",
|
||||
"meta-srv",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"snafu",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
@@ -3184,32 +3084,6 @@ dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "moka"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b49a05f67020456541f4f29cbaa812016a266a86ec76f96d3873d459c68fe5e"
|
||||
dependencies = [
|
||||
"async-io",
|
||||
"async-lock",
|
||||
"crossbeam-channel",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
"futures-util",
|
||||
"num_cpus",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"quanta",
|
||||
"rustc_version",
|
||||
"scheduled-thread-pool",
|
||||
"skeptic",
|
||||
"smallvec",
|
||||
"tagptr",
|
||||
"thiserror",
|
||||
"triomphe",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multimap"
|
||||
version = "0.8.3"
|
||||
@@ -3684,12 +3558,6 @@ version = "6.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
|
||||
|
||||
[[package]]
|
||||
name = "parking"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.1"
|
||||
@@ -3870,9 +3738,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pgwire"
|
||||
version = "0.5.0"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5dacbf864d6cb6a0e676c9a1162ab7b315b5c8e6c87fa9b6e0ba9ba0a569adb1"
|
||||
checksum = "9e30e99a0b8acf60a6815aa8178e9ffb08178ef3ca1366673bb0d6c7ababe4c2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
@@ -3885,7 +3753,6 @@ dependencies = [
|
||||
"thiserror",
|
||||
"time 0.3.14",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tokio-util",
|
||||
]
|
||||
|
||||
@@ -4052,20 +3919,6 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polling"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"log",
|
||||
"wepoll-ffi",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "portable-atomic"
|
||||
version = "0.3.15"
|
||||
@@ -4273,17 +4126,6 @@ dependencies = [
|
||||
"prost 0.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pulldown-cmark"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"memchr",
|
||||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quanta"
|
||||
version = "0.10.1"
|
||||
@@ -4887,10 +4729,6 @@ dependencies = [
|
||||
name = "rustpython-pylib"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/RustPython/RustPython?rev=02a1d1d#02a1d1d7db57afbb78049599c2585cc7cd59e6d3"
|
||||
dependencies = [
|
||||
"rustpython-bytecode",
|
||||
"rustpython-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustpython-vm"
|
||||
@@ -5027,15 +4865,6 @@ dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scheduled-thread-pool"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "977a7519bff143a44f842fd07e80ad1329295bd71686457f18e496736f4bf9bf"
|
||||
dependencies = [
|
||||
"parking_lot",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schemars"
|
||||
version = "0.8.11"
|
||||
@@ -5147,9 +4976,6 @@ name = "semver"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
@@ -5363,21 +5189,6 @@ version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
|
||||
|
||||
[[package]]
|
||||
name = "skeptic"
|
||||
version = "0.13.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8"
|
||||
dependencies = [
|
||||
"bytecount",
|
||||
"cargo_metadata",
|
||||
"error-chain",
|
||||
"glob",
|
||||
"pulldown-cmark",
|
||||
"tempfile",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sketches-ddsketch"
|
||||
version = "0.2.0"
|
||||
@@ -5459,7 +5270,6 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||
name = "sql"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"api",
|
||||
"catalog",
|
||||
"common-catalog",
|
||||
"common-error",
|
||||
@@ -5805,12 +5615,6 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tagptr"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
|
||||
|
||||
[[package]]
|
||||
name = "tap"
|
||||
version = "1.0.1"
|
||||
@@ -6384,12 +6188,6 @@ dependencies = [
|
||||
"tracing-log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "triomphe"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1ee9bd9239c339d714d657fac840c6d2a4f9c45f4f9ec7b0975113458be78db"
|
||||
|
||||
[[package]]
|
||||
name = "try-lock"
|
||||
version = "0.2.3"
|
||||
@@ -6646,12 +6444,6 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8e76fae08f03f96e166d2dfda232190638c10e0383841252416f9cfe2ae60e6"
|
||||
|
||||
[[package]]
|
||||
name = "waker-fn"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.3.2"
|
||||
@@ -6780,15 +6572,6 @@ dependencies = [
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wepoll-ffi"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.3.0"
|
||||
|
||||
@@ -4,32 +4,24 @@
|
||||
#![feature(once_cell)]
|
||||
#![allow(clippy::print_stdout)]
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
time::Instant,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
|
||||
use arrow::{
|
||||
array::{ArrayRef, PrimitiveArray, StringArray, TimestampNanosecondArray},
|
||||
datatypes::{DataType, Float64Type, Int64Type},
|
||||
record_batch::RecordBatch,
|
||||
};
|
||||
use arrow::array::{ArrayRef, PrimitiveArray, StringArray, TimestampNanosecondArray};
|
||||
use arrow::datatypes::{DataType, Float64Type, Int64Type};
|
||||
use arrow::record_batch::RecordBatch;
|
||||
use clap::Parser;
|
||||
use client::{
|
||||
admin::Admin,
|
||||
api::v1::{
|
||||
codec::InsertBatch, column::Values, insert_expr, Column, ColumnDataType, ColumnDef,
|
||||
CreateExpr, InsertExpr,
|
||||
},
|
||||
Client, Database, Select,
|
||||
};
|
||||
use client::admin::Admin;
|
||||
use client::api::v1::codec::InsertBatch;
|
||||
use client::api::v1::column::Values;
|
||||
use client::api::v1::{insert_expr, Column, ColumnDataType, ColumnDef, CreateExpr, InsertExpr};
|
||||
use client::{Client, Database, Select};
|
||||
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
|
||||
use parquet::{
|
||||
arrow::{ArrowReader, ParquetFileArrowReader},
|
||||
file::{reader::FileReader, serialized_reader::SerializedFileReader},
|
||||
};
|
||||
use parquet::arrow::{ArrowReader, ParquetFileArrowReader};
|
||||
use parquet::file::reader::FileReader;
|
||||
use parquet::file::serialized_reader::SerializedFileReader;
|
||||
use tokio::task::JoinSet;
|
||||
|
||||
const DATABASE_NAME: &str = "greptime";
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
group_imports = "StdExternalCrate"
|
||||
|
||||
|
||||
imports_granularity = "Module"
|
||||
|
||||
@@ -7,8 +7,7 @@ use snafu::prelude::*;
|
||||
|
||||
use crate::error::{self, Result};
|
||||
use crate::v1::column::Values;
|
||||
use crate::v1::Column;
|
||||
use crate::v1::ColumnDataType;
|
||||
use crate::v1::{Column, ColumnDataType};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct ColumnDataTypeWrapper(ColumnDataType);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
use common_error::prelude::ErrorExt;
|
||||
|
||||
use crate::v1::codec::SelectResult;
|
||||
use crate::v1::{
|
||||
admin_result, codec::SelectResult, object_result, AdminResult, MutateResult, ObjectResult,
|
||||
ResultHeader, SelectResult as SelectResultRaw,
|
||||
admin_result, object_result, AdminResult, MutateResult, ObjectResult, ResultHeader,
|
||||
SelectResult as SelectResultRaw,
|
||||
};
|
||||
|
||||
pub const PROTOCOL_VERSION: u32 = 1;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
pub use prost::DecodeError;
|
||||
use prost::Message;
|
||||
|
||||
use crate::v1::codec::InsertBatch;
|
||||
use crate::v1::codec::PhysicalPlanNode;
|
||||
use crate::v1::codec::RegionNumber;
|
||||
use crate::v1::codec::SelectResult;
|
||||
use crate::v1::codec::{InsertBatch, PhysicalPlanNode, RegionNumber, SelectResult};
|
||||
use crate::v1::meta::TableRouteValue;
|
||||
|
||||
macro_rules! impl_convert_with_bytes {
|
||||
@@ -36,8 +33,7 @@ mod tests {
|
||||
use std::ops::Deref;
|
||||
|
||||
use crate::v1::codec::*;
|
||||
use crate::v1::column;
|
||||
use crate::v1::Column;
|
||||
use crate::v1::{column, Column};
|
||||
|
||||
const SEMANTIC_TAG: i32 = 0;
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
tonic::include_proto!("greptime.v1.meta");
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::hash::Hash;
|
||||
use std::hash::Hasher;
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
pub const PROTOCOL_VERSION: u64 = 1;
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ use table::table::TableIdProvider;
|
||||
use table::TableRef;
|
||||
|
||||
use crate::error::{
|
||||
CatalogNotFoundSnafu, IllegalManagerStateSnafu, OpenTableSnafu, SchemaNotFoundSnafu,
|
||||
SystemCatalogSnafu, SystemCatalogTypeMismatchSnafu, TableExistsSnafu, TableNotFoundSnafu,
|
||||
CatalogNotFoundSnafu, IllegalManagerStateSnafu, OpenTableSnafu, ReadSystemCatalogSnafu, Result,
|
||||
SchemaExistsSnafu, SchemaNotFoundSnafu, SystemCatalogSnafu, SystemCatalogTypeMismatchSnafu,
|
||||
TableExistsSnafu, TableNotFoundSnafu,
|
||||
};
|
||||
use crate::error::{ReadSystemCatalogSnafu, Result, SchemaExistsSnafu};
|
||||
use crate::local::memory::{MemoryCatalogManager, MemoryCatalogProvider, MemorySchemaProvider};
|
||||
use crate::system::{
|
||||
decode_system_catalog, Entry, SystemCatalogTable, TableEntry, ENTRY_TYPE_INDEX, KEY_INDEX,
|
||||
|
||||
@@ -2,8 +2,7 @@ use std::any::Any;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::sync::RwLock;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
use common_catalog::consts::MIN_USER_TABLE_ID;
|
||||
use snafu::OptionExt;
|
||||
|
||||
@@ -22,10 +22,9 @@ use table::TableRef;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use crate::error::{
|
||||
CatalogNotFoundSnafu, CreateTableSnafu, InvalidCatalogValueSnafu, OpenTableSnafu,
|
||||
SchemaNotFoundSnafu, TableExistsSnafu,
|
||||
CatalogNotFoundSnafu, CreateTableSnafu, InvalidCatalogValueSnafu, InvalidTableSchemaSnafu,
|
||||
OpenTableSnafu, Result, SchemaNotFoundSnafu, TableExistsSnafu,
|
||||
};
|
||||
use crate::error::{InvalidTableSchemaSnafu, Result};
|
||||
use crate::remote::{Kv, KvBackendRef};
|
||||
use crate::{
|
||||
handle_system_table_request, CatalogList, CatalogManager, CatalogProvider, CatalogProviderRef,
|
||||
|
||||
@@ -2,14 +2,12 @@ use std::any::Any;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use common_catalog::consts::{DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME};
|
||||
use common_catalog::consts::{
|
||||
INFORMATION_SCHEMA_NAME, SYSTEM_CATALOG_NAME, SYSTEM_CATALOG_TABLE_ID,
|
||||
SYSTEM_CATALOG_TABLE_NAME,
|
||||
DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME, INFORMATION_SCHEMA_NAME, SYSTEM_CATALOG_NAME,
|
||||
SYSTEM_CATALOG_TABLE_ID, SYSTEM_CATALOG_TABLE_NAME,
|
||||
};
|
||||
use common_query::logical_plan::Expr;
|
||||
use common_query::physical_plan::PhysicalPlanRef;
|
||||
use common_query::physical_plan::RuntimeEnv;
|
||||
use common_query::physical_plan::{PhysicalPlanRef, RuntimeEnv};
|
||||
use common_recordbatch::SendableRecordBatchStream;
|
||||
use common_telemetry::debug;
|
||||
use common_time::timestamp::Timestamp;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use api::v1::{codec::InsertBatch, *};
|
||||
use api::v1::codec::InsertBatch;
|
||||
use api::v1::*;
|
||||
use client::{Client, Database};
|
||||
fn main() {
|
||||
tracing::subscriber::set_global_default(tracing_subscriber::FmtSubscriber::builder().finish())
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
use api::v1::{ColumnDataType, ColumnDef, CreateExpr};
|
||||
use client::{admin::Admin, Client, Database};
|
||||
use client::admin::Admin;
|
||||
use client::{Client, Database};
|
||||
use prost_09::Message;
|
||||
use substrait_proto::protobuf::{
|
||||
plan_rel::RelType as PlanRelType,
|
||||
read_rel::{NamedTable, ReadType},
|
||||
rel::RelType,
|
||||
PlanRel, ReadRel, Rel,
|
||||
};
|
||||
use substrait_proto::protobuf::plan_rel::RelType as PlanRelType;
|
||||
use substrait_proto::protobuf::read_rel::{NamedTable, ReadType};
|
||||
use substrait_proto::protobuf::rel::RelType;
|
||||
use substrait_proto::protobuf::{PlanRel, ReadRel, Rel};
|
||||
use tracing::{event, Level};
|
||||
|
||||
fn main() {
|
||||
|
||||
@@ -2,9 +2,9 @@ use std::sync::Arc;
|
||||
|
||||
use client::{Client, Database};
|
||||
use common_grpc::MockExecution;
|
||||
use datafusion::physical_plan::{
|
||||
expressions::Column, projection::ProjectionExec, ExecutionPlan, PhysicalExpr,
|
||||
};
|
||||
use datafusion::physical_plan::expressions::Column;
|
||||
use datafusion::physical_plan::projection::ProjectionExec;
|
||||
use datafusion::physical_plan::{ExecutionPlan, PhysicalExpr};
|
||||
use tracing::{event, Level};
|
||||
|
||||
fn main() {
|
||||
|
||||
@@ -4,9 +4,7 @@ use common_query::Output;
|
||||
use snafu::prelude::*;
|
||||
|
||||
use crate::database::PROTOCOL_VERSION;
|
||||
use crate::error;
|
||||
use crate::Client;
|
||||
use crate::Result;
|
||||
use crate::{error, Client, Result};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Admin {
|
||||
|
||||
@@ -4,14 +4,11 @@ use api::v1::greptime_client::GreptimeClient;
|
||||
use api::v1::*;
|
||||
use common_grpc::channel_manager::ChannelManager;
|
||||
use parking_lot::RwLock;
|
||||
use snafu::OptionExt;
|
||||
use snafu::ResultExt;
|
||||
use snafu::{OptionExt, ResultExt};
|
||||
use tonic::transport::Channel;
|
||||
|
||||
use crate::error;
|
||||
use crate::load_balance::LoadBalance;
|
||||
use crate::load_balance::Loadbalancer;
|
||||
use crate::Result;
|
||||
use crate::load_balance::{LoadBalance, Loadbalancer};
|
||||
use crate::{error, Result};
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct Client {
|
||||
|
||||
@@ -7,8 +7,7 @@ use api::v1::{
|
||||
SelectExpr,
|
||||
};
|
||||
use common_error::status_code::StatusCode;
|
||||
use common_grpc::AsExcutionPlan;
|
||||
use common_grpc::DefaultAsPlanImpl;
|
||||
use common_grpc::{AsExcutionPlan, DefaultAsPlanImpl};
|
||||
use common_insert::column_to_vector;
|
||||
use common_query::Output;
|
||||
use common_recordbatch::{RecordBatch, RecordBatches};
|
||||
@@ -17,12 +16,10 @@ use datatypes::prelude::*;
|
||||
use datatypes::schema::{ColumnSchema, Schema};
|
||||
use snafu::{ensure, OptionExt, ResultExt};
|
||||
|
||||
use crate::error;
|
||||
use crate::error::ColumnToVectorSnafu;
|
||||
use crate::{
|
||||
error::{ConvertSchemaSnafu, DatanodeSnafu, DecodeSelectSnafu, EncodePhysicalSnafu},
|
||||
Client, Result,
|
||||
use crate::error::{
|
||||
ColumnToVectorSnafu, ConvertSchemaSnafu, DatanodeSnafu, DecodeSelectSnafu, EncodePhysicalSnafu,
|
||||
};
|
||||
use crate::{error, Client, Result};
|
||||
|
||||
pub const PROTOCOL_VERSION: u32 = 1;
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ pub mod load_balance;
|
||||
|
||||
pub use api;
|
||||
|
||||
pub use self::{
|
||||
client::Client,
|
||||
database::{Database, ObjectResult, Select},
|
||||
error::{Error, Result},
|
||||
};
|
||||
pub use self::client::Client;
|
||||
pub use self::database::{Database, ObjectResult, Select};
|
||||
pub use self::error::{Error, Result};
|
||||
|
||||
@@ -2,11 +2,8 @@ use std::fmt;
|
||||
|
||||
use clap::Parser;
|
||||
use cmd::error::Result;
|
||||
use cmd::frontend;
|
||||
use cmd::metasrv;
|
||||
use cmd::{datanode, standalone};
|
||||
use common_telemetry::logging::error;
|
||||
use common_telemetry::logging::info;
|
||||
use cmd::{datanode, frontend, metasrv, standalone};
|
||||
use common_telemetry::logging::{error, info};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[clap(name = "greptimedb")]
|
||||
|
||||
@@ -4,10 +4,8 @@ use meta_srv::bootstrap;
|
||||
use meta_srv::metasrv::MetaSrvOptions;
|
||||
use snafu::ResultExt;
|
||||
|
||||
use crate::error;
|
||||
use crate::error::Error;
|
||||
use crate::error::Result;
|
||||
use crate::toml_loader;
|
||||
use crate::error::{Error, Result};
|
||||
use crate::{error, toml_loader};
|
||||
|
||||
#[derive(Parser)]
|
||||
pub struct Command {
|
||||
|
||||
@@ -32,7 +32,8 @@ impl<'a, E: ErrorExt + ?Sized> fmt::Debug for DebugFormat<'a, E> {
|
||||
mod tests {
|
||||
use std::any::Any;
|
||||
|
||||
use snafu::{prelude::*, Backtrace, GenerateImplicitData};
|
||||
use snafu::prelude::*;
|
||||
use snafu::{Backtrace, GenerateImplicitData};
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ pub mod mock;
|
||||
pub mod status_code;
|
||||
|
||||
pub mod prelude {
|
||||
pub use snafu::{prelude::*, Backtrace, ErrorCompat};
|
||||
pub use snafu::prelude::*;
|
||||
pub use snafu::{Backtrace, ErrorCompat};
|
||||
|
||||
pub use crate::ext::{BoxedError, ErrorExt};
|
||||
pub use crate::format::DebugFormat;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use common_function_macro::as_aggr_func_creator;
|
||||
use common_function_macro::AggrFuncTypeStore;
|
||||
use common_function_macro::{as_aggr_func_creator, AggrFuncTypeStore};
|
||||
use static_assertions::{assert_fields, assert_impl_all};
|
||||
|
||||
#[as_aggr_func_creator]
|
||||
|
||||
@@ -5,8 +5,9 @@ use common_function_macro::{as_aggr_func_creator, AggrFuncTypeStore};
|
||||
use common_query::error::{BadAccumulatorImplSnafu, CreateAccumulatorSnafu, Result};
|
||||
use common_query::logical_plan::{Accumulator, AggregateFunctionCreator};
|
||||
use common_query::prelude::*;
|
||||
use datatypes::prelude::*;
|
||||
use datatypes::vectors::ConstantVector;
|
||||
use datatypes::{prelude::*, with_match_primitive_type_id};
|
||||
use datatypes::with_match_primitive_type_id;
|
||||
use snafu::ensure;
|
||||
|
||||
// https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
|
||||
|
||||
@@ -5,8 +5,9 @@ use common_function_macro::{as_aggr_func_creator, AggrFuncTypeStore};
|
||||
use common_query::error::{BadAccumulatorImplSnafu, CreateAccumulatorSnafu, Result};
|
||||
use common_query::logical_plan::{Accumulator, AggregateFunctionCreator};
|
||||
use common_query::prelude::*;
|
||||
use datatypes::prelude::*;
|
||||
use datatypes::vectors::ConstantVector;
|
||||
use datatypes::{prelude::*, with_match_primitive_type_id};
|
||||
use datatypes::with_match_primitive_type_id;
|
||||
use snafu::ensure;
|
||||
|
||||
// // https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
|
||||
|
||||
@@ -7,10 +7,11 @@ use common_query::error::{
|
||||
};
|
||||
use common_query::logical_plan::{Accumulator, AggregateFunctionCreator};
|
||||
use common_query::prelude::*;
|
||||
use datatypes::prelude::*;
|
||||
use datatypes::types::PrimitiveType;
|
||||
use datatypes::value::ListValue;
|
||||
use datatypes::vectors::{ConstantVector, ListVector};
|
||||
use datatypes::{prelude::*, with_match_primitive_type_id};
|
||||
use datatypes::with_match_primitive_type_id;
|
||||
use num_traits::AsPrimitive;
|
||||
use snafu::{ensure, OptionExt, ResultExt};
|
||||
|
||||
|
||||
@@ -7,8 +7,9 @@ use common_query::error::{
|
||||
};
|
||||
use common_query::logical_plan::{Accumulator, AggregateFunctionCreator};
|
||||
use common_query::prelude::*;
|
||||
use datatypes::prelude::*;
|
||||
use datatypes::vectors::{ConstantVector, Float64Vector, UInt64Vector};
|
||||
use datatypes::{prelude::*, with_match_primitive_type_id};
|
||||
use datatypes::with_match_primitive_type_id;
|
||||
use num_traits::AsPrimitive;
|
||||
use snafu::{ensure, OptionExt};
|
||||
|
||||
|
||||
@@ -8,10 +8,11 @@ use common_query::error::{
|
||||
};
|
||||
use common_query::logical_plan::{Accumulator, AggregateFunctionCreator};
|
||||
use common_query::prelude::*;
|
||||
use datatypes::prelude::*;
|
||||
use datatypes::types::PrimitiveType;
|
||||
use datatypes::value::ListValue;
|
||||
use datatypes::vectors::{ConstantVector, Int64Vector, ListVector};
|
||||
use datatypes::{prelude::*, with_match_primitive_type_id};
|
||||
use datatypes::with_match_primitive_type_id;
|
||||
use num_traits::AsPrimitive;
|
||||
use snafu::{ensure, OptionExt, ResultExt};
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//! functions registry
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::sync::RwLock;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@ use std::fmt;
|
||||
use std::sync::Arc;
|
||||
|
||||
use common_query::prelude::{Signature, Volatility};
|
||||
use datatypes::data_type::ConcreteDataType;
|
||||
use datatypes::data_type::DataType;
|
||||
use datatypes::data_type::{ConcreteDataType, DataType};
|
||||
use datatypes::prelude::{Scalar, VectorRef};
|
||||
use datatypes::with_match_primitive_type_id;
|
||||
use num_traits::AsPrimitive;
|
||||
|
||||
@@ -3,16 +3,12 @@ use std::sync::Arc;
|
||||
use arrow::array::PrimitiveArray;
|
||||
use arrow::compute::cast::primitive_to_primitive;
|
||||
use arrow::datatypes::DataType::Float64;
|
||||
use datatypes::arrow;
|
||||
use datatypes::data_type::DataType;
|
||||
use datatypes::prelude::ScalarVector;
|
||||
use datatypes::type_id::LogicalTypeId;
|
||||
use datatypes::value::Value;
|
||||
use datatypes::vectors::Float64Vector;
|
||||
use datatypes::vectors::PrimitiveVector;
|
||||
use datatypes::vectors::Vector;
|
||||
use datatypes::vectors::VectorRef;
|
||||
use datatypes::with_match_primitive_type_id;
|
||||
use datatypes::vectors::{Float64Vector, PrimitiveVector, Vector, VectorRef};
|
||||
use datatypes::{arrow, with_match_primitive_type_id};
|
||||
use snafu::{ensure, Snafu};
|
||||
|
||||
#[derive(Debug, Snafu)]
|
||||
@@ -247,10 +243,8 @@ pub fn interp(args: &[VectorRef]) -> Result<VectorRef> {
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use datatypes::{
|
||||
prelude::ScalarVectorBuilder,
|
||||
vectors::{Int32Vector, Int64Vector, PrimitiveVectorBuilder},
|
||||
};
|
||||
use datatypes::prelude::ScalarVectorBuilder;
|
||||
use datatypes::vectors::{Int32Vector, Int64Vector, PrimitiveVectorBuilder};
|
||||
|
||||
use super::*;
|
||||
#[test]
|
||||
|
||||
@@ -9,8 +9,7 @@ use arrow::scalar::PrimitiveScalar;
|
||||
use common_query::error::{IntoVectorSnafu, UnsupportedInputDataTypeSnafu};
|
||||
use common_query::prelude::{Signature, Volatility};
|
||||
use datatypes::prelude::ConcreteDataType;
|
||||
use datatypes::vectors::TimestampVector;
|
||||
use datatypes::vectors::VectorRef;
|
||||
use datatypes::vectors::{TimestampVector, VectorRef};
|
||||
use snafu::ResultExt;
|
||||
|
||||
use crate::error::Result;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use common_query::error::{ExecuteFunctionSnafu, FromScalarValueSnafu};
|
||||
use common_query::prelude::ScalarValue;
|
||||
use common_query::prelude::{
|
||||
ColumnarValue, ReturnTypeFunction, ScalarFunctionImplementation, ScalarUdf,
|
||||
ColumnarValue, ReturnTypeFunction, ScalarFunctionImplementation, ScalarUdf, ScalarValue,
|
||||
};
|
||||
use datatypes::error::Error as DataTypeError;
|
||||
use datatypes::prelude::{ConcreteDataType, VectorHelper};
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use dashmap::mapref::entry::Entry;
|
||||
use dashmap::DashMap;
|
||||
use snafu::ResultExt;
|
||||
use tonic::transport::Channel as InnerChannel;
|
||||
use tonic::transport::Endpoint;
|
||||
use tonic::transport::Uri;
|
||||
use tonic::transport::{Channel as InnerChannel, Endpoint, Uri};
|
||||
use tower::make::MakeConnection;
|
||||
|
||||
use crate::error;
|
||||
|
||||
@@ -84,8 +84,7 @@ impl ErrorExt for Error {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use snafu::OptionExt;
|
||||
use snafu::ResultExt;
|
||||
use snafu::{OptionExt, ResultExt};
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -4,7 +4,5 @@ pub mod physical;
|
||||
pub mod writer;
|
||||
|
||||
pub use error::Error;
|
||||
pub use physical::{
|
||||
plan::{DefaultAsPlanImpl, MockExecution},
|
||||
AsExcutionPlan,
|
||||
};
|
||||
pub use physical::plan::{DefaultAsPlanImpl, MockExecution};
|
||||
pub use physical::AsExcutionPlan;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
mod expr;
|
||||
pub mod plan;
|
||||
|
||||
use std::{result::Result, sync::Arc};
|
||||
use std::result::Result;
|
||||
use std::sync::Arc;
|
||||
|
||||
use datafusion::physical_plan::ExecutionPlan;
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
use std::{result::Result, sync::Arc};
|
||||
use std::result::Result;
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::codec;
|
||||
use datafusion::physical_plan::{expressions::Column as DfColumn, PhysicalExpr as DfPhysicalExpr};
|
||||
use datafusion::physical_plan::expressions::Column as DfColumn;
|
||||
use datafusion::physical_plan::PhysicalExpr as DfPhysicalExpr;
|
||||
use snafu::OptionExt;
|
||||
|
||||
use crate::error::{EmptyPhysicalExprSnafu, Error, UnsupportedDfExprSnafu};
|
||||
@@ -52,8 +54,10 @@ pub(crate) fn parse_df_physical_expr(
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::codec::{physical_expr_node::ExprType::Column, PhysicalColumn, PhysicalExprNode};
|
||||
use datafusion::physical_plan::{expressions::Column as DfColumn, PhysicalExpr};
|
||||
use api::v1::codec::physical_expr_node::ExprType::Column;
|
||||
use api::v1::codec::{PhysicalColumn, PhysicalExprNode};
|
||||
use datafusion::physical_plan::expressions::Column as DfColumn;
|
||||
use datafusion::physical_plan::PhysicalExpr;
|
||||
|
||||
use crate::physical::expr::{parse_df_physical_expr, parse_grpc_physical_expr};
|
||||
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
use std::{ops::Deref, result::Result, sync::Arc};
|
||||
use std::ops::Deref;
|
||||
use std::result::Result;
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::codec::{
|
||||
physical_plan_node::PhysicalPlanType, MockInputExecNode, PhysicalPlanNode, ProjectionExecNode,
|
||||
};
|
||||
use arrow::{
|
||||
array::{PrimitiveArray, Utf8Array},
|
||||
datatypes::{DataType, Field, Schema},
|
||||
};
|
||||
use api::v1::codec::physical_plan_node::PhysicalPlanType;
|
||||
use api::v1::codec::{MockInputExecNode, PhysicalPlanNode, ProjectionExecNode};
|
||||
use arrow::array::{PrimitiveArray, Utf8Array};
|
||||
use arrow::datatypes::{DataType, Field, Schema};
|
||||
use async_trait::async_trait;
|
||||
use datafusion::{
|
||||
execution::runtime_env::RuntimeEnv,
|
||||
field_util::SchemaExt,
|
||||
physical_plan::{
|
||||
memory::MemoryStream, projection::ProjectionExec, ExecutionPlan, PhysicalExpr,
|
||||
SendableRecordBatchStream, Statistics,
|
||||
},
|
||||
record_batch::RecordBatch,
|
||||
use datafusion::execution::runtime_env::RuntimeEnv;
|
||||
use datafusion::field_util::SchemaExt;
|
||||
use datafusion::physical_plan::memory::MemoryStream;
|
||||
use datafusion::physical_plan::projection::ProjectionExec;
|
||||
use datafusion::physical_plan::{
|
||||
ExecutionPlan, PhysicalExpr, SendableRecordBatchStream, Statistics,
|
||||
};
|
||||
use datafusion::record_batch::RecordBatch;
|
||||
use snafu::{OptionExt, ResultExt};
|
||||
|
||||
use crate::error::{
|
||||
@@ -211,12 +209,11 @@ mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::codec::PhysicalPlanNode;
|
||||
use datafusion::physical_plan::{expressions::Column, projection::ProjectionExec};
|
||||
use datafusion::physical_plan::expressions::Column;
|
||||
use datafusion::physical_plan::projection::ProjectionExec;
|
||||
|
||||
use crate::physical::{
|
||||
plan::{DefaultAsPlanImpl, MockExecution},
|
||||
{AsExcutionPlan, ExecutionPlanRef},
|
||||
};
|
||||
use crate::physical::plan::{DefaultAsPlanImpl, MockExecution};
|
||||
use crate::physical::{AsExcutionPlan, ExecutionPlanRef};
|
||||
|
||||
#[test]
|
||||
fn test_convert_df_projection_with_bytes() {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use api::v1::{
|
||||
codec::InsertBatch,
|
||||
column::{SemanticType, Values},
|
||||
Column, ColumnDataType,
|
||||
};
|
||||
use api::v1::codec::InsertBatch;
|
||||
use api::v1::column::{SemanticType, Values};
|
||||
use api::v1::{Column, ColumnDataType};
|
||||
use common_base::BitVec;
|
||||
use snafu::ensure;
|
||||
|
||||
@@ -232,7 +230,8 @@ pub enum Precision {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use api::v1::{column::SemanticType, ColumnDataType};
|
||||
use api::v1::column::SemanticType;
|
||||
use api::v1::ColumnDataType;
|
||||
use common_base::BitVec;
|
||||
|
||||
use super::LinesWriter;
|
||||
|
||||
@@ -1,30 +1,24 @@
|
||||
use std::collections::HashSet;
|
||||
use std::{
|
||||
collections::{hash_map::Entry, HashMap},
|
||||
ops::Deref,
|
||||
sync::Arc,
|
||||
};
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::helper::ColumnDataTypeWrapper;
|
||||
use api::v1::{
|
||||
codec::InsertBatch,
|
||||
column::{SemanticType, Values},
|
||||
AddColumns, Column, ColumnDataType,
|
||||
};
|
||||
use api::v1::{AddColumn, ColumnDef, CreateExpr};
|
||||
use api::v1::codec::InsertBatch;
|
||||
use api::v1::column::{SemanticType, Values};
|
||||
use api::v1::{AddColumn, AddColumns, Column, ColumnDataType, ColumnDef, CreateExpr};
|
||||
use common_base::BitVec;
|
||||
use common_time::timestamp::Timestamp;
|
||||
use common_time::Date;
|
||||
use common_time::DateTime;
|
||||
use common_time::{Date, DateTime};
|
||||
use datatypes::data_type::ConcreteDataType;
|
||||
use datatypes::prelude::{ValueRef, VectorRef};
|
||||
use datatypes::schema::SchemaRef;
|
||||
use datatypes::{data_type::ConcreteDataType, value::Value, vectors::VectorBuilder};
|
||||
use datatypes::value::Value;
|
||||
use datatypes::vectors::VectorBuilder;
|
||||
use snafu::{ensure, OptionExt, ResultExt};
|
||||
use table::metadata::TableId;
|
||||
use table::{
|
||||
requests::{AddColumnRequest, AlterKind, AlterTableRequest, InsertRequest},
|
||||
Table,
|
||||
};
|
||||
use table::requests::{AddColumnRequest, AlterKind, AlterTableRequest, InsertRequest};
|
||||
use table::Table;
|
||||
|
||||
use crate::error::{
|
||||
ColumnDataTypeSnafu, ColumnNotFoundSnafu, CreateVectorSnafu, DecodeInsertSnafu,
|
||||
@@ -455,20 +449,16 @@ mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::helper::ColumnDataTypeWrapper;
|
||||
use api::v1::{
|
||||
codec::InsertBatch,
|
||||
column::{self, SemanticType, Values},
|
||||
insert_expr, Column, ColumnDataType,
|
||||
};
|
||||
use api::v1::codec::InsertBatch;
|
||||
use api::v1::column::{self, SemanticType, Values};
|
||||
use api::v1::{insert_expr, Column, ColumnDataType};
|
||||
use common_base::BitVec;
|
||||
use common_query::physical_plan::PhysicalPlanRef;
|
||||
use common_query::prelude::Expr;
|
||||
use common_time::timestamp::Timestamp;
|
||||
use datatypes::{
|
||||
data_type::ConcreteDataType,
|
||||
schema::{ColumnSchema, SchemaBuilder, SchemaRef},
|
||||
value::Value,
|
||||
};
|
||||
use datatypes::data_type::ConcreteDataType;
|
||||
use datatypes::schema::{ColumnSchema, SchemaBuilder, SchemaRef};
|
||||
use datatypes::value::Value;
|
||||
use snafu::ResultExt;
|
||||
use table::error::Result as TableResult;
|
||||
use table::metadata::TableInfoRef;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use datafusion_expr::ColumnarValue as DfColumnarValue;
|
||||
use datatypes::prelude::ConcreteDataType;
|
||||
use datatypes::vectors::Helper;
|
||||
use datatypes::vectors::VectorRef;
|
||||
use datatypes::vectors::{Helper, VectorRef};
|
||||
use snafu::ResultExt;
|
||||
|
||||
use crate::error::{self, IntoVectorSnafu, Result};
|
||||
|
||||
@@ -102,8 +102,7 @@ pub fn to_df_return_type(func: ReturnTypeFunction) -> DfReturnTypeFunction {
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use datatypes::prelude::ScalarVector;
|
||||
use datatypes::prelude::Vector;
|
||||
use datatypes::prelude::{ScalarVector, Vector};
|
||||
use datatypes::vectors::BooleanVector;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -9,8 +9,7 @@ use datafusion_common::Result as DfResult;
|
||||
use datafusion_expr::Accumulator as DfAccumulator;
|
||||
use datatypes::prelude::*;
|
||||
use datatypes::value::ListValue;
|
||||
use datatypes::vectors::Helper as VectorHelper;
|
||||
use datatypes::vectors::VectorRef;
|
||||
use datatypes::vectors::{Helper as VectorHelper, VectorRef};
|
||||
use snafu::ResultExt;
|
||||
|
||||
use crate::error::{self, Error, FromScalarValueSnafu, IntoVectorSnafu, Result};
|
||||
|
||||
@@ -60,12 +60,12 @@ mod tests {
|
||||
|
||||
use arrow::array::BooleanArray;
|
||||
use arrow::datatypes::DataType;
|
||||
use datafusion_expr::ColumnarValue as DfColumnarValue;
|
||||
use datafusion_expr::ScalarUDF as DfScalarUDF;
|
||||
use datafusion_expr::TypeSignature as DfTypeSignature;
|
||||
use datafusion_expr::{
|
||||
ColumnarValue as DfColumnarValue, ScalarUDF as DfScalarUDF,
|
||||
TypeSignature as DfTypeSignature,
|
||||
};
|
||||
use datatypes::prelude::*;
|
||||
use datatypes::vectors::BooleanVector;
|
||||
use datatypes::vectors::VectorRef;
|
||||
use datatypes::vectors::{BooleanVector, VectorRef};
|
||||
|
||||
use super::*;
|
||||
use crate::error::Result;
|
||||
|
||||
@@ -6,9 +6,10 @@ use std::fmt::{self, Debug, Formatter};
|
||||
use std::sync::Arc;
|
||||
|
||||
use arrow::datatypes::DataType as ArrowDataType;
|
||||
use datafusion_expr::AccumulatorFunctionImplementation as DfAccumulatorFunctionImplementation;
|
||||
use datafusion_expr::AggregateUDF as DfAggregateUdf;
|
||||
use datafusion_expr::StateTypeFunction as DfStateTypeFunction;
|
||||
use datafusion_expr::{
|
||||
AccumulatorFunctionImplementation as DfAccumulatorFunctionImplementation,
|
||||
AggregateUDF as DfAggregateUdf, StateTypeFunction as DfStateTypeFunction,
|
||||
};
|
||||
use datatypes::prelude::*;
|
||||
|
||||
use crate::function::{
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
//! Udf module contains foundational types that are used to represent UDFs.
|
||||
//! It's modifed from datafusion.
|
||||
use std::fmt;
|
||||
use std::fmt::Debug;
|
||||
use std::fmt::Formatter;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::sync::Arc;
|
||||
|
||||
use datafusion_expr::{
|
||||
|
||||
@@ -4,8 +4,7 @@ use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use common_recordbatch::adapter::{DfRecordBatchStreamAdapter, RecordBatchStreamAdapter};
|
||||
use common_recordbatch::DfSendableRecordBatchStream;
|
||||
use common_recordbatch::SendableRecordBatchStream;
|
||||
use common_recordbatch::{DfSendableRecordBatchStream, SendableRecordBatchStream};
|
||||
use datafusion::arrow::datatypes::SchemaRef as DfSchemaRef;
|
||||
use datafusion::error::Result as DfResult;
|
||||
pub use datafusion::execution::runtime_env::RuntimeEnv;
|
||||
|
||||
@@ -2,8 +2,5 @@ pub use datafusion_common::ScalarValue;
|
||||
|
||||
pub use crate::columnar_value::ColumnarValue;
|
||||
pub use crate::function::*;
|
||||
pub use crate::logical_plan::create_udf;
|
||||
pub use crate::logical_plan::AggregateFunction;
|
||||
pub use crate::logical_plan::Expr;
|
||||
pub use crate::logical_plan::ScalarUdf;
|
||||
pub use crate::logical_plan::{create_udf, AggregateFunction, Expr, ScalarUdf};
|
||||
pub use crate::signature::{Signature, TypeSignature, Volatility};
|
||||
|
||||
@@ -5,14 +5,14 @@ use std::task::{Context, Poll};
|
||||
use datafusion::arrow::datatypes::SchemaRef as DfSchemaRef;
|
||||
use datafusion::physical_plan::RecordBatchStream as DfRecordBatchStream;
|
||||
use datafusion_common::record_batch::RecordBatch as DfRecordBatch;
|
||||
use datatypes::arrow::error::ArrowError;
|
||||
use datatypes::arrow::error::Result as ArrowResult;
|
||||
use datatypes::arrow::error::{ArrowError, Result as ArrowResult};
|
||||
use datatypes::schema::{Schema, SchemaRef};
|
||||
use snafu::ResultExt;
|
||||
|
||||
use crate::error::{self, Result};
|
||||
use crate::DfSendableRecordBatchStream;
|
||||
use crate::{RecordBatch, RecordBatchStream, SendableRecordBatchStream, Stream};
|
||||
use crate::{
|
||||
DfSendableRecordBatchStream, RecordBatch, RecordBatchStream, SendableRecordBatchStream, Stream,
|
||||
};
|
||||
|
||||
/// Greptime SendableRecordBatchStream -> DataFusion RecordBatchStream
|
||||
pub struct DfRecordBatchStreamAdapter {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use futures::TryStreamExt;
|
||||
|
||||
use crate::{error::Result, RecordBatch, SendableRecordBatchStream};
|
||||
use crate::error::Result;
|
||||
use crate::{RecordBatch, SendableRecordBatchStream};
|
||||
|
||||
pub async fn collect(stream: SendableRecordBatchStream) -> Result<Vec<RecordBatch>> {
|
||||
stream.try_collect::<Vec<_>>().await
|
||||
@@ -16,8 +17,7 @@ mod tests {
|
||||
use datafusion_common::record_batch::RecordBatch as DfRecordBatch;
|
||||
use datatypes::arrow::array::UInt32Array;
|
||||
use datatypes::arrow::datatypes::{DataType, Field, Schema as ArrowSchema};
|
||||
use datatypes::schema::Schema;
|
||||
use datatypes::schema::SchemaRef;
|
||||
use datatypes::schema::{Schema, SchemaRef};
|
||||
use futures::task::{Context, Poll};
|
||||
use futures::Stream;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::future::Future;
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
use std::{future::Future, time::Duration};
|
||||
use std::time::Duration;
|
||||
|
||||
use metrics::{decrement_gauge, increment_gauge};
|
||||
use snafu::ResultExt;
|
||||
@@ -165,7 +166,9 @@ fn on_thread_unpark(thread_name: String) -> impl Fn() + 'static {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::{sync::Arc, thread, time::Duration};
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use common_telemetry::metric;
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
@@ -7,21 +7,17 @@ use datafusion::datasource::TableProvider;
|
||||
use datafusion::logical_plan::{LogicalPlan, TableScan, ToDFSchema};
|
||||
use datafusion::physical_plan::project_schema;
|
||||
use prost::Message;
|
||||
use snafu::ensure;
|
||||
use snafu::{OptionExt, ResultExt};
|
||||
use snafu::{ensure, OptionExt, ResultExt};
|
||||
use substrait_proto::protobuf::expression::mask_expression::{StructItem, StructSelect};
|
||||
use substrait_proto::protobuf::expression::MaskExpression;
|
||||
use substrait_proto::protobuf::plan_rel::RelType as PlanRelType;
|
||||
use substrait_proto::protobuf::read_rel::{NamedTable, ReadType};
|
||||
use substrait_proto::protobuf::rel::RelType;
|
||||
use substrait_proto::protobuf::PlanRel;
|
||||
use substrait_proto::protobuf::ReadRel;
|
||||
use substrait_proto::protobuf::Rel;
|
||||
use substrait_proto::protobuf::{PlanRel, ReadRel, Rel};
|
||||
use table::table::adapter::DfTableProviderAdapter;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::error::{
|
||||
DFInternalSnafu, DecodeRelSnafu, EmptyPlanSnafu, EncodeRelSnafu, InternalSnafu,
|
||||
DFInternalSnafu, DecodeRelSnafu, EmptyPlanSnafu, EncodeRelSnafu, Error, InternalSnafu,
|
||||
InvalidParametersSnafu, MissingFieldSnafu, SchemaNotMatchSnafu, TableNotFoundSnafu,
|
||||
UnknownPlanSnafu, UnsupportedExprSnafu, UnsupportedPlanSnafu,
|
||||
};
|
||||
@@ -334,15 +330,13 @@ impl DFLogicalSubstraitConvertor {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use catalog::local::LocalCatalogManager;
|
||||
use catalog::{
|
||||
local::{MemoryCatalogProvider, MemorySchemaProvider},
|
||||
CatalogList, CatalogProvider, RegisterTableRequest,
|
||||
};
|
||||
use catalog::local::{LocalCatalogManager, MemoryCatalogProvider, MemorySchemaProvider};
|
||||
use catalog::{CatalogList, CatalogProvider, RegisterTableRequest};
|
||||
use common_catalog::consts::{DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME};
|
||||
use datafusion::logical_plan::DFSchema;
|
||||
use datatypes::schema::Schema;
|
||||
use table::{requests::CreateTableRequest, test_util::EmptyTable, test_util::MockTableEngine};
|
||||
use table::requests::CreateTableRequest;
|
||||
use table::test_util::{EmptyTable, MockTableEngine};
|
||||
|
||||
use super::*;
|
||||
use crate::schema::test::supported_types;
|
||||
|
||||
@@ -8,8 +8,7 @@ use datatypes::prelude::ConcreteDataType;
|
||||
use substrait_proto::protobuf::r#type::{self as s_type, Kind, Nullability};
|
||||
use substrait_proto::protobuf::Type as SType;
|
||||
|
||||
use crate::error::Result;
|
||||
use crate::error::{UnsupportedConcreteTypeSnafu, UnsupportedSubstraitTypeSnafu};
|
||||
use crate::error::{Result, UnsupportedConcreteTypeSnafu, UnsupportedSubstraitTypeSnafu};
|
||||
|
||||
macro_rules! substrait_kind {
|
||||
($desc:ident, $concrete_ty:ident) => {{
|
||||
|
||||
@@ -3,12 +3,7 @@ mod macros;
|
||||
pub mod metric;
|
||||
mod panic_hook;
|
||||
|
||||
pub use common_error;
|
||||
pub use logging::init_default_ut_logging;
|
||||
pub use logging::init_global_logging;
|
||||
pub use logging::{init_default_ut_logging, init_global_logging};
|
||||
pub use metric::init_default_metrics_recorder;
|
||||
pub use panic_hook::set_panic_hook;
|
||||
pub use tracing;
|
||||
pub use tracing_appender;
|
||||
pub use tracing_futures;
|
||||
pub use tracing_subscriber;
|
||||
pub use {common_error, tracing, tracing_appender, tracing_futures, tracing_subscriber};
|
||||
|
||||
@@ -1,24 +1,18 @@
|
||||
//! logging stuffs, inspired by databend
|
||||
use std::env;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
use std::sync::Once;
|
||||
use std::sync::{Arc, Mutex, Once};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use opentelemetry::global;
|
||||
use opentelemetry::sdk::propagation::TraceContextPropagator;
|
||||
pub use tracing::{event, span, Level};
|
||||
use tracing_appender::non_blocking::WorkerGuard;
|
||||
use tracing_appender::rolling::RollingFileAppender;
|
||||
use tracing_appender::rolling::Rotation;
|
||||
use tracing_bunyan_formatter::BunyanFormattingLayer;
|
||||
use tracing_bunyan_formatter::JsonStorageLayer;
|
||||
use tracing_appender::rolling::{RollingFileAppender, Rotation};
|
||||
use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};
|
||||
use tracing_log::LogTracer;
|
||||
use tracing_subscriber::filter;
|
||||
use tracing_subscriber::fmt::Layer;
|
||||
use tracing_subscriber::layer::SubscriberExt;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
use tracing_subscriber::Registry;
|
||||
use tracing_subscriber::{filter, EnvFilter, Registry};
|
||||
|
||||
pub use crate::{debug, error, info, log, trace, warn};
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use snafu::ResultExt;
|
||||
|
||||
use crate::error::Result;
|
||||
use crate::error::{Error, ParseDateStrSnafu};
|
||||
use crate::error::{Error, ParseDateStrSnafu, Result};
|
||||
|
||||
const UNIX_EPOCH_FROM_CE: i32 = 719_163;
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ use std::cmp::Ordering;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::str::FromStr;
|
||||
|
||||
use chrono::{offset::Local, DateTime, LocalResult, NaiveDateTime, TimeZone, Utc};
|
||||
use chrono::offset::Local;
|
||||
use chrono::{DateTime, LocalResult, NaiveDateTime, TimeZone, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::error::{Error, ParseTimestampSnafu};
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use std::{fs, path, sync::Arc};
|
||||
use std::{fs, path};
|
||||
|
||||
use catalog::remote::MetaKvBackend;
|
||||
use catalog::CatalogManagerRef;
|
||||
use common_grpc::channel_manager::{ChannelConfig, ChannelManager};
|
||||
use common_telemetry::logging::info;
|
||||
use frontend::frontend::Mode;
|
||||
use log_store::fs::{config::LogConfig, log::LocalFileLogStore};
|
||||
use log_store::fs::config::LogConfig;
|
||||
use log_store::fs::log::LocalFileLogStore;
|
||||
use meta_client::client::{MetaClient, MetaClientBuilder};
|
||||
use meta_client::MetaClientOpts;
|
||||
use object_store::layers::LoggingLayer;
|
||||
use object_store::{services::fs::Builder, util, ObjectStore};
|
||||
use object_store::services::fs::Builder;
|
||||
use object_store::{util, ObjectStore};
|
||||
use query::query_engine::{QueryEngineFactory, QueryEngineRef};
|
||||
use snafu::prelude::*;
|
||||
use storage::{config::EngineConfig as StorageEngineConfig, EngineImpl};
|
||||
use storage::config::EngineConfig as StorageEngineConfig;
|
||||
use storage::EngineImpl;
|
||||
use table::table::TableIdProviderRef;
|
||||
use table_engine::config::EngineConfig as TableEngineConfig;
|
||||
use table_engine::engine::MitoEngine;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
use async_trait::async_trait;
|
||||
use common_error::prelude::BoxedError;
|
||||
use common_query::Output;
|
||||
use common_telemetry::{
|
||||
logging::{error, info},
|
||||
timer,
|
||||
};
|
||||
use common_telemetry::logging::{error, info};
|
||||
use common_telemetry::timer;
|
||||
use servers::query_handler::SqlQueryHandler;
|
||||
use snafu::prelude::*;
|
||||
use sql::statements::statement::Statement;
|
||||
|
||||
@@ -24,9 +24,7 @@ impl Instance {
|
||||
// This method is used in other crate's testing codes, so move it out of "cfg(test)".
|
||||
// TODO(LFC): Delete it when callers no longer need it.
|
||||
pub async fn new_mock() -> Result<Self> {
|
||||
use table_engine::table::test_util::new_test_object_store;
|
||||
use table_engine::table::test_util::MockEngine;
|
||||
use table_engine::table::test_util::MockMitoEngine;
|
||||
use table_engine::table::test_util::{new_test_object_store, MockEngine, MockMitoEngine};
|
||||
|
||||
let mock_info = meta_srv::mocks::mock_with_memstore().await;
|
||||
let meta_client = Some(Arc::new(mock_meta_client(mock_info, 0).await));
|
||||
|
||||
@@ -2,13 +2,13 @@ use std::sync::Arc;
|
||||
|
||||
use api::helper::ColumnDataTypeWrapper;
|
||||
use api::result::AdminResultBuilder;
|
||||
use api::v1::{alter_expr::Kind, AdminResult, AlterExpr, ColumnDef, CreateExpr};
|
||||
use api::v1::alter_expr::Kind;
|
||||
use api::v1::{AdminResult, AlterExpr, ColumnDef, CreateExpr};
|
||||
use common_catalog::consts::{DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME};
|
||||
use common_error::prelude::{ErrorExt, StatusCode};
|
||||
use common_query::Output;
|
||||
use common_telemetry::{error, info};
|
||||
use datatypes::schema::ColumnDefaultConstraint;
|
||||
use datatypes::schema::{ColumnSchema, SchemaBuilder, SchemaRef};
|
||||
use datatypes::schema::{ColumnDefaultConstraint, ColumnSchema, SchemaBuilder, SchemaRef};
|
||||
use futures::TryFutureExt;
|
||||
use snafu::prelude::*;
|
||||
use table::metadata::TableId;
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use common_grpc::AsExcutionPlan;
|
||||
use common_grpc::DefaultAsPlanImpl;
|
||||
use common_query::physical_plan::PhysicalPlanAdapter;
|
||||
use common_query::physical_plan::PhysicalPlanRef;
|
||||
use common_grpc::{AsExcutionPlan, DefaultAsPlanImpl};
|
||||
use common_query::physical_plan::{PhysicalPlanAdapter, PhysicalPlanRef};
|
||||
use common_query::Output;
|
||||
use datatypes::schema::Schema;
|
||||
use query::QueryEngineRef;
|
||||
use snafu::ResultExt;
|
||||
|
||||
use crate::error::Result;
|
||||
use crate::error::{ConvertSchemaSnafu, ExecutePhysicalPlanSnafu, IntoPhysicalPlanSnafu};
|
||||
use crate::error::{ConvertSchemaSnafu, ExecutePhysicalPlanSnafu, IntoPhysicalPlanSnafu, Result};
|
||||
|
||||
pub struct PhysicalPlanner {
|
||||
query_engine: QueryEngineRef,
|
||||
|
||||
@@ -2,7 +2,9 @@ use std::sync::Arc;
|
||||
|
||||
use api::helper::ColumnDataTypeWrapper;
|
||||
use api::result::{build_err_result, ObjectResultBuilder};
|
||||
use api::v1::{codec::SelectResult, column::SemanticType, column::Values, Column, ObjectResult};
|
||||
use api::v1::codec::SelectResult;
|
||||
use api::v1::column::{SemanticType, Values};
|
||||
use api::v1::{Column, ObjectResult};
|
||||
use arrow::array::{Array, BooleanArray, PrimitiveArray};
|
||||
use common_base::BitVec;
|
||||
use common_error::status_code::StatusCode;
|
||||
@@ -183,18 +185,14 @@ pub fn values(arrays: &[Arc<dyn Array>]) -> Result<Values> {
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use arrow::{
|
||||
array::{Array, BooleanArray, PrimitiveArray},
|
||||
datatypes::{DataType, Field},
|
||||
};
|
||||
use arrow::array::{Array, BooleanArray, PrimitiveArray};
|
||||
use arrow::datatypes::{DataType, Field};
|
||||
use common_recordbatch::{RecordBatch, RecordBatches};
|
||||
use datafusion::field_util::SchemaExt;
|
||||
use datatypes::arrow::datatypes::Schema as ArrowSchema;
|
||||
use datatypes::{
|
||||
arrow_array::StringArray,
|
||||
schema::Schema,
|
||||
vectors::{UInt32Vector, VectorRef},
|
||||
};
|
||||
use datatypes::arrow_array::StringArray;
|
||||
use datatypes::schema::Schema;
|
||||
use datatypes::vectors::{UInt32Vector, VectorRef};
|
||||
|
||||
use crate::server::grpc::select::{null_mask, try_convert, values};
|
||||
|
||||
|
||||
@@ -83,7 +83,8 @@ mod tests {
|
||||
use datatypes::schema::{ColumnSchema, SchemaBuilder, SchemaRef};
|
||||
use datatypes::value::Value;
|
||||
use log_store::fs::noop::NoopLogStore;
|
||||
use object_store::{services::fs::Builder, ObjectStore};
|
||||
use object_store::services::fs::Builder;
|
||||
use object_store::ObjectStore;
|
||||
use query::QueryEngineFactory;
|
||||
use sql::statements::statement::Statement;
|
||||
use storage::config::EngineConfig as StorageEngineConfig;
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
use catalog::SchemaProviderRef;
|
||||
use common_query::Output;
|
||||
use datatypes::prelude::ConcreteDataType;
|
||||
use datatypes::prelude::VectorBuilder;
|
||||
use snafu::ensure;
|
||||
use snafu::OptionExt;
|
||||
use snafu::ResultExt;
|
||||
use datatypes::prelude::{ConcreteDataType, VectorBuilder};
|
||||
use snafu::{ensure, OptionExt, ResultExt};
|
||||
use sql::ast::Value as SqlValue;
|
||||
use sql::statements::{self, insert::Insert};
|
||||
use sql::statements::insert::Insert;
|
||||
use sql::statements::{self};
|
||||
use table::engine::TableReference;
|
||||
use table::requests::*;
|
||||
|
||||
|
||||
@@ -4,11 +4,13 @@ use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use api::v1::alter_expr::Kind;
|
||||
use api::v1::codec::InsertBatch;
|
||||
use api::v1::column::SemanticType;
|
||||
use api::v1::{
|
||||
admin_result, alter_expr::Kind, codec::InsertBatch, column, column::SemanticType, insert_expr,
|
||||
AddColumn, AlterExpr, Column, ColumnDef, CreateExpr, InsertExpr, MutateResult,
|
||||
admin_result, column, insert_expr, AddColumn, AddColumns, AlterExpr, Column, ColumnDataType,
|
||||
ColumnDef, CreateExpr, InsertExpr, MutateResult,
|
||||
};
|
||||
use api::v1::{AddColumns, ColumnDataType};
|
||||
use client::admin::Admin;
|
||||
use client::{Client, Database, ObjectResult};
|
||||
use common_catalog::consts::MIN_USER_TABLE_ID;
|
||||
|
||||
@@ -5,8 +5,7 @@ use axum::Router;
|
||||
use axum_test_helper::TestClient;
|
||||
use datatypes::prelude::ConcreteDataType;
|
||||
use frontend::frontend::FrontendOptions;
|
||||
use frontend::instance::FrontendInstance;
|
||||
use frontend::instance::Instance as FeInstance;
|
||||
use frontend::instance::{FrontendInstance, Instance as FeInstance};
|
||||
use serde_json::json;
|
||||
use servers::http::{ColumnSchema, HttpServer, JsonOutput, JsonResponse, Schema};
|
||||
use test_util::TestGuard;
|
||||
|
||||
@@ -7,8 +7,7 @@ use datatypes::data_type::ConcreteDataType;
|
||||
use datatypes::schema::{ColumnSchema, SchemaBuilder};
|
||||
use frontend::frontend::Mode;
|
||||
use snafu::ResultExt;
|
||||
use table::engine::EngineContext;
|
||||
use table::engine::TableEngineRef;
|
||||
use table::engine::{EngineContext, TableEngineRef};
|
||||
use table::requests::CreateTableRequest;
|
||||
use table_engine::config::EngineConfig;
|
||||
use table_engine::table::test_util::{new_test_object_store, MockEngine, MockMitoEngine};
|
||||
|
||||
@@ -85,9 +85,9 @@ pub fn arrow_array_get(array: &dyn Array, idx: usize) -> Result<Value> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use arrow::array::Int64Array as ArrowI64Array;
|
||||
use arrow::array::*;
|
||||
use arrow::array::{MutableListArray, MutablePrimitiveArray, TryExtend};
|
||||
use arrow::array::{
|
||||
Int64Array as ArrowI64Array, MutableListArray, MutablePrimitiveArray, TryExtend, *,
|
||||
};
|
||||
use arrow::buffer::Buffer;
|
||||
use arrow::datatypes::{DataType, TimeUnit as ArrowTimeUnit};
|
||||
use common_time::timestamp::{TimeUnit, Timestamp};
|
||||
|
||||
@@ -8,10 +8,10 @@ use serde::{Deserialize, Serialize};
|
||||
use crate::error::{self, Error, Result};
|
||||
use crate::type_id::LogicalTypeId;
|
||||
use crate::types::{
|
||||
BinaryType, BooleanType, DateType, Float32Type, Float64Type, Int16Type, Int32Type, Int64Type,
|
||||
Int8Type, ListType, NullType, StringType, UInt16Type, UInt32Type, UInt64Type, UInt8Type,
|
||||
BinaryType, BooleanType, DateTimeType, DateType, Float32Type, Float64Type, Int16Type,
|
||||
Int32Type, Int64Type, Int8Type, ListType, NullType, StringType, TimestampType, UInt16Type,
|
||||
UInt32Type, UInt64Type, UInt8Type,
|
||||
};
|
||||
use crate::types::{DateTimeType, TimestampType};
|
||||
use crate::value::Value;
|
||||
use crate::vectors::MutableVector;
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@ use snafu::OptionExt;
|
||||
|
||||
use crate::data_type::{ConcreteDataType, DataType};
|
||||
use crate::error::{self, Result};
|
||||
use crate::scalars::ScalarVectorBuilder;
|
||||
use crate::scalars::{Scalar, ScalarRef};
|
||||
use crate::scalars::{Scalar, ScalarRef, ScalarVectorBuilder};
|
||||
use crate::type_id::LogicalTypeId;
|
||||
use crate::types::primitive_traits::Primitive;
|
||||
use crate::value::{Value, ValueRef};
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use std::any::Any;
|
||||
use std::sync::Arc;
|
||||
|
||||
use arrow::array::{Array, ArrayRef};
|
||||
use arrow::array::{BinaryValueIter, MutableArray};
|
||||
use arrow::array::{Array, ArrayRef, BinaryValueIter, MutableArray};
|
||||
use arrow::bitmap::utils::ZipValidity;
|
||||
use snafu::{OptionExt, ResultExt};
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@ use crate::data_type::ConcreteDataType;
|
||||
use crate::error::{Result, SerializeSnafu};
|
||||
use crate::serialize::Serializable;
|
||||
use crate::value::{Value, ValueRef};
|
||||
use crate::vectors::Helper;
|
||||
use crate::vectors::{BooleanVector, Validity, Vector, VectorRef};
|
||||
use crate::vectors::{BooleanVector, Helper, Validity, Vector, VectorRef};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ConstantVector {
|
||||
|
||||
@@ -2,8 +2,7 @@ use std::any::Any;
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
|
||||
use arrow::array::ArrayRef;
|
||||
use arrow::array::{Array, NullArray};
|
||||
use arrow::array::{Array, ArrayRef, NullArray};
|
||||
use arrow::datatypes::DataType as ArrowDataType;
|
||||
use snafu::{ensure, OptionExt};
|
||||
|
||||
|
||||
@@ -9,10 +9,8 @@ use serde_json::Value as JsonValue;
|
||||
use snafu::{OptionExt, ResultExt};
|
||||
|
||||
use crate::data_type::{ConcreteDataType, DataType};
|
||||
use crate::error::ConversionSnafu;
|
||||
use crate::error::{Result, SerializeSnafu};
|
||||
use crate::scalars::{Scalar, ScalarRef};
|
||||
use crate::scalars::{ScalarVector, ScalarVectorBuilder};
|
||||
use crate::error::{ConversionSnafu, Result, SerializeSnafu};
|
||||
use crate::scalars::{Scalar, ScalarRef, ScalarVector, ScalarVectorBuilder};
|
||||
use crate::serialize::Serializable;
|
||||
use crate::types::{Primitive, PrimitiveElement};
|
||||
use crate::value::{Value, ValueRef};
|
||||
|
||||
@@ -10,11 +10,9 @@ use sql::statements::create::{CreateTable, TIME_INDEX};
|
||||
use sql::statements::{column_def_to_schema, table_idents_to_full_name};
|
||||
use sqlparser::ast::{ColumnDef, TableConstraint};
|
||||
|
||||
use crate::error::InvalidSqlSnafu;
|
||||
use crate::error::Result;
|
||||
use crate::error::{
|
||||
BuildCreateExprOnInsertionSnafu, ColumnDataTypeSnafu, ConvertColumnDefaultConstraintSnafu,
|
||||
ParseSqlSnafu,
|
||||
InvalidSqlSnafu, ParseSqlSnafu, Result,
|
||||
};
|
||||
|
||||
pub type CreateExprFactoryRef = Arc<dyn CreateExprFactory + Send + Sync>;
|
||||
|
||||
@@ -34,10 +34,11 @@ use servers::query_handler::{
|
||||
PrometheusProtocolHandler, ScriptHandler, ScriptHandlerRef, SqlQueryHandler,
|
||||
};
|
||||
use snafu::prelude::*;
|
||||
use sql::dialect::GenericDialect;
|
||||
use sql::parser::ParserContext;
|
||||
use sql::statements::create::Partitions;
|
||||
use sql::statements::insert::Insert;
|
||||
use sql::statements::statement::Statement;
|
||||
use sql::{dialect::GenericDialect, parser::ParserContext};
|
||||
|
||||
use crate::catalog::FrontendCatalogManager;
|
||||
use crate::datanode::DatanodeClients;
|
||||
@@ -713,10 +714,10 @@ mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
|
||||
use api::v1::codec::{InsertBatch, SelectResult};
|
||||
use api::v1::column::SemanticType;
|
||||
use api::v1::{
|
||||
admin_expr, admin_result, column, column::SemanticType, object_expr, object_result,
|
||||
select_expr, Column, ColumnDataType, ColumnDef as GrpcColumnDef, ExprHeader, MutateResult,
|
||||
SelectExpr,
|
||||
admin_expr, admin_result, column, object_expr, object_result, select_expr, Column,
|
||||
ColumnDataType, ColumnDef as GrpcColumnDef, ExprHeader, MutateResult, SelectExpr,
|
||||
};
|
||||
use datatypes::schema::ColumnDefaultConstraint;
|
||||
use datatypes::value::Value;
|
||||
|
||||
@@ -7,8 +7,9 @@ use async_trait::async_trait;
|
||||
use common_catalog::consts::DEFAULT_CATALOG_NAME;
|
||||
use common_error::prelude::BoxedError;
|
||||
use common_insert::column_to_vector;
|
||||
use servers::error as server_error;
|
||||
use servers::influxdb::InfluxdbRequest;
|
||||
use servers::{error as server_error, query_handler::InfluxdbLineProtocolHandler};
|
||||
use servers::query_handler::InfluxdbLineProtocolHandler;
|
||||
use snafu::{OptionExt, ResultExt};
|
||||
use table::requests::InsertRequest;
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
use api::prometheus::remote::{
|
||||
read_request::ResponseType, Query, QueryResult, ReadRequest, ReadResponse, WriteRequest,
|
||||
};
|
||||
use api::prometheus::remote::read_request::ResponseType;
|
||||
use api::prometheus::remote::{Query, QueryResult, ReadRequest, ReadResponse, WriteRequest};
|
||||
use async_trait::async_trait;
|
||||
use client::ObjectResult;
|
||||
use client::{Database, Select};
|
||||
use client::{Database, ObjectResult, Select};
|
||||
use common_error::prelude::BoxedError;
|
||||
use common_telemetry::logging;
|
||||
use prost::Message;
|
||||
@@ -162,9 +160,8 @@ impl PrometheusProtocolHandler for Instance {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use api::prometheus::remote::{
|
||||
label_matcher::Type as MatcherType, Label, LabelMatcher, Sample,
|
||||
};
|
||||
use api::prometheus::remote::label_matcher::Type as MatcherType;
|
||||
use api::prometheus::remote::{Label, LabelMatcher, Sample};
|
||||
use api::v1::CreateDatabaseExpr;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -4,12 +4,10 @@ use std::fmt::Formatter;
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::InsertExpr;
|
||||
use client::ObjectResult;
|
||||
use client::{Database, Select};
|
||||
use client::{Database, ObjectResult, Select};
|
||||
use common_query::prelude::Expr;
|
||||
use common_query::Output;
|
||||
use common_recordbatch::util;
|
||||
use common_recordbatch::RecordBatches;
|
||||
use common_recordbatch::{util, RecordBatches};
|
||||
use datafusion::logical_plan::{LogicalPlan as DfLogicPlan, LogicalPlanBuilder};
|
||||
use datafusion_expr::Expr as DfExpr;
|
||||
use datatypes::prelude::Value;
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use datatypes::value::Value;
|
||||
use datatypes::vectors::VectorBuilder;
|
||||
use datatypes::vectors::VectorRef;
|
||||
use snafu::ensure;
|
||||
use snafu::OptionExt;
|
||||
use datatypes::vectors::{VectorBuilder, VectorRef};
|
||||
use snafu::{ensure, OptionExt};
|
||||
use store_api::storage::RegionNumber;
|
||||
use table::requests::InsertRequest;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::error::FindPartitionColumnSnafu;
|
||||
use crate::error::FindRegionSnafu;
|
||||
use crate::error::InvalidInsertRequestSnafu;
|
||||
use crate::error::Result;
|
||||
use crate::error::{
|
||||
Error, FindPartitionColumnSnafu, FindRegionSnafu, InvalidInsertRequestSnafu, Result,
|
||||
};
|
||||
use crate::partitioning::PartitionRuleRef;
|
||||
|
||||
pub type DistInsertRequest = HashMap<RegionNumber, InsertRequest>;
|
||||
@@ -159,15 +155,15 @@ fn partition_insert_request(
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::any::Any;
|
||||
use std::{collections::HashMap, result::Result, sync::Arc};
|
||||
use std::collections::HashMap;
|
||||
use std::result::Result;
|
||||
use std::sync::Arc;
|
||||
|
||||
use common_catalog::consts::{DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME};
|
||||
use datatypes::{
|
||||
data_type::ConcreteDataType,
|
||||
types::{BooleanType, StringType},
|
||||
value::Value,
|
||||
vectors::VectorBuilder,
|
||||
};
|
||||
use datatypes::data_type::ConcreteDataType;
|
||||
use datatypes::types::{BooleanType, StringType};
|
||||
use datatypes::value::Value;
|
||||
use datatypes::vectors::VectorBuilder;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use store_api::storage::RegionNumber;
|
||||
use table::requests::InsertRequest;
|
||||
@@ -176,10 +172,8 @@ mod tests {
|
||||
check_req, find_partitioning_values, partition_insert_request, partition_values,
|
||||
WriteSpliter,
|
||||
};
|
||||
use crate::{
|
||||
error::Error,
|
||||
partitioning::{PartitionExpr, PartitionRule, PartitionRuleRef},
|
||||
};
|
||||
use crate::error::Error;
|
||||
use crate::partitioning::{PartitionExpr, PartitionRule, PartitionRuleRef};
|
||||
|
||||
#[test]
|
||||
fn test_insert_req_check() {
|
||||
|
||||
@@ -443,8 +443,7 @@ mod test {
|
||||
use common_recordbatch::util;
|
||||
use datafusion::arrow_print;
|
||||
use datafusion_common::record_batch::RecordBatch as DfRecordBatch;
|
||||
use datafusion_expr::expr_fn::col;
|
||||
use datafusion_expr::expr_fn::{and, binary_expr, or};
|
||||
use datafusion_expr::expr_fn::{and, binary_expr, col, or};
|
||||
use datafusion_expr::lit;
|
||||
use datanode::datanode::{DatanodeOptions, ObjectStoreConfig};
|
||||
use datanode::instance::Instance;
|
||||
|
||||
@@ -2,19 +2,13 @@ use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::helper::ColumnDataTypeWrapper;
|
||||
use api::v1::codec;
|
||||
use api::v1::codec::InsertBatch;
|
||||
use api::v1::column::SemanticType;
|
||||
use api::v1::insert_expr;
|
||||
use api::v1::insert_expr::Expr;
|
||||
use api::v1::Column;
|
||||
use api::v1::InsertExpr;
|
||||
use api::v1::MutateResult;
|
||||
use api::v1::{codec, insert_expr, Column, InsertExpr, MutateResult};
|
||||
use client::{Database, ObjectResult};
|
||||
use datatypes::prelude::ConcreteDataType;
|
||||
use snafu::ensure;
|
||||
use snafu::OptionExt;
|
||||
use snafu::ResultExt;
|
||||
use snafu::{ensure, OptionExt, ResultExt};
|
||||
use store_api::storage::RegionNumber;
|
||||
use table::requests::InsertRequest;
|
||||
|
||||
@@ -144,9 +138,13 @@ fn to_insert_expr(region_number: RegionNumber, insert: InsertRequest) -> Result<
|
||||
mod tests {
|
||||
use std::collections::HashMap;
|
||||
|
||||
use api::v1::{codec::InsertBatch, insert_expr::Expr, ColumnDataType, InsertExpr};
|
||||
use api::v1::codec::InsertBatch;
|
||||
use api::v1::insert_expr::Expr;
|
||||
use api::v1::{ColumnDataType, InsertExpr};
|
||||
use common_catalog::consts::{DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME};
|
||||
use datatypes::{prelude::ConcreteDataType, types::StringType, vectors::VectorBuilder};
|
||||
use datatypes::prelude::ConcreteDataType;
|
||||
use datatypes::types::StringType;
|
||||
use datatypes::vectors::VectorBuilder;
|
||||
use table::requests::InsertRequest;
|
||||
|
||||
use super::to_insert_expr;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use std::collections::LinkedList;
|
||||
|
||||
use common_base::buffer::Buffer;
|
||||
use common_base::buffer::UnderflowSnafu;
|
||||
use common_base::buffer::{Buffer, UnderflowSnafu};
|
||||
use snafu::ensure;
|
||||
|
||||
pub const DEFAULT_CHUNK_SIZE: usize = 4096;
|
||||
|
||||
@@ -5,8 +5,7 @@ use std::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use async_stream::stream;
|
||||
use byteorder::ByteOrder;
|
||||
use byteorder::LittleEndian;
|
||||
use byteorder::{ByteOrder, LittleEndian};
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use common_error::ext::BoxedError;
|
||||
use common_telemetry::logging::{error, info};
|
||||
@@ -18,8 +17,7 @@ use store_api::logstore::entry::{Encode, Entry, Id, Offset};
|
||||
use store_api::logstore::entry_stream::EntryStream;
|
||||
use store_api::logstore::namespace::Namespace;
|
||||
use tokio::sync::mpsc::error::TryRecvError;
|
||||
use tokio::sync::mpsc::Receiver;
|
||||
use tokio::sync::mpsc::Sender as MpscSender;
|
||||
use tokio::sync::mpsc::{Receiver, Sender as MpscSender};
|
||||
use tokio::sync::oneshot::Sender as OneshotSender;
|
||||
use tokio::sync::{oneshot, Notify};
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
@@ -3,8 +3,7 @@ use std::os::unix::fs::FileExt;
|
||||
|
||||
use snafu::ResultExt;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::error::IoSnafu;
|
||||
use crate::error::{Error, IoSnafu};
|
||||
|
||||
pub fn pread_exact(file: &File, buf: &mut [u8], offset: u64) -> Result<(), Error> {
|
||||
file.read_exact_at(buf, offset as u64).context(IoSnafu)
|
||||
|
||||
@@ -5,8 +5,7 @@ use std::sync::Arc;
|
||||
use arc_swap::ArcSwap;
|
||||
use async_stream::stream;
|
||||
use common_telemetry::{error, info, warn};
|
||||
use futures::pin_mut;
|
||||
use futures::StreamExt;
|
||||
use futures::{pin_mut, StreamExt};
|
||||
use snafu::{OptionExt, ResultExt};
|
||||
use store_api::logstore::entry::{Encode, Entry, Id};
|
||||
use store_api::logstore::entry_stream::SendableEntryStream;
|
||||
@@ -272,7 +271,8 @@ impl LogStore for LocalFileLogStore {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use futures_util::StreamExt;
|
||||
use rand::{distributions::Alphanumeric, Rng};
|
||||
use rand::distributions::Alphanumeric;
|
||||
use rand::Rng;
|
||||
use store_api::logstore::entry::Entry;
|
||||
use tempdir::TempDir;
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
use store_api::logstore::entry::Id;
|
||||
use store_api::logstore::namespace::Id as NamespaceId;
|
||||
use store_api::logstore::{entry::Id, LogStore};
|
||||
use store_api::logstore::LogStore;
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
use crate::fs::{entry::EntryImpl, namespace::LocalNamespace, AppendResponseImpl};
|
||||
use crate::fs::entry::EntryImpl;
|
||||
use crate::fs::namespace::LocalNamespace;
|
||||
use crate::fs::AppendResponseImpl;
|
||||
|
||||
/// A noop log store which only for test
|
||||
// TODO: Add a test feature
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use tempdir::TempDir;
|
||||
|
||||
use crate::fs::{config::LogConfig, log::LocalFileLogStore};
|
||||
use crate::fs::config::LogConfig;
|
||||
use crate::fs::log::LocalFileLogStore;
|
||||
|
||||
/// Create a tmp directory for write log, used for test.
|
||||
// TODO: Add a test feature
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use api::v1::meta::HeartbeatRequest;
|
||||
use api::v1::meta::Peer;
|
||||
use common_grpc::channel_manager::ChannelConfig;
|
||||
use common_grpc::channel_manager::ChannelManager;
|
||||
use api::v1::meta::{HeartbeatRequest, Peer};
|
||||
use common_grpc::channel_manager::{ChannelConfig, ChannelManager};
|
||||
use meta_client::client::MetaClientBuilder;
|
||||
use meta_client::rpc::BatchPutRequest;
|
||||
use meta_client::rpc::CompareAndPutRequest;
|
||||
use meta_client::rpc::CreateRequest;
|
||||
use meta_client::rpc::DeleteRangeRequest;
|
||||
use meta_client::rpc::Partition;
|
||||
use meta_client::rpc::PutRequest;
|
||||
use meta_client::rpc::RangeRequest;
|
||||
use meta_client::rpc::TableName;
|
||||
use tracing::event;
|
||||
use tracing::subscriber;
|
||||
use tracing::Level;
|
||||
use meta_client::rpc::{
|
||||
BatchPutRequest, CompareAndPutRequest, CreateRequest, DeleteRangeRequest, Partition,
|
||||
PutRequest, RangeRequest, TableName,
|
||||
};
|
||||
use tracing::{event, subscriber, Level};
|
||||
use tracing_subscriber::FmtSubscriber;
|
||||
|
||||
fn main() {
|
||||
|
||||
@@ -3,31 +3,21 @@ mod load_balance;
|
||||
mod router;
|
||||
mod store;
|
||||
|
||||
use common_grpc::channel_manager::ChannelConfig;
|
||||
use common_grpc::channel_manager::ChannelManager;
|
||||
use common_grpc::channel_manager::{ChannelConfig, ChannelManager};
|
||||
use common_telemetry::info;
|
||||
use heartbeat::Client as HeartbeatClient;
|
||||
use router::Client as RouterClient;
|
||||
use snafu::OptionExt;
|
||||
use store::Client as StoreClient;
|
||||
|
||||
pub use self::heartbeat::HeartbeatSender;
|
||||
pub use self::heartbeat::HeartbeatStream;
|
||||
pub use self::heartbeat::{HeartbeatSender, HeartbeatStream};
|
||||
use crate::error;
|
||||
use crate::error::Result;
|
||||
use crate::rpc::BatchPutRequest;
|
||||
use crate::rpc::BatchPutResponse;
|
||||
use crate::rpc::CompareAndPutRequest;
|
||||
use crate::rpc::CompareAndPutResponse;
|
||||
use crate::rpc::CreateRequest;
|
||||
use crate::rpc::DeleteRangeRequest;
|
||||
use crate::rpc::DeleteRangeResponse;
|
||||
use crate::rpc::PutRequest;
|
||||
use crate::rpc::PutResponse;
|
||||
use crate::rpc::RangeRequest;
|
||||
use crate::rpc::RangeResponse;
|
||||
use crate::rpc::RouteRequest;
|
||||
use crate::rpc::RouteResponse;
|
||||
use crate::rpc::{
|
||||
BatchPutRequest, BatchPutResponse, CompareAndPutRequest, CompareAndPutResponse, CreateRequest,
|
||||
DeleteRangeRequest, DeleteRangeResponse, PutRequest, PutResponse, RangeRequest, RangeResponse,
|
||||
RouteRequest, RouteResponse,
|
||||
};
|
||||
|
||||
pub type Id = (u64, u64);
|
||||
|
||||
@@ -273,17 +263,14 @@ impl MetaClient {
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::meta::HeartbeatRequest;
|
||||
use api::v1::meta::Peer;
|
||||
use api::v1::meta::{HeartbeatRequest, Peer};
|
||||
use meta_srv::metasrv::Context;
|
||||
use meta_srv::selector::Namespace;
|
||||
use meta_srv::selector::Selector;
|
||||
use meta_srv::selector::{Namespace, Selector};
|
||||
use meta_srv::Result as MetaResult;
|
||||
|
||||
use super::*;
|
||||
use crate::mocks;
|
||||
use crate::rpc::Partition;
|
||||
use crate::rpc::TableName;
|
||||
use crate::rpc::{Partition, TableName};
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_meta_client_builder() {
|
||||
|
||||
@@ -2,18 +2,11 @@ use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::meta::heartbeat_client::HeartbeatClient;
|
||||
use api::v1::meta::AskLeaderRequest;
|
||||
use api::v1::meta::HeartbeatRequest;
|
||||
use api::v1::meta::HeartbeatResponse;
|
||||
use api::v1::meta::RequestHeader;
|
||||
use api::v1::meta::{AskLeaderRequest, HeartbeatRequest, HeartbeatResponse, RequestHeader};
|
||||
use common_grpc::channel_manager::ChannelManager;
|
||||
use common_telemetry::debug;
|
||||
use common_telemetry::info;
|
||||
use snafu::ensure;
|
||||
use snafu::OptionExt;
|
||||
use snafu::ResultExt;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::sync::RwLock;
|
||||
use common_telemetry::{debug, info};
|
||||
use snafu::{ensure, OptionExt, ResultExt};
|
||||
use tokio::sync::{mpsc, RwLock};
|
||||
use tokio_stream::wrappers::ReceiverStream;
|
||||
use tonic::transport::Channel;
|
||||
use tonic::Streaming;
|
||||
|
||||
@@ -2,18 +2,13 @@ use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::meta::router_client::RouterClient;
|
||||
use api::v1::meta::CreateRequest;
|
||||
use api::v1::meta::RouteRequest;
|
||||
use api::v1::meta::RouteResponse;
|
||||
use api::v1::meta::{CreateRequest, RouteRequest, RouteResponse};
|
||||
use common_grpc::channel_manager::ChannelManager;
|
||||
use snafu::ensure;
|
||||
use snafu::OptionExt;
|
||||
use snafu::ResultExt;
|
||||
use snafu::{ensure, OptionExt, ResultExt};
|
||||
use tokio::sync::RwLock;
|
||||
use tonic::transport::Channel;
|
||||
|
||||
use crate::client::load_balance as lb;
|
||||
use crate::client::Id;
|
||||
use crate::client::{load_balance as lb, Id};
|
||||
use crate::error;
|
||||
use crate::error::Result;
|
||||
|
||||
|
||||
@@ -2,25 +2,16 @@ use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::meta::store_client::StoreClient;
|
||||
use api::v1::meta::BatchPutRequest;
|
||||
use api::v1::meta::BatchPutResponse;
|
||||
use api::v1::meta::CompareAndPutRequest;
|
||||
use api::v1::meta::CompareAndPutResponse;
|
||||
use api::v1::meta::DeleteRangeRequest;
|
||||
use api::v1::meta::DeleteRangeResponse;
|
||||
use api::v1::meta::PutRequest;
|
||||
use api::v1::meta::PutResponse;
|
||||
use api::v1::meta::RangeRequest;
|
||||
use api::v1::meta::RangeResponse;
|
||||
use api::v1::meta::{
|
||||
BatchPutRequest, BatchPutResponse, CompareAndPutRequest, CompareAndPutResponse,
|
||||
DeleteRangeRequest, DeleteRangeResponse, PutRequest, PutResponse, RangeRequest, RangeResponse,
|
||||
};
|
||||
use common_grpc::channel_manager::ChannelManager;
|
||||
use snafu::ensure;
|
||||
use snafu::OptionExt;
|
||||
use snafu::ResultExt;
|
||||
use snafu::{ensure, OptionExt, ResultExt};
|
||||
use tokio::sync::RwLock;
|
||||
use tonic::transport::Channel;
|
||||
|
||||
use crate::client::load_balance as lb;
|
||||
use crate::client::Id;
|
||||
use crate::client::{load_balance as lb, Id};
|
||||
use crate::error;
|
||||
use crate::error::Result;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod client;
|
||||
pub mod error;
|
||||
|
||||
@@ -2,8 +2,7 @@ use meta_srv::metasrv::SelectorRef;
|
||||
use meta_srv::mocks as server_mock;
|
||||
use meta_srv::mocks::MockInfo;
|
||||
|
||||
use crate::client::MetaClient;
|
||||
use crate::client::MetaClientBuilder;
|
||||
use crate::client::{MetaClient, MetaClientBuilder};
|
||||
|
||||
pub async fn mock_client_with_memstore() -> MetaClient {
|
||||
let mock_info = server_mock::mock_with_memstore().await;
|
||||
|
||||
@@ -4,28 +4,18 @@ pub mod util;
|
||||
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
use api::v1::meta::KeyValue as PbKeyValue;
|
||||
use api::v1::meta::Peer as PbPeer;
|
||||
use api::v1::meta::ResponseHeader as PbResponseHeader;
|
||||
use api::v1::meta::TableName as PbTableName;
|
||||
pub use router::CreateRequest;
|
||||
pub use router::Partition;
|
||||
pub use router::Region;
|
||||
pub use router::RouteRequest;
|
||||
pub use router::RouteResponse;
|
||||
pub use router::Table;
|
||||
pub use router::TableRoute;
|
||||
use api::v1::meta::{
|
||||
KeyValue as PbKeyValue, Peer as PbPeer, ResponseHeader as PbResponseHeader,
|
||||
TableName as PbTableName,
|
||||
};
|
||||
pub use router::{
|
||||
CreateRequest, Partition, Region, RouteRequest, RouteResponse, Table, TableRoute,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
pub use store::BatchPutRequest;
|
||||
pub use store::BatchPutResponse;
|
||||
pub use store::CompareAndPutRequest;
|
||||
pub use store::CompareAndPutResponse;
|
||||
pub use store::DeleteRangeRequest;
|
||||
pub use store::DeleteRangeResponse;
|
||||
pub use store::PutRequest;
|
||||
pub use store::PutResponse;
|
||||
pub use store::RangeRequest;
|
||||
pub use store::RangeResponse;
|
||||
pub use store::{
|
||||
BatchPutRequest, BatchPutResponse, CompareAndPutRequest, CompareAndPutResponse,
|
||||
DeleteRangeRequest, DeleteRangeResponse, PutRequest, PutResponse, RangeRequest, RangeResponse,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ResponseHeader(PbResponseHeader);
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use api::v1::meta::CreateRequest as PbCreateRequest;
|
||||
use api::v1::meta::Partition as PbPartition;
|
||||
use api::v1::meta::Region as PbRegion;
|
||||
use api::v1::meta::RouteRequest as PbRouteRequest;
|
||||
use api::v1::meta::RouteResponse as PbRouteResponse;
|
||||
use api::v1::meta::Table as PbTable;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::Serializer;
|
||||
use api::v1::meta::{
|
||||
CreateRequest as PbCreateRequest, Partition as PbPartition, Region as PbRegion,
|
||||
RouteRequest as PbRouteRequest, RouteResponse as PbRouteResponse, Table as PbTable,
|
||||
};
|
||||
use serde::{Deserialize, Serialize, Serializer};
|
||||
use snafu::OptionExt;
|
||||
|
||||
use crate::error;
|
||||
use crate::error::Result;
|
||||
use crate::rpc::util;
|
||||
use crate::rpc::Peer;
|
||||
use crate::rpc::TableName;
|
||||
use crate::rpc::{util, Peer, TableName};
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct RouteRequest {
|
||||
@@ -266,15 +260,11 @@ impl From<PbPartition> for Partition {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use api::v1::meta::Partition as PbPartition;
|
||||
use api::v1::meta::Peer as PbPeer;
|
||||
use api::v1::meta::Region as PbRegion;
|
||||
use api::v1::meta::RegionRoute as PbRegionRoute;
|
||||
use api::v1::meta::RouteRequest as PbRouteRequest;
|
||||
use api::v1::meta::RouteResponse as PbRouteResponse;
|
||||
use api::v1::meta::Table as PbTable;
|
||||
use api::v1::meta::TableName as PbTableName;
|
||||
use api::v1::meta::TableRoute as PbTableRoute;
|
||||
use api::v1::meta::{
|
||||
Partition as PbPartition, Peer as PbPeer, Region as PbRegion, RegionRoute as PbRegionRoute,
|
||||
RouteRequest as PbRouteRequest, RouteResponse as PbRouteResponse, Table as PbTable,
|
||||
TableName as PbTableName, TableRoute as PbTableRoute,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
use api::v1::meta::BatchPutRequest as PbBatchPutRequest;
|
||||
use api::v1::meta::BatchPutResponse as PbBatchPutResponse;
|
||||
use api::v1::meta::CompareAndPutRequest as PbCompareAndPutRequest;
|
||||
use api::v1::meta::CompareAndPutResponse as PbCompareAndPutResponse;
|
||||
use api::v1::meta::DeleteRangeRequest as PbDeleteRangeRequest;
|
||||
use api::v1::meta::DeleteRangeResponse as PbDeleteRangeResponse;
|
||||
use api::v1::meta::KeyValue as PbKeyValue;
|
||||
use api::v1::meta::PutRequest as PbPutRequest;
|
||||
use api::v1::meta::PutResponse as PbPutResponse;
|
||||
use api::v1::meta::RangeRequest as PbRangeRequest;
|
||||
use api::v1::meta::RangeResponse as PbRangeResponse;
|
||||
use api::v1::meta::{
|
||||
BatchPutRequest as PbBatchPutRequest, BatchPutResponse as PbBatchPutResponse,
|
||||
CompareAndPutRequest as PbCompareAndPutRequest,
|
||||
CompareAndPutResponse as PbCompareAndPutResponse, DeleteRangeRequest as PbDeleteRangeRequest,
|
||||
DeleteRangeResponse as PbDeleteRangeResponse, KeyValue as PbKeyValue,
|
||||
PutRequest as PbPutRequest, PutResponse as PbPutResponse, RangeRequest as PbRangeRequest,
|
||||
RangeResponse as PbRangeResponse,
|
||||
};
|
||||
|
||||
use crate::error;
|
||||
use crate::error::Result;
|
||||
use crate::rpc::util;
|
||||
use crate::rpc::KeyValue;
|
||||
use crate::rpc::ResponseHeader;
|
||||
use crate::rpc::{util, KeyValue, ResponseHeader};
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct RangeRequest {
|
||||
@@ -514,17 +509,14 @@ impl DeleteRangeResponse {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use api::v1::meta::BatchPutRequest as PbBatchPutRequest;
|
||||
use api::v1::meta::BatchPutResponse as PbBatchPutResponse;
|
||||
use api::v1::meta::CompareAndPutRequest as PbCompareAndPutRequest;
|
||||
use api::v1::meta::CompareAndPutResponse as PbCompareAndPutResponse;
|
||||
use api::v1::meta::DeleteRangeRequest as PbDeleteRangeRequest;
|
||||
use api::v1::meta::DeleteRangeResponse as PbDeleteRangeResponse;
|
||||
use api::v1::meta::KeyValue as PbKeyValue;
|
||||
use api::v1::meta::PutRequest as PbPutRequest;
|
||||
use api::v1::meta::PutResponse as PbPutResponse;
|
||||
use api::v1::meta::RangeRequest as PbRangeRequest;
|
||||
use api::v1::meta::RangeResponse as PbRangeResponse;
|
||||
use api::v1::meta::{
|
||||
BatchPutRequest as PbBatchPutRequest, BatchPutResponse as PbBatchPutResponse,
|
||||
CompareAndPutRequest as PbCompareAndPutRequest,
|
||||
CompareAndPutResponse as PbCompareAndPutResponse,
|
||||
DeleteRangeRequest as PbDeleteRangeRequest, DeleteRangeResponse as PbDeleteRangeResponse,
|
||||
KeyValue as PbKeyValue, PutRequest as PbPutRequest, PutResponse as PbPutResponse,
|
||||
RangeRequest as PbRangeRequest, RangeResponse as PbRangeResponse,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user