mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-23 16:30:39 +00:00
chore: update rust toolchain to 2026-03-21 (#7849)
* chore: update rust toolchain to 2026-03-21 * chore: new format * fix: lint * chore: resolve lint issues * chore: remove as_millis_f64 * chore: deps up
This commit is contained in:
32
Cargo.lock
generated
32
Cargo.lock
generated
@@ -565,7 +565,7 @@ dependencies = [
|
||||
"arrow-schema 57.3.0",
|
||||
"arrow-select 57.3.0",
|
||||
"flatbuffers",
|
||||
"lz4_flex 0.12.0",
|
||||
"lz4_flex 0.12.1",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
@@ -6277,7 +6277,7 @@ dependencies = [
|
||||
"js-sys",
|
||||
"log",
|
||||
"wasm-bindgen",
|
||||
"windows-core 0.61.2",
|
||||
"windows-core 0.57.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7592,18 +7592,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lz4_flex"
|
||||
version = "0.11.5"
|
||||
version = "0.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08ab2867e3eeeca90e844d1940eab391c9dc5228783db2ed999acbc0a9ed375a"
|
||||
checksum = "373f5eceeeab7925e0c1098212f2fbc4d416adec9d35051a6ab251e824c1854a"
|
||||
dependencies = [
|
||||
"twox-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lz4_flex"
|
||||
version = "0.12.0"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab6473172471198271ff72e9379150e9dfd70d8e533e0752a27e515b48dd375e"
|
||||
checksum = "98c23545df7ecf1b16c303910a69b079e8e251d60f7dd2cc9b4177f2afaf1746"
|
||||
dependencies = [
|
||||
"twox-hash",
|
||||
]
|
||||
@@ -9122,7 +9122,7 @@ dependencies = [
|
||||
"flate2",
|
||||
"futures",
|
||||
"futures-util",
|
||||
"lz4_flex 0.11.5",
|
||||
"lz4_flex 0.11.6",
|
||||
"lzokay-native",
|
||||
"num",
|
||||
"prost 0.13.5",
|
||||
@@ -9345,7 +9345,7 @@ dependencies = [
|
||||
"futures",
|
||||
"half",
|
||||
"hashbrown 0.16.1",
|
||||
"lz4_flex 0.12.0",
|
||||
"lz4_flex 0.12.1",
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
@@ -10574,7 +10574,7 @@ dependencies = [
|
||||
"common-test-util",
|
||||
"derive_builder 0.20.2",
|
||||
"futures",
|
||||
"lz4_flex 0.11.5",
|
||||
"lz4_flex 0.11.6",
|
||||
"moka",
|
||||
"pin-project",
|
||||
"prometheus 0.14.0",
|
||||
@@ -11306,9 +11306,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rsasl"
|
||||
version = "2.2.0"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8b534a23662bb559c5c73213be63ecd6524e774d291f3618c2b04b723d184eb"
|
||||
checksum = "9f1bcb95b531681a622f3d6972eaab523e17e2aad6d6209f0276628eb1cb5038"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"core2",
|
||||
@@ -11320,7 +11320,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"stringprep",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -12308,9 +12308,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.10"
|
||||
version = "0.4.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d"
|
||||
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||
|
||||
[[package]]
|
||||
name = "slotmap"
|
||||
@@ -13224,7 +13224,7 @@ dependencies = [
|
||||
"levenshtein_automata",
|
||||
"log",
|
||||
"lru",
|
||||
"lz4_flex 0.11.5",
|
||||
"lz4_flex 0.11.6",
|
||||
"measure_time",
|
||||
"memmap2",
|
||||
"once_cell",
|
||||
@@ -14714,7 +14714,7 @@ dependencies = [
|
||||
"itertools 0.14.0",
|
||||
"lalrpop",
|
||||
"lalrpop-util",
|
||||
"lz4_flex 0.11.5",
|
||||
"lz4_flex 0.11.6",
|
||||
"md-5",
|
||||
"nom 7.1.3",
|
||||
"ofb",
|
||||
|
||||
18
flake.lock
generated
18
flake.lock
generated
@@ -8,11 +8,11 @@
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770794449,
|
||||
"narHash": "sha256-1nFkhcZx9+Sdw5OXwJqp5TxvGncqRqLeK781v0XV3WI=",
|
||||
"lastModified": 1774250935,
|
||||
"narHash": "sha256-mWID0WFgTnd9hbEeaPNX+YYWF70JN3r7zBouEqERJOE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "b19d93fdf9761e6101f8cb5765d638bacebd9a1b",
|
||||
"rev": "64d7705e8c37d650cfb1aa99c24a8ce46597f29e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -41,11 +41,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1770617025,
|
||||
"narHash": "sha256-1jZvgZoAagZZB6NwGRv2T2ezPy+X6EFDsJm+YSlsvEs=",
|
||||
"lastModified": 1774244481,
|
||||
"narHash": "sha256-4XfMXU0DjN83o6HWZoKG9PegCvKvIhNUnRUI19vzTcQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2db38e08fdadcc0ce3232f7279bab59a15b94482",
|
||||
"rev": "4590696c8693fea477850fe379a01544293ca4e2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -65,11 +65,11 @@
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1770702974,
|
||||
"narHash": "sha256-CbvWu72rpGHK5QynoXwuOnVzxX7njF2LYgk8wRSiAQ0=",
|
||||
"lastModified": 1774221325,
|
||||
"narHash": "sha256-aEIdkqB8gtQZtEbogdUb5iyfcZpKIlD3FkG8ANu73/I=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "07a594815f7c1d6e7e39f21ddeeedb75b21795f4",
|
||||
"rev": "b42b63f390a4dab14e6efa34a70e67f5b087cc62",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
lib = nixpkgs.lib;
|
||||
rustToolchain = fenix.packages.${system}.fromToolchainName {
|
||||
name = (lib.importTOML ./rust-toolchain.toml).toolchain.channel;
|
||||
sha256 = "sha256-GCGEXGZeJySLND0KU5TdtTrqFV76TF3UdvAHSUegSsk=";
|
||||
sha256 = "sha256-rboGKQLH4eDuiY01SINOqmXUFUNr9F4awoFZGzib17o=";
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2025-10-01"
|
||||
channel = "nightly-2026-03-21"
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::greptime_request::Request;
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
#![feature(try_blocks)]
|
||||
|
||||
use std::any::Any;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -132,15 +132,13 @@ impl CatalogManager for MemoryCatalogManager {
|
||||
table_name: &str,
|
||||
_query_ctx: Option<&QueryContext>,
|
||||
) -> Result<Option<TableRef>> {
|
||||
let result = try {
|
||||
self.catalogs
|
||||
.read()
|
||||
.unwrap()
|
||||
.get(catalog)?
|
||||
.get(schema)?
|
||||
.get(table_name)
|
||||
.cloned()?
|
||||
};
|
||||
let catalogs = self.catalogs.read().unwrap();
|
||||
let result = catalogs
|
||||
.get(catalog)
|
||||
.and_then(|c| c.get(schema))
|
||||
.and_then(|s| s.get(table_name))
|
||||
.cloned();
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
@@ -149,8 +147,8 @@ impl CatalogManager for MemoryCatalogManager {
|
||||
.catalogs
|
||||
.read()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.flat_map(|(_, schema_entries)| schema_entries.values())
|
||||
.values()
|
||||
.flat_map(|schema_entries| schema_entries.values())
|
||||
.flat_map(|tables| tables.values())
|
||||
.find(|t| t.table_info().ident.table_id == table_id)
|
||||
.map(|t| t.table_info()))
|
||||
|
||||
@@ -372,22 +372,16 @@ impl InformationSchemaTablesBuilder {
|
||||
self.table_types.push(Some(table_type_text));
|
||||
self.table_ids.push(Some(table_id));
|
||||
|
||||
let data_length = region_stats.iter().map(|stat| stat.sst_size).sum();
|
||||
let table_rows = region_stats.iter().map(|stat| stat.num_rows).sum();
|
||||
let index_length = region_stats.iter().map(|stat| stat.index_size).sum();
|
||||
let data_length: u64 = region_stats.iter().map(|stat| stat.sst_size).sum();
|
||||
let table_rows: u64 = region_stats.iter().map(|stat| stat.num_rows).sum();
|
||||
let index_length: u64 = region_stats.iter().map(|stat| stat.index_size).sum();
|
||||
|
||||
// It's not precise, but it is acceptable for long-term data storage.
|
||||
let avg_row_length = if table_rows > 0 {
|
||||
let total_data_length = data_length
|
||||
+ region_stats
|
||||
.iter()
|
||||
.map(|stat| stat.memtable_size)
|
||||
.sum::<u64>();
|
||||
|
||||
total_data_length / table_rows
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let total_data_length: u64 = data_length
|
||||
+ region_stats
|
||||
.iter()
|
||||
.map(|stat| stat.memtable_size)
|
||||
.sum::<u64>();
|
||||
let avg_row_length = total_data_length.checked_div(table_rows).unwrap_or(0);
|
||||
|
||||
self.data_length.push(Some(data_length));
|
||||
self.index_length.push(Some(index_length));
|
||||
|
||||
@@ -74,12 +74,10 @@ impl PGCatalogProvider {
|
||||
)
|
||||
.expect("Failed to initialize PgCatalogSchemaProvider");
|
||||
|
||||
let mut table_ids = HashMap::new();
|
||||
let mut table_id = PG_CATALOG_TABLE_ID_START;
|
||||
for name in PG_CATALOG_TABLES {
|
||||
table_ids.insert(*name, table_id);
|
||||
table_id += 1;
|
||||
}
|
||||
let table_ids: HashMap<_, _> = (PG_CATALOG_TABLE_ID_START..)
|
||||
.zip(PG_CATALOG_TABLES.iter())
|
||||
.map(|(id, name)| (*name, id))
|
||||
.collect();
|
||||
|
||||
let mut provider = Self {
|
||||
catalog_name,
|
||||
|
||||
@@ -195,7 +195,7 @@ impl DfTableSourceProvider {
|
||||
plan_columns
|
||||
.iter()
|
||||
.map(|c| c.as_str())
|
||||
.zip(columns.into_iter())
|
||||
.zip(columns)
|
||||
.collect(),
|
||||
)
|
||||
.context(ProjectViewColumnsSnafu)?
|
||||
|
||||
@@ -458,8 +458,10 @@ impl Export {
|
||||
|
||||
/// build operator with preference for file system
|
||||
async fn build_prefer_fs_operator(&self) -> Result<ObjectStore> {
|
||||
if self.storage_type.is_remote_storage() && self.ddl_local_dir.is_some() {
|
||||
let root = self.ddl_local_dir.as_ref().unwrap().clone();
|
||||
if self.storage_type.is_remote_storage()
|
||||
&& let Some(ddl_local_dir) = &self.ddl_local_dir
|
||||
{
|
||||
let root = ddl_local_dir.clone();
|
||||
let op = new_fs_object_store(&root).map_err(|e| Error::Other {
|
||||
source: e,
|
||||
location: snafu::location!(),
|
||||
|
||||
@@ -512,7 +512,7 @@ struct FlightContext {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use api::v1::auth_header::AuthScheme;
|
||||
use api::v1::{AuthHeader, Basic};
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
|
||||
mod client;
|
||||
pub mod client_manager;
|
||||
pub mod database;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![recursion_limit = "256"]
|
||||
#![doc = include_str!("../../../../README.md")]
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
@@ -356,7 +356,7 @@ impl StartCommand {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::io::Write;
|
||||
use std::time::Duration;
|
||||
|
||||
|
||||
@@ -662,7 +662,7 @@ impl ScanbenchCommand {
|
||||
|
||||
// Sort ranges within each partition by start time ascending
|
||||
for partition in &mut partitions {
|
||||
partition.sort_by(|a, b| a.start.cmp(&b.start));
|
||||
partition.sort_by_key(|a| a.start);
|
||||
}
|
||||
|
||||
scanner
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
use async_trait::async_trait;
|
||||
use common_error::ext::ErrorExt;
|
||||
|
||||
@@ -12,10 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::vec;
|
||||
use std::{assert_matches, vec};
|
||||
|
||||
use common_test_util::find_workspace_path;
|
||||
use datafusion::assert_batches_eq;
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
pub mod buffered_writer;
|
||||
pub mod compressed_writer;
|
||||
pub mod compression;
|
||||
|
||||
@@ -52,7 +52,7 @@ pub enum Error {
|
||||
|
||||
#[snafu(display("Failed to invoke list process service"))]
|
||||
CreateChannel {
|
||||
source: common_grpc::error::Error,
|
||||
source: Box<common_grpc::error::Error>,
|
||||
#[snafu(implicit)]
|
||||
location: Location,
|
||||
},
|
||||
|
||||
@@ -91,6 +91,7 @@ impl FrontendSelector for MetaClientSelector {
|
||||
let channel = self
|
||||
.channel_manager
|
||||
.get(node.peer.addr)
|
||||
.map_err(Box::new)
|
||||
.context(error::CreateChannelSnafu)?;
|
||||
let client = frontend_client::FrontendClient::new(channel);
|
||||
Ok(Box::new(client) as FrontendClientPtr)
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(try_blocks)]
|
||||
#![feature(assert_matches)]
|
||||
|
||||
mod admin;
|
||||
mod flush_flow;
|
||||
|
||||
@@ -794,16 +794,12 @@ impl Tokenizer {
|
||||
is_quote_present = true;
|
||||
break;
|
||||
}
|
||||
' ' => {
|
||||
if !is_quoted {
|
||||
break;
|
||||
}
|
||||
' ' if !is_quoted => {
|
||||
break;
|
||||
}
|
||||
'(' | ')' | '+' | '-' => {
|
||||
if !is_quoted {
|
||||
self.rewind_one();
|
||||
break;
|
||||
}
|
||||
'(' | ')' | '+' | '-' if !is_quoted => {
|
||||
self.rewind_one();
|
||||
break;
|
||||
}
|
||||
'\\' => {
|
||||
let Some(next) = self.consume_next(pattern) else {
|
||||
|
||||
@@ -141,7 +141,7 @@ where
|
||||
results.push((self.func)(v0, v1)?);
|
||||
}
|
||||
|
||||
let results = ScalarValue::iter_to_array(results.into_iter())?;
|
||||
let results = ScalarValue::iter_to_array(results)?;
|
||||
Ok(ColumnarValue::Array(results))
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
let results = ScalarValue::iter_to_array(results.into_iter())?;
|
||||
let results = ScalarValue::iter_to_array(results)?;
|
||||
Ok(ColumnarValue::Array(results))
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,7 @@ where
|
||||
results.push((self.func)(&v)?);
|
||||
}
|
||||
|
||||
let results = ScalarValue::iter_to_array(results.into_iter())?;
|
||||
let results = ScalarValue::iter_to_array(results)?;
|
||||
Ok(ColumnarValue::Array(results))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ mod tests {
|
||||
"External error: Invalid vector string: [7.0,hello,9.0]",
|
||||
];
|
||||
|
||||
for (input, expected) in inputs.into_iter().zip(expected.into_iter()) {
|
||||
for (input, expected) in inputs.into_iter().zip(expected) {
|
||||
let args = ScalarFunctionArgs {
|
||||
args: vec![ColumnarValue::Array(Arc::new(input))],
|
||||
arg_fields: vec![],
|
||||
|
||||
@@ -303,7 +303,7 @@ impl TryFrom<i32> for Role {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use common_workload::DatanodeWorkloadType;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ impl State for DropDatabaseStart {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::ddl::drop_database::cursor::DropDatabaseCursor;
|
||||
|
||||
@@ -322,7 +322,7 @@ impl DropTableExecutor {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ pub mod datanode_handler;
|
||||
pub mod flownode_handler;
|
||||
pub mod region_metadata;
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use api::v1::meta::Partition;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::region::RegionResponse;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -256,7 +256,7 @@ async fn test_on_submit_alter_request() {
|
||||
results.push(result);
|
||||
}
|
||||
rx.try_recv().unwrap_err();
|
||||
results.sort_unstable_by(|(a, _), (b, _)| a.id.cmp(&b.id));
|
||||
results.sort_unstable_by_key(|(a, _)| a.id);
|
||||
|
||||
let (peer, request) = results.remove(0);
|
||||
assert_alter_request(peer, request, 1, RegionId::new(table_id, 1));
|
||||
@@ -310,7 +310,7 @@ async fn test_on_submit_alter_request_without_sync_request() {
|
||||
results.push(result);
|
||||
}
|
||||
rx.try_recv().unwrap_err();
|
||||
results.sort_unstable_by(|(a, _), (b, _)| a.id.cmp(&b.id));
|
||||
results.sort_unstable_by_key(|(a, _)| a.id);
|
||||
|
||||
let (peer, request) = results.remove(0);
|
||||
assert_alter_request(peer, request, 1, RegionId::new(table_id, 1));
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::region::RegionResponse;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ async fn test_on_datanode_drop_regions() {
|
||||
let result = rx.try_recv().unwrap();
|
||||
results.push(result);
|
||||
}
|
||||
results.sort_unstable_by(|(a, _), (b, _)| a.id.cmp(&b.id));
|
||||
results.sort_unstable_by_key(|(a, _)| a.id);
|
||||
|
||||
let (peer, request) = results.remove(0);
|
||||
check(peer, request, 1, RegionId::new(table_id, 1), false);
|
||||
|
||||
@@ -987,8 +987,7 @@ impl MySqlElection {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::env;
|
||||
use std::{assert_matches, env};
|
||||
|
||||
use common_telemetry::init_default_ut_logging;
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
@@ -829,8 +829,7 @@ impl PgElection {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::env;
|
||||
use std::{assert_matches, env};
|
||||
|
||||
use deadpool_postgres::{Config, Runtime};
|
||||
use tokio_postgres::NoTls;
|
||||
|
||||
@@ -390,7 +390,7 @@ impl std::fmt::Debug for FlowMetadataManager {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ impl TopicNameManager {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -575,12 +575,12 @@ macro_rules! record_rds_sql_execute_elapsed {
|
||||
.inspect(|_| {
|
||||
$crate::metrics::RDS_SQL_EXECUTE_ELAPSED
|
||||
.with_label_values(&[$label_store, "success", $label_op, $label_type])
|
||||
.observe(timer.elapsed().as_millis_f64())
|
||||
.observe(timer.elapsed().as_millis() as f64)
|
||||
})
|
||||
.inspect_err(|_| {
|
||||
$crate::metrics::RDS_SQL_EXECUTE_ELAPSED
|
||||
.with_label_values(&[$label_store, "error", $label_op, $label_type])
|
||||
.observe(timer.elapsed().as_millis_f64());
|
||||
.observe(timer.elapsed().as_millis() as f64);
|
||||
})
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
#![feature(duration_millis_float)]
|
||||
|
||||
pub mod cache;
|
||||
pub mod cache_invalidator;
|
||||
pub mod cluster;
|
||||
|
||||
@@ -187,7 +187,7 @@ impl<T> PaginationStream<T> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ impl State for UpdateTableInfos {
|
||||
.persistent_ctx
|
||||
.update_table_infos
|
||||
.iter()
|
||||
.zip(table_info_values.into_iter())
|
||||
.zip(table_info_values)
|
||||
{
|
||||
let new_table_info = Self::build_new_table_info(
|
||||
*table_id,
|
||||
|
||||
@@ -949,7 +949,7 @@ impl Display for ReconcileTableMetrics {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ impl Inner {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::any::Any;
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ impl MetadataSnapshotManager {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
|
||||
use common_test_util::temp_dir::{TempDir, create_temp_dir};
|
||||
|
||||
@@ -380,9 +380,8 @@ impl PoisonStore for KvStateStore {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::env;
|
||||
use std::sync::Arc;
|
||||
use std::{assert_matches, env};
|
||||
|
||||
use common_procedure::store::state_store::KeyValue;
|
||||
use common_telemetry::info;
|
||||
|
||||
@@ -172,7 +172,7 @@ pub fn extract_topic_from_wal_options(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use common_wal::config::kafka::MetasrvKafkaConfig;
|
||||
use common_wal::config::kafka::common::KafkaTopicConfig;
|
||||
|
||||
@@ -136,7 +136,7 @@ impl KafkaTopicPool {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use common_wal::maybe_skip_kafka_integration_test;
|
||||
use common_wal::test_util::get_kafka_endpoints;
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
//! Common traits and structures for the procedure framework.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
|
||||
pub mod error;
|
||||
pub mod event;
|
||||
pub mod local;
|
||||
|
||||
@@ -920,7 +920,7 @@ pub(crate) mod test_util {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use common_error::mock::MockError;
|
||||
use common_error::status_code::StatusCode;
|
||||
|
||||
@@ -704,7 +704,7 @@ impl Runner {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ fn merge_multiple_values(
|
||||
let (key, value) = pairs.into_iter().next().unwrap();
|
||||
let prefix = KeySet::with_prefix(&key);
|
||||
let mut parsed_segments = parse_segments(segments, &prefix)?;
|
||||
parsed_segments.sort_unstable_by(|a, b| a.0.cmp(&b.0));
|
||||
parsed_segments.sort_unstable_by_key(|a| a.0);
|
||||
|
||||
// Safety: `parsed_segments` must larger than 0.
|
||||
let segment_num = parsed_segments.last().unwrap().0;
|
||||
@@ -133,7 +133,7 @@ pub fn multiple_value_stream(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use futures::TryStreamExt;
|
||||
use futures::stream::{self};
|
||||
|
||||
@@ -485,7 +485,7 @@ impl QueryMemoryTracker {
|
||||
"{} requested, {} used globally ({}%), {} used by this stream, hard limit: {}",
|
||||
ReadableSize(additional as u64),
|
||||
ReadableSize(current as u64),
|
||||
if limit > 0 { current * 100 / limit } else { 0 },
|
||||
(current * 100).checked_div(limit).unwrap_or(0),
|
||||
ReadableSize(stream_tracked as u64),
|
||||
ReadableSize(limit as u64)
|
||||
);
|
||||
@@ -613,7 +613,7 @@ impl StreamMemoryTracker {
|
||||
waited,
|
||||
ReadableSize(additional as u64),
|
||||
ReadableSize(current as u64),
|
||||
if limit > 0 { current * 100 / limit } else { 0 },
|
||||
(current * 100).checked_div(limit).unwrap_or(0),
|
||||
ReadableSize(self.tracked_bytes as u64),
|
||||
ReadableSize(limit as u64)
|
||||
);
|
||||
|
||||
@@ -437,7 +437,7 @@ fn maybe_align_json_array_with_schema(
|
||||
}
|
||||
|
||||
let mut aligned = Vec::with_capacity(arrays.len());
|
||||
for (field, array) in schema.fields().iter().zip(arrays.into_iter()) {
|
||||
for (field, array) in schema.fields().iter().zip(arrays) {
|
||||
if !is_json_extension_type(field) {
|
||||
aligned.push(array);
|
||||
continue;
|
||||
|
||||
@@ -122,7 +122,7 @@ pub fn parse_column_default_constraint(
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use datatypes::prelude::{ConcreteDataType, Value};
|
||||
use datatypes::types::BooleanType;
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
|
||||
pub mod convert;
|
||||
pub mod default_constraint;
|
||||
pub mod error;
|
||||
|
||||
@@ -21,10 +21,12 @@ mod panic_hook;
|
||||
pub mod tracing_context;
|
||||
mod tracing_sampler;
|
||||
|
||||
pub use common_error;
|
||||
pub use logging::{
|
||||
LOG_RELOAD_HANDLE, TRACE_RELOAD_HANDLE, get_or_init_tracer, init_default_ut_logging,
|
||||
init_global_logging,
|
||||
};
|
||||
pub use metric::dump_metrics;
|
||||
pub use panic_hook::set_panic_hook;
|
||||
pub use {common_error, tracing, tracing_subscriber};
|
||||
pub use tracing;
|
||||
pub use tracing_subscriber;
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use error::{EndpointIPV4NotFoundSnafu, ResolveEndpointSnafu, Result};
|
||||
@@ -59,7 +57,7 @@ async fn resolve_to_ipv4_one<T: AsRef<str>>(endpoint: T) -> Result<String> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use common_telemetry::warn;
|
||||
use rskafka::client::{Credentials, SaslConfig};
|
||||
|
||||
@@ -551,14 +551,15 @@ impl DatanodeBuilder {
|
||||
if kafka_config.create_index && opts.node_id.is_none() {
|
||||
warn!("The WAL index creation only available in distributed mode.")
|
||||
}
|
||||
let global_index_collector = if kafka_config.create_index && opts.node_id.is_some()
|
||||
let global_index_collector = if kafka_config.create_index
|
||||
&& let Some(node_id) = opts.node_id
|
||||
{
|
||||
let operator = new_object_store_without_cache(
|
||||
&opts.storage.store,
|
||||
&opts.storage.data_home,
|
||||
)
|
||||
.await?;
|
||||
let path = default_index_file(opts.node_id.unwrap());
|
||||
let path = default_index_file(node_id);
|
||||
Some(Self::build_global_index_collector(
|
||||
kafka_config.dump_index_interval,
|
||||
operator,
|
||||
@@ -782,7 +783,7 @@ async fn open_all_regions(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ impl HeartbeatResponseHandler for RegionHeartbeatResponseHandler {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -47,7 +47,7 @@ impl InstructionHandler for CloseRegionsHandler {
|
||||
let results = join_all(futs).await;
|
||||
|
||||
let mut errors = vec![];
|
||||
for (region_id, result) in region_ids.into_iter().zip(results.into_iter()) {
|
||||
for (region_id, result) in region_ids.into_iter().zip(results) {
|
||||
match result {
|
||||
Ok(_) => (),
|
||||
Err(error::Error::RegionNotFound { .. }) => {
|
||||
@@ -79,7 +79,6 @@ mod tests {
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
|
||||
use assert_matches::assert_matches;
|
||||
use common_meta::RegionIdent;
|
||||
use common_meta::heartbeat::handler::{HandleControl, HeartbeatResponseHandler};
|
||||
use common_meta::heartbeat::mailbox::MessageMeta;
|
||||
|
||||
@@ -225,7 +225,7 @@ impl HandlerContext {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ impl InstructionHandler for OpenRegionsHandler {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -183,9 +183,10 @@ impl UpgradeRegionsHandler {
|
||||
.await
|
||||
{
|
||||
Ok(responses) => {
|
||||
replies.extend(
|
||||
Self::convert_responses_to_replies(responses, &catchup_regions).into_iter(),
|
||||
);
|
||||
replies.extend(Self::convert_responses_to_replies(
|
||||
responses,
|
||||
&catchup_regions,
|
||||
));
|
||||
}
|
||||
Err(_) => {
|
||||
replies.extend(catchup_regions.iter().map(|region_id| UpgradeRegionReply {
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
|
||||
pub mod alive_keeper;
|
||||
pub mod config;
|
||||
pub mod datanode;
|
||||
|
||||
@@ -1667,7 +1667,7 @@ impl RegionAttribute {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use api::v1::SemanticType;
|
||||
use common_error::ext::ErrorExt;
|
||||
|
||||
@@ -426,7 +426,7 @@ fn decode_struct_with_context<'a>(
|
||||
|
||||
let (items, fields) = struct_value.into_parts();
|
||||
|
||||
for (field, field_value) in fields.fields().iter().zip(items.into_iter()) {
|
||||
for (field, field_value) in fields.fields().iter().zip(items) {
|
||||
let field_context = context.with_key(field.name());
|
||||
let json_value = decode_value_with_context(field_value, &field_context)?;
|
||||
json_object.insert(field.name().to_string(), json_value);
|
||||
@@ -561,7 +561,7 @@ fn decode_struct_with_settings<'a>(
|
||||
|
||||
// Process each field in the struct value
|
||||
let (struct_data, fields) = struct_value.into_parts();
|
||||
for (field, value) in fields.fields().iter().zip(struct_data.into_iter()) {
|
||||
for (field, value) in fields.fields().iter().zip(struct_data) {
|
||||
let field_context = context.with_key(field.name());
|
||||
|
||||
// Check if this field should be treated as unstructured
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
#![feature(box_patterns)]
|
||||
|
||||
pub mod arrow_array;
|
||||
pub mod data_type;
|
||||
pub mod duration;
|
||||
|
||||
@@ -773,7 +773,7 @@ mod tests {
|
||||
r#"Failed to merge JSON datatype: datatypes have conflict, this: {"hello":"<String>","list":["<Number>"],"object":{"a":"<Number>"}}, that: "<Number>""#,
|
||||
r#"Failed to merge JSON datatype: datatypes have conflict, this: {"hello":"<String>","list":["<Number>"],"object":{"a":"<Number>"}}, that: ["<Number>"]"#,
|
||||
];
|
||||
for (json, expect) in jsons.into_iter().zip(expects.into_iter()) {
|
||||
for (json, expect) in jsons.into_iter().zip(expects) {
|
||||
test(json, json_type, Err(expect))?;
|
||||
}
|
||||
|
||||
|
||||
@@ -922,7 +922,7 @@ impl TryFrom<Value> for serde_json::Value {
|
||||
let map = struct_type
|
||||
.fields()
|
||||
.iter()
|
||||
.zip(items.into_iter())
|
||||
.zip(items)
|
||||
.map(|(field, value)| {
|
||||
Ok((
|
||||
field.name().to_string(),
|
||||
@@ -2723,26 +2723,26 @@ pub(crate) mod tests {
|
||||
.unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
ScalarValue::UInt8(Some(u8::MIN + 1)),
|
||||
Value::UInt8(u8::MIN + 1)
|
||||
ScalarValue::UInt8(Some(1)),
|
||||
Value::UInt8(1)
|
||||
.try_to_scalar_value(&ConcreteDataType::uint8_datatype())
|
||||
.unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
ScalarValue::UInt16(Some(u16::MIN + 2)),
|
||||
Value::UInt16(u16::MIN + 2)
|
||||
ScalarValue::UInt16(Some(2)),
|
||||
Value::UInt16(2)
|
||||
.try_to_scalar_value(&ConcreteDataType::uint16_datatype())
|
||||
.unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
ScalarValue::UInt32(Some(u32::MIN + 3)),
|
||||
Value::UInt32(u32::MIN + 3)
|
||||
ScalarValue::UInt32(Some(3)),
|
||||
Value::UInt32(3)
|
||||
.try_to_scalar_value(&ConcreteDataType::uint32_datatype())
|
||||
.unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
ScalarValue::UInt64(Some(u64::MIN + 4)),
|
||||
Value::UInt64(u64::MIN + 4)
|
||||
ScalarValue::UInt64(Some(4)),
|
||||
Value::UInt64(4)
|
||||
.try_to_scalar_value(&ConcreteDataType::uint64_datatype())
|
||||
.unwrap()
|
||||
);
|
||||
|
||||
@@ -307,10 +307,11 @@ macro_rules! impl_extend_for_builder {
|
||||
}};
|
||||
}
|
||||
|
||||
pub(crate) use {
|
||||
impl_extend_for_builder, impl_get_for_vector, impl_get_ref_for_vector,
|
||||
impl_try_from_arrow_array_for_vector, impl_validity_for_vector,
|
||||
};
|
||||
pub(crate) use impl_extend_for_builder;
|
||||
pub(crate) use impl_get_for_vector;
|
||||
pub(crate) use impl_get_ref_for_vector;
|
||||
pub(crate) use impl_try_from_arrow_array_for_vector;
|
||||
pub(crate) use impl_validity_for_vector;
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
|
||||
@@ -458,7 +458,7 @@ impl BinaryVector {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use arrow::datatypes::DataType as ArrowDataType;
|
||||
use common_base::bytes::Bytes;
|
||||
|
||||
@@ -328,7 +328,7 @@ mod tests {
|
||||
),
|
||||
];
|
||||
let mut builder = JsonVectorBuilder::new(JsonNativeType::Null, 1);
|
||||
for (json, result) in jsons.into_iter().zip(results.into_iter()) {
|
||||
for (json, result) in jsons.into_iter().zip(results) {
|
||||
push(json, &mut builder, result);
|
||||
}
|
||||
let vector = builder.to_vector();
|
||||
@@ -448,7 +448,7 @@ mod tests {
|
||||
for (builder, (expect_type, expect_vector)) in builder
|
||||
.builders
|
||||
.iter()
|
||||
.zip(expect_types.into_iter().zip(expect_vectors.into_iter()))
|
||||
.zip(expect_types.into_iter().zip(expect_vectors))
|
||||
{
|
||||
assert_eq!(builder.json_type.name(), expect_type);
|
||||
let vector = builder.inner.to_vector_cloned();
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
|
||||
pub mod config;
|
||||
pub mod engine;
|
||||
pub mod error;
|
||||
|
||||
@@ -105,7 +105,7 @@ impl FileRegion {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use store_api::region_request::PathType;
|
||||
|
||||
|
||||
@@ -1060,7 +1060,7 @@ impl StreamingEngine {
|
||||
|
||||
let fetch_order: Vec<FetchFromRow> = table_col_names
|
||||
.iter()
|
||||
.zip(default_vals.into_iter())
|
||||
.zip(default_vals)
|
||||
.map(|(col_name, col_default_val)| {
|
||||
name_to_col
|
||||
.get(col_name)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
//! It also contains definition of expression, adapter and plan, and internal state management.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![warn(clippy::missing_docs_in_private_items)]
|
||||
#![warn(clippy::too_many_lines)]
|
||||
|
||||
// TODO(discord9): enable this lint to handle out of bound access
|
||||
|
||||
@@ -213,7 +213,7 @@ impl KeyExpiryManager {
|
||||
let mut before = self.event_ts_to_key.split_off(&expire_time);
|
||||
std::mem::swap(&mut before, &mut self.event_ts_to_key);
|
||||
|
||||
Some(before.into_iter().flat_map(|(_ts, keys)| keys.into_iter()))
|
||||
Some(before.into_values().flat_map(|keys| keys.into_iter()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,8 +409,8 @@ impl Arrangement {
|
||||
// iter over batches that only have updates of `timestamp>now` and find the first non empty batch, then get the minimum timestamp in that batch
|
||||
for (_ts, batch) in self.spine.range((Bound::Excluded(now), Bound::Unbounded)) {
|
||||
let min_ts = batch
|
||||
.iter()
|
||||
.flat_map(|(_k, v)| v.iter().map(|(_, ts, _)| *ts).min())
|
||||
.values()
|
||||
.flat_map(|v| v.iter().map(|(_, ts, _)| *ts).min())
|
||||
.min();
|
||||
|
||||
if min_ts.is_some() {
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
|
||||
pub mod error;
|
||||
pub mod events;
|
||||
pub mod frontend;
|
||||
|
||||
@@ -173,7 +173,7 @@ impl<R: RangeReader> InvertedIndexFooterReader<R> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use prost::Message;
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(iter_partition_in_place)]
|
||||
#![feature(assert_matches)]
|
||||
|
||||
pub mod bitmap;
|
||||
pub mod bloom_filter;
|
||||
|
||||
@@ -199,57 +199,53 @@ impl TimeFilter {
|
||||
let mut start_dt = None;
|
||||
let mut end_dt = None;
|
||||
|
||||
if self.start.is_some() && self.end.is_none() && self.span.is_none() {
|
||||
// Only 'start' is provided
|
||||
let s = self.start.as_ref().unwrap();
|
||||
let (start, end_opt) = Self::parse_datetime(s)?;
|
||||
if end_opt.is_none() {
|
||||
match (&self.start, &self.end, &self.span) {
|
||||
(Some(start), None, None) => {
|
||||
let (start, end_opt) = Self::parse_datetime(start)?;
|
||||
if end_opt.is_none() {
|
||||
return Err(InvalidTimeFilterSnafu {
|
||||
filter: self.clone(),
|
||||
}
|
||||
.build());
|
||||
}
|
||||
start_dt = Some(start);
|
||||
end_dt = end_opt;
|
||||
}
|
||||
(Some(start), Some(end), _) => {
|
||||
// Both 'start' and 'end' are provided
|
||||
let (start, _) = Self::parse_datetime(start)?;
|
||||
let (end, _) = Self::parse_datetime(end)?;
|
||||
start_dt = Some(start);
|
||||
end_dt = Some(end);
|
||||
}
|
||||
(Some(start), None, Some(span)) => {
|
||||
let (start, _) = Self::parse_datetime(start)?;
|
||||
let span = Self::parse_span(span)?;
|
||||
let end = start + span;
|
||||
start_dt = Some(start);
|
||||
end_dt = Some(end);
|
||||
}
|
||||
(None, Some(end), Some(span)) => {
|
||||
let (end, _) = Self::parse_datetime(end)?;
|
||||
let span = Self::parse_span(span)?;
|
||||
let start = end - span;
|
||||
start_dt = Some(start);
|
||||
end_dt = Some(end);
|
||||
}
|
||||
(None, None, Some(span)) => {
|
||||
let span = Self::parse_span(span)?;
|
||||
let end = Utc::now();
|
||||
let start = end - span;
|
||||
start_dt = Some(start);
|
||||
end_dt = Some(end);
|
||||
}
|
||||
_ => {
|
||||
// Exception
|
||||
return Err(InvalidTimeFilterSnafu {
|
||||
filter: self.clone(),
|
||||
}
|
||||
.build());
|
||||
}
|
||||
start_dt = Some(start);
|
||||
end_dt = end_opt;
|
||||
} else if self.start.is_some() && self.end.is_some() {
|
||||
// Both 'start' and 'end' are provided
|
||||
let (start, _) = Self::parse_datetime(self.start.as_ref().unwrap())?;
|
||||
let (end, _) = Self::parse_datetime(self.end.as_ref().unwrap())?;
|
||||
start_dt = Some(start);
|
||||
end_dt = Some(end);
|
||||
} else if self.span.is_some() && (self.start.is_some() || self.end.is_some()) {
|
||||
// 'span' with 'start' or 'end'
|
||||
let span = Self::parse_span(self.span.as_ref().unwrap())?;
|
||||
if self.start.is_some() {
|
||||
let (start, _) = Self::parse_datetime(self.start.as_ref().unwrap())?;
|
||||
let end = start + span;
|
||||
start_dt = Some(start);
|
||||
end_dt = Some(end);
|
||||
} else {
|
||||
let (end, _) = Self::parse_datetime(self.end.as_ref().unwrap())?;
|
||||
let start = end - span;
|
||||
start_dt = Some(start);
|
||||
end_dt = Some(end);
|
||||
}
|
||||
} else if self.span.is_some() && self.start.is_none() && self.end.is_none() {
|
||||
// Only 'span' is provided
|
||||
let span = Self::parse_span(self.span.as_ref().unwrap())?;
|
||||
let end = Utc::now();
|
||||
let start = end - span;
|
||||
start_dt = Some(start);
|
||||
end_dt = Some(end);
|
||||
} else if self.start.is_some() && self.span.is_some() && self.end.is_some() {
|
||||
// All fields are provided; 'start' and 'end' take priority
|
||||
let (start, _) = Self::parse_datetime(self.start.as_ref().unwrap())?;
|
||||
let (end, _) = Self::parse_datetime(self.end.as_ref().unwrap())?;
|
||||
start_dt = Some(start);
|
||||
end_dt = Some(end);
|
||||
} else {
|
||||
// Exception
|
||||
return Err(InvalidTimeFilterSnafu {
|
||||
filter: self.clone(),
|
||||
}
|
||||
.build());
|
||||
}
|
||||
|
||||
// Validate that end is after start
|
||||
|
||||
@@ -61,11 +61,7 @@ impl RegionWalRange {
|
||||
|
||||
fn next_batch_size(&self) -> Option<u64> {
|
||||
if self.current_entry_id < self.end_entry_id {
|
||||
Some(
|
||||
self.end_entry_id
|
||||
.checked_sub(self.current_entry_id)
|
||||
.unwrap_or_default(),
|
||||
)
|
||||
Some(self.end_entry_id.saturating_sub(self.current_entry_id))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ fn check_termination(offset: i64, end_offset: i64) -> bool {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -306,7 +306,7 @@ pub(crate) fn maybe_emit_entry(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(io_error_more)]
|
||||
#![feature(assert_matches)]
|
||||
|
||||
pub mod error;
|
||||
pub mod kafka;
|
||||
pub mod metrics;
|
||||
|
||||
@@ -212,8 +212,8 @@ impl Inner {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if let Err(err) = leader_provider.ask_leader().await {
|
||||
return Err(err);
|
||||
} else {
|
||||
leader_provider.ask_leader().await?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,8 +208,8 @@ impl Inner {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if let Err(err) = leader_provider.ask_leader().await {
|
||||
return Err(err);
|
||||
} else {
|
||||
leader_provider.ask_leader().await?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ impl GcScheduler {
|
||||
}
|
||||
|
||||
// Sort candidates by score in descending order and take top N
|
||||
candidates.sort_by(|a, b| b.score.cmp(&a.score));
|
||||
candidates.sort_by_key(|a| std::cmp::Reverse(a.score));
|
||||
let top_candidates: Vec<GcCandidate> = candidates
|
||||
.into_iter()
|
||||
.take(self.config.regions_per_table_threshold)
|
||||
|
||||
@@ -346,7 +346,7 @@ impl GcScheduler {
|
||||
// Add to need_retry_regions since it failed
|
||||
combined_report
|
||||
.need_retry_regions
|
||||
.extend(fast_list_regions.clone().into_iter());
|
||||
.extend(fast_list_regions.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,7 +870,7 @@ impl HeartbeatHandlerGroupBuilderCustomizer for DefaultHeartbeatHandlerGroupBuil
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -972,7 +972,7 @@ mod tests {
|
||||
"RemapFlowPeerHandler",
|
||||
];
|
||||
assert_eq!(names.len(), handlers.len());
|
||||
for (handler, name) in handlers.iter().zip(names.into_iter()) {
|
||||
for (handler, name) in handlers.iter().zip(names) {
|
||||
assert_eq!(handler.name, name);
|
||||
}
|
||||
}
|
||||
@@ -1009,7 +1009,7 @@ mod tests {
|
||||
"RemapFlowPeerHandler",
|
||||
];
|
||||
assert_eq!(names.len(), handlers.len());
|
||||
for (handler, name) in handlers.iter().zip(names.into_iter()) {
|
||||
for (handler, name) in handlers.iter().zip(names) {
|
||||
assert_eq!(handler.name, name);
|
||||
}
|
||||
}
|
||||
@@ -1043,7 +1043,7 @@ mod tests {
|
||||
"RemapFlowPeerHandler",
|
||||
];
|
||||
assert_eq!(names.len(), handlers.len());
|
||||
for (handler, name) in handlers.iter().zip(names.into_iter()) {
|
||||
for (handler, name) in handlers.iter().zip(names) {
|
||||
assert_eq!(handler.name, name);
|
||||
}
|
||||
}
|
||||
@@ -1077,7 +1077,7 @@ mod tests {
|
||||
"RemapFlowPeerHandler",
|
||||
];
|
||||
assert_eq!(names.len(), handlers.len());
|
||||
for (handler, name) in handlers.iter().zip(names.into_iter()) {
|
||||
for (handler, name) in handlers.iter().zip(names) {
|
||||
assert_eq!(handler.name, name);
|
||||
}
|
||||
}
|
||||
@@ -1111,7 +1111,7 @@ mod tests {
|
||||
"RemapFlowPeerHandler",
|
||||
];
|
||||
assert_eq!(names.len(), handlers.len());
|
||||
for (handler, name) in handlers.iter().zip(names.into_iter()) {
|
||||
for (handler, name) in handlers.iter().zip(names) {
|
||||
assert_eq!(handler.name, name);
|
||||
}
|
||||
}
|
||||
@@ -1145,7 +1145,7 @@ mod tests {
|
||||
];
|
||||
|
||||
assert_eq!(names.len(), handlers.len());
|
||||
for (handler, name) in handlers.iter().zip(names.into_iter()) {
|
||||
for (handler, name) in handlers.iter().zip(names) {
|
||||
assert_eq!(handler.name, name);
|
||||
}
|
||||
}
|
||||
@@ -1179,7 +1179,7 @@ mod tests {
|
||||
];
|
||||
|
||||
assert_eq!(names.len(), handlers.len());
|
||||
for (handler, name) in handlers.iter().zip(names.into_iter()) {
|
||||
for (handler, name) in handlers.iter().zip(names) {
|
||||
assert_eq!(handler.name, name);
|
||||
}
|
||||
}
|
||||
@@ -1212,7 +1212,7 @@ mod tests {
|
||||
"RemapFlowPeerHandler",
|
||||
];
|
||||
assert_eq!(names.len(), handlers.len());
|
||||
for (handler, name) in handlers.iter().zip(names.into_iter()) {
|
||||
for (handler, name) in handlers.iter().zip(names) {
|
||||
assert_eq!(handler.name, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(assert_matches)]
|
||||
#![feature(hash_set_entry)]
|
||||
#![feature(duration_constructors)]
|
||||
#![feature(string_from_utf8_lossy_owned)]
|
||||
|
||||
pub mod bootstrap;
|
||||
pub mod cache_invalidator;
|
||||
|
||||
@@ -924,7 +924,7 @@ impl Procedure for RegionMigrationProcedure {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::sync::Arc;
|
||||
|
||||
use common_meta::distributed_time_constants::default_distributed_time_constants;
|
||||
|
||||
@@ -372,7 +372,7 @@ impl DowngradeLeaderRegion {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use common_meta::key::table_route::TableRouteValue;
|
||||
|
||||
@@ -93,7 +93,7 @@ impl PreFlushRegion {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use store_api::storage::RegionId;
|
||||
|
||||
|
||||
@@ -620,7 +620,7 @@ impl RegionMigrationManager {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use common_meta::key::table_route::LogicalTableRouteValue;
|
||||
use common_meta::key::test_utils::new_test_table_info;
|
||||
|
||||
@@ -187,7 +187,7 @@ impl RegionMigrationStart {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches;
|
||||
|
||||
use common_meta::key::test_utils::new_test_table_info;
|
||||
use common_meta::peer::Peer;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user