diff --git a/Cargo.lock b/Cargo.lock index c5c104f1406f0..cb1dc7d4574ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -149,8 +149,9 @@ dependencies = [ [[package]] name = "arrow2" -version = "0.12.0" -source = "git+https://github.com/datafuse-extras/arrow2?rev=4cdf6ff2#4cdf6ff2a90de01f501266b43955e04ad00dd816" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "467e88c67d518f9992bb1f6c8faa202eaf93b0ce244889d241c9c44d0df0ab46" dependencies = [ "ahash", "arrow-format", @@ -161,6 +162,7 @@ dependencies = [ "csv-core", "dyn-clone", "either", + "ethnum", "fallible-streaming-iterator", "foreign_vec", "futures", @@ -173,6 +175,7 @@ dependencies = [ "num-traits", "parquet2", "regex", + "regex-syntax", "simdutf8", "streaming-iterator", "strength_reduce", @@ -569,15 +572,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "bitpacking" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c7d2ac73c167c06af4a5f37e6e59d84148d57ccbe4480b76f0273eefea82d7" -dependencies = [ - "crunchy", -] - [[package]] name = "bitvec" version = "1.0.1" @@ -959,7 +953,7 @@ dependencies = [ "common-datavalues", "common-expression", "itertools", - "ordered-float 3.0.0 (git+https://github.com/andylokandy/rust-ordered-float.git?branch=as)", + "ordered-float 3.1.0", "serde", "serde_json", ] @@ -1159,7 +1153,7 @@ dependencies = [ "micromarshal", "num", "once_cell", - "ordered-float 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float 3.1.0", "paste", "pretty_assertions", "primitive-types", @@ -1205,7 +1199,7 @@ dependencies = [ "itertools", "match-template", "num-traits", - "ordered-float 3.0.0 (git+https://github.com/andylokandy/rust-ordered-float.git?branch=as)", + "ordered-float 3.1.0", "rust_decimal", "serde", ] @@ -1257,7 +1251,7 @@ dependencies = [ "num-format", "num-traits", "once_cell", - "ordered-float 3.0.0 (git+https://github.com/andylokandy/rust-ordered-float.git?branch=as)", + "ordered-float 3.1.0", "pretty_assertions", "pulldown-cmark", "rand 0.8.5", @@ -1297,7 +1291,7 @@ dependencies = [ "match-template", "num-traits", "once_cell", - "ordered-float 3.0.0 (git+https://github.com/andylokandy/rust-ordered-float.git?branch=as)", + "ordered-float 3.1.0", "rand 0.8.5", "regex", "serde", @@ -1345,7 +1339,7 @@ version = "0.1.0" dependencies = [ "ahash", "common-base", - "ordered-float 3.0.0 (git+https://github.com/andylokandy/rust-ordered-float.git?branch=as)", + "ordered-float 3.1.0", "primitive-types", "rand 0.8.5", ] @@ -4016,10 +4010,6 @@ name = "integer-encoding" version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" -dependencies = [ - "async-trait", - "futures-util", -] [[package]] name = "inventory" @@ -4090,9 +4080,12 @@ dependencies = [ [[package]] name = "json-deserializer" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47631885425c482fcf2dc4b182fc973c3c5b81a8f43a028055559bd24cccfa6e" +checksum = "6b1f56ccc5f3f71390847875d3b94eaff132415f4cd215c41d0a35b12fd21bf7" +dependencies = [ + "indexmap", +] [[package]] name = "jsonwebtoken" @@ -5206,17 +5199,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bcbab4bfea7a59c2c0fe47211a1ac4e3e96bea6eb446d704f310bc5c732ae2" -dependencies = [ - "num-traits", -] - -[[package]] -name = "ordered-float" -version = "3.0.0" -source = "git+https://github.com/andylokandy/rust-ordered-float.git?branch=as#0c44163922fea81810d0efaeeacbc1befc3fad3e" +checksum = "98ffdb14730ed2ef599c65810c15b000896e21e8776b512de0db0c3d7335cc2a" dependencies = [ "num-traits", "rand 0.8.5", @@ -5341,29 +5326,28 @@ dependencies = [ ] [[package]] -name = "parquet-format-async-temp" -version = "0.3.1" +name = "parquet-format-safe" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1a672c84c3e5b5eb6530286b2d22cc1ea8e1e3560e4c314218d6ab749c6db99" +checksum = "1131c54b167dd4e4799ce762e1ab01549ebb94d5bdd13e6ec1b467491c378e1f" dependencies = [ "async-trait", "futures", - "integer-encoding", ] [[package]] name = "parquet2" -version = "0.14.3" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa7afeef767fb16a37216cdf906268ae10db9825aa1ed8723b8493b1e99b0b" +checksum = "7752b1a7d61b278f36820ba05557a2a8bfcb17f3559254577ef447beda0c4975" dependencies = [ "async-stream", - "bitpacking", "brotli", "flate2", "futures", "lz4", - "parquet-format-async-temp", + "parquet-format-safe", + "seq-macro", "snap", "streaming-decompression", "zstd", @@ -6707,6 +6691,12 @@ dependencies = [ "uuid", ] +[[package]] +name = "seq-macro" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0772c5c30e1a0d91f6834f8e545c69281c099dfa9a3ac58d96a9fd629c8d4898" + [[package]] name = "serde" version = "1.0.144" diff --git a/docs/doc/100-faq/40-how-to-write-scalar-functions.md b/docs/doc/100-faq/40-how-to-write-scalar-functions.md index c9bf39e5edfba..dc50795642b09 100644 --- a/docs/doc/100-faq/40-how-to-write-scalar-functions.md +++ b/docs/doc/100-faq/40-how-to-write-scalar-functions.md @@ -155,7 +155,7 @@ It's really simple, `S: AsPrimitive` means we can accept a primitive value ```rust impl Function for SqrtFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 63fb9c515dd20..4d3bcec42f9cf 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2022-06-30" +channel = "nightly-2022-09-18" components = ["rustfmt", "clippy", "rust-src"] diff --git a/src/common/arrow/Cargo.toml b/src/common/arrow/Cargo.toml index 85ccb8f184f5b..abe9182165c9e 100644 --- a/src/common/arrow/Cargo.toml +++ b/src/common/arrow/Cargo.toml @@ -33,15 +33,13 @@ simd = ["arrow/simd"] [dependencies] # In alphabetical order # Workspace dependencies -# Github dependencies -arrow = { package = "arrow2", git = "https://github.com/datafuse-extras/arrow2", default-features = false, features = [ +# Crates.io dependencies +arrow = { package = "arrow2", version = "0.14.0", default-features = false, features = [ "io_parquet", "io_parquet_compression", -], rev = "4cdf6ff2" } - -# Crates.io dependencies +] } arrow-format = { version = "0.7.0", features = ["flight-data", "flight-service", "ipc"] } futures = "0.3.21" -parquet2 = { version = "0.14", default_features = false } +parquet2 = { version = "0.16.3", default_features = false } [dev-dependencies] diff --git a/src/common/arrow/src/parquet_read.rs b/src/common/arrow/src/parquet_read.rs index e6b222b00f708..207415e01e8ae 100644 --- a/src/common/arrow/src/parquet_read.rs +++ b/src/common/arrow/src/parquet_read.rs @@ -75,6 +75,7 @@ pub async fn read_columns_many_async<'a, R: AsyncRead + AsyncSeek + Send + Unpin field.to_owned(), row_group.num_rows() as usize, chunk_size, + None, )?); } Ok(arrays) diff --git a/src/common/base/src/lib.rs b/src/common/base/src/lib.rs index 6e2dac833e2fd..8075335c0b508 100644 --- a/src/common/base/src/lib.rs +++ b/src/common/base/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(backtrace)] #![feature(thread_local)] #![allow(incomplete_features)] diff --git a/src/common/building/src/lib.rs b/src/common/building/src/lib.rs index d3c44e556a6ac..55c509702dc37 100644 --- a/src/common/building/src/lib.rs +++ b/src/common/building/src/lib.rs @@ -92,7 +92,7 @@ pub fn add_env_credits_info() { } }; - let names: Vec = deps.iter().map(|x| (&x.name).to_string()).collect(); + let names: Vec = deps.iter().map(|x| (x.name).to_string()).collect(); let versions: Vec = deps.iter().map(|x| x.version.to_string()).collect(); let licenses: Vec = deps .iter() diff --git a/src/common/cache/src/disk_cache.rs b/src/common/cache/src/disk_cache.rs index 64c9e11fecc0d..3595c97cf000b 100644 --- a/src/common/cache/src/disk_cache.rs +++ b/src/common/cache/src/disk_cache.rs @@ -245,13 +245,13 @@ where key: K, with: F, ) -> Result<()> { - self.insert_by(key, None, |path| with(File::create(&path)?)) + self.insert_by(key, None, |path| with(File::create(path)?)) } /// Add a file with `bytes` as its contents to the cache at path `key`. pub fn insert_bytes>(&mut self, key: K, bytes: &[u8]) -> Result<()> { self.insert_by(key, Some(bytes.len() as u64), |path| { - let mut f = File::create(&path)?; + let mut f = File::create(path)?; f.write_all(bytes)?; Ok(()) }) diff --git a/src/common/exception/src/lib.rs b/src/common/exception/src/lib.rs index 5594c05bd3cb2..cf8f80fb7bb35 100644 --- a/src/common/exception/src/lib.rs +++ b/src/common/exception/src/lib.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(backtrace)] - pub mod exception; mod exception_code; mod exception_flight; diff --git a/src/common/hashtable/Cargo.toml b/src/common/hashtable/Cargo.toml index 837695179317e..8e66eeac5ad49 100644 --- a/src/common/hashtable/Cargo.toml +++ b/src/common/hashtable/Cargo.toml @@ -16,7 +16,7 @@ common-base = { path = "../base" } # Crates.io dependencies ahash = "0.7.6" -ordered-float = { git = "https://github.com/andylokandy/rust-ordered-float.git", branch = "as", features = ["serde"] } +ordered-float = { version = "3.1.0", features = ["serde"] } primitive-types = "0.11.1" [dev-dependencies] diff --git a/src/common/io/src/buffer/buffer_reader.rs b/src/common/io/src/buffer/buffer_reader.rs index bcbe846c9e44b..77b402e369873 100644 --- a/src/common/io/src/buffer/buffer_reader.rs +++ b/src/common/io/src/buffer/buffer_reader.rs @@ -15,10 +15,11 @@ use std::cmp; use std::fmt; use std::io; +use std::io::BorrowedBuf; +use std::io::BorrowedCursor; use std::io::ErrorKind; use std::io::IoSliceMut; use std::io::Read; -use std::io::ReadBuf; use std::io::Result; use std::mem::MaybeUninit; @@ -94,21 +95,21 @@ impl std::io::Read for BufferReader { Ok(nread) } - fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> io::Result<()> { + fn read_buf(&mut self, mut cursor: BorrowedCursor<'_>) -> io::Result<()> { // If we don't have any buffered data and we're doing a massive read // (larger than our internal buffer), bypass our internal buffer // entirely. - if self.pos == self.cap && buf.remaining() >= self.buf.len() { + if self.pos == self.cap && cursor.capacity() >= self.buf.len() { self.discard_buffer(); - return self.inner.read_buf(buf); + return self.inner.read_buf(cursor.reborrow()); } - let prev = buf.filled_len(); + let prev = cursor.written(); let mut rem = self.fill_buf()?; - rem.read_buf(buf)?; + rem.read_buf(cursor.reborrow())?; - self.consume(buf.filled_len() - prev); //slice impl of read_buf known to never unfill buf + self.consume(cursor.written() - prev); //slice impl of read_buf known to never unfill buf Ok(()) } @@ -178,18 +179,18 @@ impl BufferRead for BufferReader { fn fill_buf(&mut self) -> Result<&[u8]> { if self.pos >= self.cap { debug_assert!(self.pos == self.cap); - let mut readbuf = ReadBuf::uninit(&mut self.buf); + let mut buf = BorrowedBuf::from(&mut (*self.buf)); // SAFETY: `self.init` is either 0 or set to `readbuf.initialized_len()` // from the last time this function was called unsafe { - readbuf.assume_init(self.init); + buf.set_init(self.init); } - self.inner.read_buf(&mut readbuf)?; + self.inner.read_buf(buf.unfilled())?; - self.cap = readbuf.filled_len(); - self.init = readbuf.initialized_len(); + self.cap = buf.len(); + self.init = buf.init_len(); self.pos = 0; } diff --git a/src/common/tracing/src/lib.rs b/src/common/tracing/src/lib.rs index 062190b81c261..40ab39deec2fa 100644 --- a/src/common/tracing/src/lib.rs +++ b/src/common/tracing/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(backtrace)] #![deny(unused_crate_dependencies)] #[macro_use] diff --git a/src/meta/api/src/share_api_impl.rs b/src/meta/api/src/share_api_impl.rs index 5e2f23e0fbb0b..78092a8fdae50 100644 --- a/src/meta/api/src/share_api_impl.rs +++ b/src/meta/api/src/share_api_impl.rs @@ -800,13 +800,12 @@ impl ShareApi for KV { let mut objects = vec![]; for entry in entries { let object = get_object_name_from_id(self, &database_name, entry.object).await?; - match object { - Some(object) => objects.push(ShareGrantReplyObject { + if let Some(object) = object { + objects.push(ShareGrantReplyObject { object, privileges: entry.privileges, grant_on: entry.grant_on, - }), - None => {} + }) } } @@ -925,15 +924,12 @@ impl ShareApi for KV { }; let mut privileges = vec![]; for (entry, share_name) in entries { - match entry { - Some(entry) => { - privileges.push(ObjectGrantPrivilege { - share_name, - privileges: entry.privileges, - grant_on: entry.grant_on, - }); - } - None => {} + if let Some(entry) = entry { + privileges.push(ObjectGrantPrivilege { + share_name, + privileges: entry.privileges, + grant_on: entry.grant_on, + }); } } Ok(GetObjectGrantPrivilegesReply { privileges }) diff --git a/src/meta/api/src/util.rs b/src/meta/api/src/util.rs index 13e8cc0211d30..52c2e4db12b32 100644 --- a/src/meta/api/src/util.rs +++ b/src/meta/api/src/util.rs @@ -518,7 +518,7 @@ where condition.push(txn_cond_seq(&id_to_name, Eq, name_ident_seq)); if_then.push(txn_op_del(&id_to_name)); - return Ok((true, db_meta.from_share.clone())); + return Ok((true, db_meta.from_share)); } } Ok((false, None)) diff --git a/src/meta/protos/build.rs b/src/meta/protos/build.rs index fd0b683f4a256..62f3b51db1a78 100644 --- a/src/meta/protos/build.rs +++ b/src/meta/protos/build.rs @@ -36,7 +36,7 @@ fn build_proto() -> Result<()> { } let mut config = prost_build::Config::new(); - config.btree_map(&["."]); + config.btree_map(["."]); config.protoc_arg("--experimental_allow_proto3_optional"); tonic_build::configure() .type_attribute("IntervalKind", "#[derive(num_derive::FromPrimitive)]") diff --git a/src/meta/service/src/lib.rs b/src/meta/service/src/lib.rs index acd837d743573..f269e60376833 100644 --- a/src/meta/service/src/lib.rs +++ b/src/meta/service/src/lib.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(backtrace)] - pub mod api; pub mod configs; pub mod export; diff --git a/src/meta/service/src/metrics/meta_metrics.rs b/src/meta/service/src/metrics/meta_metrics.rs index a370d64ac6dbf..720bf6c3f6d5b 100644 --- a/src/meta/service/src/metrics/meta_metrics.rs +++ b/src/meta/service/src/metrics/meta_metrics.rs @@ -564,11 +564,11 @@ pub fn set_meta_metrics_current_leader(current_leader: NodeId) { } pub fn set_meta_metrics_is_leader(is_leader: bool) { - IS_LEADER.set(if is_leader { 1 } else { 0 }); + IS_LEADER.set(i64::from(is_leader)); } pub fn set_meta_metrics_node_is_health(is_health: bool) { - NODE_IS_HEALTH.set(if is_health { 1 } else { 0 }); + NODE_IS_HEALTH.set(i64::from(is_health)); } pub fn incr_meta_metrics_leader_change() { diff --git a/src/meta/service/src/store/store_bare.rs b/src/meta/service/src/store/store_bare.rs index 245b044c08bf3..b720178b93eda 100644 --- a/src/meta/service/src/store/store_bare.rs +++ b/src/meta/service/src/store/store_bare.rs @@ -408,7 +408,7 @@ impl RaftStorage for RaftStoreBare { let sm = self.state_machine.write().await; for entry in entries { let r = match sm - .apply(*entry) + .apply(entry) .await .map_to_sto_err(ErrorSubject::Apply(entry.log_id), ErrorVerb::Write) { diff --git a/src/meta/service/tests/it/meta_node/meta_node_request_forwarding.rs b/src/meta/service/tests/it/meta_node/meta_node_request_forwarding.rs index 7d994af105108..73e4804f82c75 100644 --- a/src/meta/service/tests/it/meta_node/meta_node_request_forwarding.rs +++ b/src/meta/service/tests/it/meta_node/meta_node_request_forwarding.rs @@ -48,7 +48,7 @@ async fn test_meta_node_forward_to_leader() -> anyhow::Result<()> { .write(LogEntry { txid: None, time_ms: None, - cmd: Cmd::UpsertKV(UpsertKV::update(&key, key.as_bytes())), + cmd: Cmd::UpsertKV(UpsertKV::update(key, key.as_bytes())), }) .await; diff --git a/src/meta/types/src/errors/meta_storage_errors.rs b/src/meta/types/src/errors/meta_storage_errors.rs index 06f0213656ae4..90db528b4ff64 100644 --- a/src/meta/types/src/errors/meta_storage_errors.rs +++ b/src/meta/types/src/errors/meta_storage_errors.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::error::Error; +use std::any; +use std::backtrace::Backtrace; use anyerror::AnyError; use common_exception::ErrorCode; @@ -46,7 +47,7 @@ pub type MetaStorageResult = Result; impl From for ErrorCode { fn from(e: MetaStorageError) -> Self { - ErrorCode::MetaStorageError(e.to_string()).set_backtrace(e.backtrace()) + ErrorCode::MetaStorageError(e.to_string()).set_backtrace(any::request_ref::(&e)) } } diff --git a/src/meta/types/src/lib.rs b/src/meta/types/src/lib.rs index 0d977859d4d8b..f356fa2f07bd3 100644 --- a/src/meta/types/src/lib.rs +++ b/src/meta/types/src/lib.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(backtrace)] +#![feature(provide_any)] //! This crate defines data types used in meta data storage service. diff --git a/src/query/ast/src/ast/format/ast_format.rs b/src/query/ast/src/ast/format/ast_format.rs index 9cd8949207af4..114d4b53f03ea 100644 --- a/src/query/ast/src/ast/format/ast_format.rs +++ b/src/query/ast/src/ast/format/ast_format.rs @@ -1353,7 +1353,7 @@ impl<'ast> Visitor<'ast> for AstFormatVisitor { fn visit_create_view(&mut self, stmt: &'ast CreateViewStmt<'ast>) { self.visit_table_ref(&stmt.catalog, &stmt.database, &stmt.view); let view_child = self.children.pop().unwrap(); - self.visit_query(&*stmt.query); + self.visit_query(&stmt.query); let query_child = self.children.pop().unwrap(); let name = "CreateView".to_string(); @@ -1365,7 +1365,7 @@ impl<'ast> Visitor<'ast> for AstFormatVisitor { fn visit_alter_view(&mut self, stmt: &'ast AlterViewStmt<'ast>) { self.visit_table_ref(&stmt.catalog, &stmt.database, &stmt.view); let view_child = self.children.pop().unwrap(); - self.visit_query(&*stmt.query); + self.visit_query(&stmt.query); let query_child = self.children.pop().unwrap(); let name = "AlterView".to_string(); @@ -1967,9 +1967,9 @@ impl<'ast> Visitor<'ast> for AstFormatVisitor { } fn visit_set_operation(&mut self, set_operation: &'ast SetOperation<'ast>) { - self.visit_set_expr(&*set_operation.left); + self.visit_set_expr(&set_operation.left); let left_child = self.children.pop().unwrap(); - self.visit_set_expr(&*set_operation.right); + self.visit_set_expr(&set_operation.right); let right_child = self.children.pop().unwrap(); let name = format!("SetOperation {}", match set_operation.op { @@ -2189,9 +2189,9 @@ impl<'ast> Visitor<'ast> for AstFormatVisitor { fn visit_join(&mut self, join: &'ast Join<'ast>) { let mut children = Vec::new(); - self.visit_table_reference(&*join.left); + self.visit_table_reference(&join.left); children.push(self.children.pop().unwrap()); - self.visit_table_reference(&*join.right); + self.visit_table_reference(&join.right); children.push(self.children.pop().unwrap()); match &join.condition { diff --git a/src/query/ast/src/ast/statements/statement.rs b/src/query/ast/src/ast/statements/statement.rs index a825f32409deb..507c20bd3d177 100644 --- a/src/query/ast/src/ast/statements/statement.rs +++ b/src/query/ast/src/ast/statements/statement.rs @@ -27,6 +27,7 @@ use crate::ast::Query; use crate::ast::TableReference; // SQL statement +#[allow(clippy::large_enum_variant)] #[derive(Debug, Clone, PartialEq)] pub enum Statement<'a> { Query(Box>), diff --git a/src/query/ast/src/ast/statements/table.rs b/src/query/ast/src/ast/statements/table.rs index 6e6728363e378..34fae538c4210 100644 --- a/src/query/ast/src/ast/statements/table.rs +++ b/src/query/ast/src/ast/statements/table.rs @@ -151,6 +151,7 @@ impl Display for CreateTableStmt<'_> { } } +#[allow(clippy::large_enum_variant)] #[derive(Debug, Clone, PartialEq)] pub enum CreateTableSource<'a> { Columns(Vec>), diff --git a/src/query/ast/src/parser/statement.rs b/src/query/ast/src/parser/statement.rs index 32a5aec9b848c..9d84c5e2b96a5 100644 --- a/src/query/ast/src/parser/statement.rs +++ b/src/query/ast/src/parser/statement.rs @@ -1017,6 +1017,7 @@ pub fn insert_source(i: Input) -> IResult { )(i) } +#[allow(clippy::needless_lifetimes)] pub fn rest_str<'a>(i: Input<'a>) -> IResult<&'a str> { // It's safe to unwrap because input must contain EOI. let first_token = i.0.first().unwrap(); diff --git a/src/query/ast/src/util.rs b/src/query/ast/src/util.rs index d6c885b092fa0..93b8fb2ce4557 100644 --- a/src/query/ast/src/util.rs +++ b/src/query/ast/src/util.rs @@ -135,6 +135,7 @@ fn non_reserved_keyword( /// Parse one two two idents seperated by a period, fulfilling from the right. /// /// Example: `table.column` +#[allow(clippy::needless_lifetimes)] pub fn peroid_separated_idents_1_to_2<'a>( i: Input<'a>, ) -> IResult<'a, (Option, Identifier)> { @@ -152,6 +153,7 @@ pub fn peroid_separated_idents_1_to_2<'a>( /// Parse one two three idents seperated by a period, fulfilling from the right. /// /// Example: `db.table.column` +#[allow(clippy::needless_lifetimes)] pub fn peroid_separated_idents_1_to_3<'a>( i: Input<'a>, ) -> IResult<'a, (Option, Option, Identifier)> { diff --git a/src/query/codegen/Cargo.toml b/src/query/codegen/Cargo.toml index 02e31b927203c..ac7473635555b 100644 --- a/src/query/codegen/Cargo.toml +++ b/src/query/codegen/Cargo.toml @@ -21,6 +21,6 @@ common-expression = { path = "../expression" } # TODO(andylokandy): Use the version from crates.io once # https://github.com/reem/rust-ordered-float/pull/110 is released. itertools = "0.10" -ordered-float = { git = "https://github.com/andylokandy/rust-ordered-float.git", branch = "as", features = ["serde"] } +ordered-float = { version = "3.1.0", features = ["serde"] } serde = { version = "1.0.137", features = ["derive"] } serde_json = "1.0.81" diff --git a/src/query/codegen/src/writes/register.rs b/src/query/codegen/src/writes/register.rs index 0ce5492118241..5cab17924c525 100644 --- a/src/query/codegen/src/writes/register.rs +++ b/src/query/codegen/src/writes/register.rs @@ -641,7 +641,7 @@ pub fn codegen_register() { } fn format_and_save(path: &str, src: &str) { - let mut file = File::create(&path).expect("open"); + let mut file = File::create(path).expect("open"); // Write the head. let codegen_src_path = file!(); diff --git a/src/query/datablocks/src/lib.rs b/src/query/datablocks/src/lib.rs index 7c9bfcc23dcb2..67c7b4393426d 100644 --- a/src/query/datablocks/src/lib.rs +++ b/src/query/datablocks/src/lib.rs @@ -14,7 +14,6 @@ #![feature(hash_raw_entry)] #![feature(trusted_len)] -#![feature(generic_associated_types)] mod data_block; mod data_block_debug; diff --git a/src/query/datavalues/src/columns/nullable/mutable.rs b/src/query/datavalues/src/columns/nullable/mutable.rs index 1a5741ca00019..ae4733e79270c 100644 --- a/src/query/datavalues/src/columns/nullable/mutable.rs +++ b/src/query/datavalues/src/columns/nullable/mutable.rs @@ -74,7 +74,7 @@ impl MutableColumn for MutableNullableColumn { }) .and_then(|v| { let value = self.inner.pop_data_value(); - v.then_some(value).unwrap_or(Ok(DataValue::Null)) + if v { value } else { Ok(DataValue::Null) } }) } } diff --git a/src/query/datavalues/src/lib.rs b/src/query/datavalues/src/lib.rs index 48e3f8837aedb..e9cb51ec2a7a6 100644 --- a/src/query/datavalues/src/lib.rs +++ b/src/query/datavalues/src/lib.rs @@ -15,7 +15,6 @@ //! *Credits to the work of https://github.com/pola-rs/polars, which served as //! insipration for the crate* -#![feature(generic_associated_types)] #![feature(trusted_len)] #[macro_use] diff --git a/src/query/datavalues/src/types/deserializations/nullable.rs b/src/query/datavalues/src/types/deserializations/nullable.rs index bb2971f2df5df..dccccfc2beeda 100644 --- a/src/query/datavalues/src/types/deserializations/nullable.rs +++ b/src/query/datavalues/src/types/deserializations/nullable.rs @@ -198,7 +198,7 @@ impl TypeDeserializer for NullableDeserializer { }) .and_then(|v| { let inner_value = self.inner.pop_data_value(); - v.then(|| inner_value).unwrap_or(Ok(DataValue::Null)) + if v { inner_value } else { Ok(DataValue::Null) } }) } diff --git a/src/query/datavalues/src/types/eq.rs b/src/query/datavalues/src/types/eq.rs index e887f51825499..08f716e37e585 100644 --- a/src/query/datavalues/src/types/eq.rs +++ b/src/query/datavalues/src/types/eq.rs @@ -31,13 +31,13 @@ impl PartialEq for DataTypeImpl { impl PartialEq for Arc { fn eq(&self, that: &DataTypeImpl) -> bool { - equal(&**self, that) + equal(self, that) } } impl PartialEq for Box { fn eq(&self, that: &DataTypeImpl) -> bool { - equal(&**self, that) + equal(self, that) } } diff --git a/src/query/datavalues/tests/it/columns/string.rs b/src/query/datavalues/tests/it/columns/string.rs index 81caa4295db49..3845adfd388d9 100644 --- a/src/query/datavalues/tests/it/columns/string.rs +++ b/src/query/datavalues/tests/it/columns/string.rs @@ -25,7 +25,7 @@ fn test_empty_string_column() { #[test] fn test_new_from_slice() { - let data_column: StringColumn = NewColumn::new_from_slice(&["你好", "hello"]); + let data_column: StringColumn = NewColumn::new_from_slice(["你好", "hello"]); let mut iter = data_column.iter(); assert_eq!("你好".as_bytes().to_vec(), iter.next().unwrap().to_vec()); assert_eq!("hello".as_bytes().to_vec(), iter.next().unwrap().to_vec()); diff --git a/src/query/expression/Cargo.toml b/src/query/expression/Cargo.toml index 625e2bbcbd472..921eecc9028bc 100755 --- a/src/query/expression/Cargo.toml +++ b/src/query/expression/Cargo.toml @@ -27,7 +27,7 @@ hex = "0.4.3" itertools = "0.10" match-template = "0.0.1" num-traits = "0.2.15" -ordered-float = { git = "https://github.com/andylokandy/rust-ordered-float.git", branch = "as", features = ["serde"] } +ordered-float = { version = "3.1.0", features = ["serde"] } rust_decimal = "1.26" serde = "1.0" diff --git a/src/query/expression/src/display.rs b/src/query/expression/src/display.rs index ff62dd79e12b0..059025a5ce958 100755 --- a/src/query/expression/src/display.rs +++ b/src/query/expression/src/display.rs @@ -153,7 +153,7 @@ impl<'a> Display for ScalarRef<'a> { ) } ScalarRef::Variant(s) => { - let value = common_jsonb::from_slice(*s).map_err(|_| std::fmt::Error)?; + let value = common_jsonb::from_slice(s).map_err(|_| std::fmt::Error)?; write!(f, "{value}") } } diff --git a/src/query/expression/src/evaluator.rs b/src/query/expression/src/evaluator.rs index fa178b1072890..fddea222fc37d 100644 --- a/src/query/expression/src/evaluator.rs +++ b/src/query/expression/src/evaluator.rs @@ -209,6 +209,7 @@ impl<'a> Evaluator<'a> { } } + #[allow(clippy::only_used_in_recursion)] pub fn run_cast_column( &self, span: Span, @@ -313,6 +314,7 @@ impl<'a> Evaluator<'a> { .unwrap_or(Scalar::Null) } + #[allow(clippy::only_used_in_recursion)] pub fn run_try_cast_column(&self, span: Span, column: Column, dest_type: &DataType) -> Column { let inner_type: &DataType = dest_type.as_nullable().unwrap(); match (column, inner_type) { @@ -565,6 +567,7 @@ impl<'a> ConstantFolder<'a> { } } + #[allow(clippy::only_used_in_recursion)] pub fn calculate_cast( &self, span: Span, @@ -631,6 +634,7 @@ impl<'a> ConstantFolder<'a> { } } + #[allow(clippy::only_used_in_recursion)] pub fn calculate_try_cast(&self, span: Span, domain: &Domain, dest_type: &DataType) -> Domain { let inner_type: &DataType = dest_type.as_nullable().unwrap(); match (domain, inner_type) { diff --git a/src/query/expression/src/lib.rs b/src/query/expression/src/lib.rs index 77e2ed216be3a..29d736e32d8bc 100755 --- a/src/query/expression/src/lib.rs +++ b/src/query/expression/src/lib.rs @@ -13,7 +13,6 @@ // limitations under the License. #![feature(const_try)] -#![feature(generic_associated_types)] #![feature(iterator_try_reduce)] #![feature(const_fmt_arguments_new)] #![feature(box_patterns)] diff --git a/src/query/expression/tests/it/expression.rs b/src/query/expression/tests/it/expression.rs index a2e4339957d69..d855f12459add 100644 --- a/src/query/expression/tests/it/expression.rs +++ b/src/query/expression/tests/it/expression.rs @@ -945,7 +945,7 @@ fn run_ast(file: &mut impl Write, text: &str, columns: &[(&str, DataType, Column let mut table = Table::new(); table.load_preset("||--+-++| ++++++"); - table.set_header(&["Column", "Data"]); + table.set_header(["Column", "Data"]); for (name, _, col) in columns.iter() { table.add_row(&[name.to_string(), format!("{col:?}")]); diff --git a/src/query/formats/src/format_parquet.rs b/src/query/formats/src/format_parquet.rs index 8777234dfbd92..d476dd7806ea9 100644 --- a/src/query/formats/src/format_parquet.rs +++ b/src/query/formats/src/format_parquet.rs @@ -83,7 +83,7 @@ impl ParquetInputFormat { row_group: &RowGroupMetaData, cursor: &mut Cursor<&[u8]>, ) -> Result>> { - match read_columns_many(cursor, row_group, fields.to_vec(), None) { + match read_columns_many(cursor, row_group, fields.to_vec(), None, None, None) { Ok(array) => Ok(array), Err(e) => Err(ErrorCode::ParquetError(e.to_string())), } diff --git a/src/query/functions-v2/Cargo.toml b/src/query/functions-v2/Cargo.toml index c2f3b358d9bad..69643abd6c0be 100644 --- a/src/query/functions-v2/Cargo.toml +++ b/src/query/functions-v2/Cargo.toml @@ -31,7 +31,7 @@ num-traits = "0.2.15" # https://github.com/reem/rust-ordered-float/pull/110 is released. common-jsonb = { path = "../../common/jsonb" } once_cell = "1.12.0" -ordered-float = { git = "https://github.com/andylokandy/rust-ordered-float.git", branch = "as", features = [ +ordered-float = { version = "3.1.0", features = [ "serde", "rand", ] } diff --git a/src/query/functions-v2/src/aggregates/adaptors/aggregate_null_unary_adaptor.rs b/src/query/functions-v2/src/aggregates/adaptors/aggregate_null_unary_adaptor.rs index e9a8e2e55d83f..b14db3b4dc5f0 100644 --- a/src/query/functions-v2/src/aggregates/adaptors/aggregate_null_unary_adaptor.rs +++ b/src/query/functions-v2/src/aggregates/adaptors/aggregate_null_unary_adaptor.rs @@ -98,7 +98,7 @@ impl AggregateFunction for AggregateNullUnaryAdapto #[inline] fn state_layout(&self) -> Layout { let layout = self.nested.state_layout(); - let add = if NULLABLE_RESULT { 1 } else { 0 }; + let add = usize::from(NULLABLE_RESULT); Layout::from_size_align(layout.size() + add, layout.align()).unwrap() } diff --git a/src/query/functions-v2/src/aggregates/adaptors/aggregate_null_variadic_adaptor.rs b/src/query/functions-v2/src/aggregates/adaptors/aggregate_null_variadic_adaptor.rs index 4f76257c42ebf..f30d34c3aedea 100644 --- a/src/query/functions-v2/src/aggregates/adaptors/aggregate_null_variadic_adaptor.rs +++ b/src/query/functions-v2/src/aggregates/adaptors/aggregate_null_variadic_adaptor.rs @@ -99,7 +99,7 @@ impl AggregateFunction #[inline] fn state_layout(&self) -> Layout { let layout = self.nested.state_layout(); - let add = if NULLABLE_RESULT { 1 } else { 0 }; + let add = usize::from(NULLABLE_RESULT); Layout::from_size_align(layout.size() + add, layout.align()).unwrap() } diff --git a/src/query/functions-v2/src/scalars/string_multi_args.rs b/src/query/functions-v2/src/scalars/string_multi_args.rs index 3ee6c60661110..f58de9ecb50af 100644 --- a/src/query/functions-v2/src/scalars/string_multi_args.rs +++ b/src/query/functions-v2/src/scalars/string_multi_args.rs @@ -992,6 +992,7 @@ mod regexp { fn_name, c, )), }; + #[allow(clippy::question_mark)] if let Err(e) = r { return Err(e); } diff --git a/src/query/functions-v2/tests/it/aggregates/mod.rs b/src/query/functions-v2/tests/it/aggregates/mod.rs index 327ce3f800d33..4a2ab875a8dd0 100644 --- a/src/query/functions-v2/tests/it/aggregates/mod.rs +++ b/src/query/functions-v2/tests/it/aggregates/mod.rs @@ -101,7 +101,7 @@ pub fn run_agg_ast(file: &mut impl Write, text: &str, columns: &[(&str, DataType { let mut table = Table::new(); table.load_preset("||--+-++| ++++++"); - table.set_header(&["Column", "Data"]); + table.set_header(["Column", "Data"]); let ids = match column_ids.is_empty() { true => { diff --git a/src/query/functions-v2/tests/it/scalars/mod.rs b/src/query/functions-v2/tests/it/scalars/mod.rs index e46ded8fdf69c..bb043e6db79fe 100644 --- a/src/query/functions-v2/tests/it/scalars/mod.rs +++ b/src/query/functions-v2/tests/it/scalars/mod.rs @@ -150,7 +150,7 @@ pub fn run_ast(file: &mut impl Write, text: &str, columns: &[(&str, DataType, Co let mut table = Table::new(); table.load_preset("||--+-++| ++++++"); - table.set_header(&["Column", "Data"]); + table.set_header(["Column", "Data"]); for (name, _, col) in columns.iter() { table.add_row(&[name.to_string(), format!("{col:?}")]); diff --git a/src/query/functions/Cargo.toml b/src/query/functions/Cargo.toml index e41f62f9bfec6..da152b272fce9 100644 --- a/src/query/functions/Cargo.toml +++ b/src/query/functions/Cargo.toml @@ -38,7 +38,7 @@ num = "0.4.0" num-format = "0.4.0" num-traits = "0.2.15" once_cell = "1.12.0" -ordered-float = { git = "https://github.com/andylokandy/rust-ordered-float.git", branch = "as", features = ["serde"] } +ordered-float = { version = "3.1.0", features = ["serde"] } pulldown-cmark = { version = "0.9.1", default-features = false } rand = { version = "0.8.5", features = ["small_rng"] } regex = "1.5.6" diff --git a/src/query/functions/src/aggregates/adaptors/aggregate_null_unary_adaptor.rs b/src/query/functions/src/aggregates/adaptors/aggregate_null_unary_adaptor.rs index d2d2a37e794cc..853f8c1aecc5a 100644 --- a/src/query/functions/src/aggregates/adaptors/aggregate_null_unary_adaptor.rs +++ b/src/query/functions/src/aggregates/adaptors/aggregate_null_unary_adaptor.rs @@ -94,7 +94,7 @@ impl AggregateFunction for AggregateNullUnaryAdapto #[inline] fn state_layout(&self) -> Layout { let layout = self.nested.state_layout(); - let add = if NULLABLE_RESULT { 1 } else { 0 }; + let add = usize::from(NULLABLE_RESULT); Layout::from_size_align(layout.size() + add, layout.align()).unwrap() } diff --git a/src/query/functions/src/aggregates/adaptors/aggregate_null_variadic_adaptor.rs b/src/query/functions/src/aggregates/adaptors/aggregate_null_variadic_adaptor.rs index c3fb718f32deb..61fe02b67cc72 100644 --- a/src/query/functions/src/aggregates/adaptors/aggregate_null_variadic_adaptor.rs +++ b/src/query/functions/src/aggregates/adaptors/aggregate_null_variadic_adaptor.rs @@ -95,7 +95,7 @@ impl AggregateFunction #[inline] fn state_layout(&self) -> Layout { let layout = self.nested.state_layout(); - let add = if NULLABLE_RESULT { 1 } else { 0 }; + let add = usize::from(NULLABLE_RESULT); Layout::from_size_align(layout.size() + add, layout.align()).unwrap() } diff --git a/src/query/functions/src/scalars/comparisons/comparison.rs b/src/query/functions/src/scalars/comparisons/comparison.rs index a21c1fe1c838d..f7dcebf49cb96 100644 --- a/src/query/functions/src/scalars/comparisons/comparison.rs +++ b/src/query/functions/src/scalars/comparisons/comparison.rs @@ -218,7 +218,7 @@ impl StringSearchCreator { if arg.data_type_id().is_variant() { continue; } - assert_string(*arg)?; + assert_string(arg)?; } let f: StringSearchFn = match NEGATED { diff --git a/src/query/functions/src/scalars/hashes/city64_with_seed.rs b/src/query/functions/src/scalars/hashes/city64_with_seed.rs index 584c41b110576..b05e15d28c9b7 100644 --- a/src/query/functions/src/scalars/hashes/city64_with_seed.rs +++ b/src/query/functions/src/scalars/hashes/city64_with_seed.rs @@ -105,7 +105,7 @@ impl City64WithSeedFunction { impl Function for City64WithSeedFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/hashes/sha2hash.rs b/src/query/functions/src/scalars/hashes/sha2hash.rs index ea8524f878f5a..06219188429ed 100644 --- a/src/query/functions/src/scalars/hashes/sha2hash.rs +++ b/src/query/functions/src/scalars/hashes/sha2hash.rs @@ -62,7 +62,7 @@ impl Sha2HashFunction { impl Function for Sha2HashFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/logics/logic.rs b/src/query/functions/src/scalars/logics/logic.rs index 11edd370000dd..d8d74cf4ac001 100644 --- a/src/query/functions/src/scalars/logics/logic.rs +++ b/src/query/functions/src/scalars/logics/logic.rs @@ -67,17 +67,10 @@ impl LogicFunctionImpl where F: LogicExpression + Clone + 'static { pub fn try_create(op: LogicOperator, args: &[&DataTypeImpl]) -> Result> { - let nullable = match op { - LogicOperator::And | LogicOperator::Or - if args[0].is_nullable() - || args[1].is_nullable() - || args[0].is_null() - || args[1].is_null() => - { - true - } - _ => false, - }; + let nullable = matches!(op, LogicOperator::And | LogicOperator::Or if args[0].is_nullable() + || args[1].is_nullable() + || args[0].is_null() + || args[1].is_null()); Ok(Box::new(Self { op, diff --git a/src/query/functions/src/scalars/maths/ceil.rs b/src/query/functions/src/scalars/maths/ceil.rs index b741b920af61c..5954cfc7a9d37 100644 --- a/src/query/functions/src/scalars/maths/ceil.rs +++ b/src/query/functions/src/scalars/maths/ceil.rs @@ -54,7 +54,7 @@ impl CeilFunction { impl Function for CeilFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/maths/exp.rs b/src/query/functions/src/scalars/maths/exp.rs index 9e8048526419d..0d0127d13604c 100644 --- a/src/query/functions/src/scalars/maths/exp.rs +++ b/src/query/functions/src/scalars/maths/exp.rs @@ -53,7 +53,7 @@ where S: AsPrimitive { impl Function for ExpFunction { fn name(&self) -> &str { - &*self._display_name + &self._display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/maths/floor.rs b/src/query/functions/src/scalars/maths/floor.rs index 48aacd3e2563a..42c6cf15832fe 100644 --- a/src/query/functions/src/scalars/maths/floor.rs +++ b/src/query/functions/src/scalars/maths/floor.rs @@ -54,7 +54,7 @@ impl FloorFunction { impl Function for FloorFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/maths/log.rs b/src/query/functions/src/scalars/maths/log.rs index ff6f5df92a6f5..be920df36cc9e 100644 --- a/src/query/functions/src/scalars/maths/log.rs +++ b/src/query/functions/src/scalars/maths/log.rs @@ -72,7 +72,7 @@ pub struct GenericLogFunction { impl GenericLogFunction { pub fn try_create(display_name: &str, args: &[&DataTypeImpl]) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } Ok(Box::new(Self { display_name: display_name.to_string(), @@ -104,7 +104,7 @@ impl GenericLogFunction { impl Function for GenericLogFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/maths/pi.rs b/src/query/functions/src/scalars/maths/pi.rs index 43247ba0e176f..9f65b95618c2b 100644 --- a/src/query/functions/src/scalars/maths/pi.rs +++ b/src/query/functions/src/scalars/maths/pi.rs @@ -43,7 +43,7 @@ impl PiFunction { impl Function for PiFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/maths/pow.rs b/src/query/functions/src/scalars/maths/pow.rs index 1bd50fc4be4d5..f8dbeffab12de 100644 --- a/src/query/functions/src/scalars/maths/pow.rs +++ b/src/query/functions/src/scalars/maths/pow.rs @@ -37,7 +37,7 @@ pub struct PowFunction { impl PowFunction { pub fn try_create(display_name: &str, args: &[&DataTypeImpl]) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } Ok(Box::new(PowFunction { display_name: display_name.to_string(), @@ -61,7 +61,7 @@ where impl Function for PowFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/maths/random.rs b/src/query/functions/src/scalars/maths/random.rs index c22cbf43407a9..75a982c684527 100644 --- a/src/query/functions/src/scalars/maths/random.rs +++ b/src/query/functions/src/scalars/maths/random.rs @@ -37,7 +37,7 @@ pub struct RandomFunction { impl RandomFunction { pub fn try_create(display_name: &str, args: &[&DataTypeImpl]) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } Ok(Box::new(RandomFunction { display_name: display_name.to_string(), @@ -52,7 +52,7 @@ impl RandomFunction { impl Function for RandomFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/maths/round.rs b/src/query/functions/src/scalars/maths/round.rs index 162bcdb2c4129..64a982863f057 100644 --- a/src/query/functions/src/scalars/maths/round.rs +++ b/src/query/functions/src/scalars/maths/round.rs @@ -82,7 +82,7 @@ where impl Function for RoundingFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { @@ -174,7 +174,7 @@ pub struct RoundingFunction { impl RoundingFunction { pub fn try_create(display_name: &str, args: &[&DataTypeImpl]) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } Ok(Box::new(Self { display_name: display_name.to_string(), diff --git a/src/query/functions/src/scalars/maths/sign.rs b/src/query/functions/src/scalars/maths/sign.rs index fab7c0019947a..4603ba6e5c014 100644 --- a/src/query/functions/src/scalars/maths/sign.rs +++ b/src/query/functions/src/scalars/maths/sign.rs @@ -64,7 +64,7 @@ where S: Scalar + Default + PartialOrd { impl Function for SignFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/maths/sqrt.rs b/src/query/functions/src/scalars/maths/sqrt.rs index ab87a7be082b6..9a46dc88bc818 100644 --- a/src/query/functions/src/scalars/maths/sqrt.rs +++ b/src/query/functions/src/scalars/maths/sqrt.rs @@ -53,7 +53,7 @@ where S: AsPrimitive { impl Function for SqrtFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/maths/trigonometric.rs b/src/query/functions/src/scalars/maths/trigonometric.rs index 9f9ce7d678296..d0146ee13fec0 100644 --- a/src/query/functions/src/scalars/maths/trigonometric.rs +++ b/src/query/functions/src/scalars/maths/trigonometric.rs @@ -170,7 +170,7 @@ impl TrigonometricSinFunction { args: &[&DataTypeImpl], ) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } TrigonometricFunction::try_create_func(Trigonometric::SIN) } @@ -189,7 +189,7 @@ impl TrigonometricCosFunction { args: &[&DataTypeImpl], ) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } TrigonometricFunction::try_create_func(Trigonometric::COS) } @@ -208,7 +208,7 @@ impl TrigonometricTanFunction { args: &[&DataTypeImpl], ) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } TrigonometricFunction::try_create_func(Trigonometric::TAN) } @@ -227,7 +227,7 @@ impl TrigonometricCotFunction { args: &[&DataTypeImpl], ) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } TrigonometricFunction::try_create_func(Trigonometric::COT) } @@ -246,7 +246,7 @@ impl TrigonometricAsinFunction { args: &[&DataTypeImpl], ) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } TrigonometricFunction::try_create_func(Trigonometric::ASIN) } @@ -265,7 +265,7 @@ impl TrigonometricAcosFunction { args: &[&DataTypeImpl], ) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } TrigonometricFunction::try_create_func(Trigonometric::ACOS) } @@ -284,7 +284,7 @@ impl TrigonometricAtanFunction { args: &[&DataTypeImpl], ) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } TrigonometricFunction::try_create_func(Trigonometric::ATAN) } @@ -306,7 +306,7 @@ impl TrigonometricAtan2Function { args: &[&DataTypeImpl], ) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } TrigonometricFunction::try_create_func(Trigonometric::ATAN2) } diff --git a/src/query/functions/src/scalars/others/humanize.rs b/src/query/functions/src/scalars/others/humanize.rs index 9c0dfcd39f383..f82cfe9313817 100644 --- a/src/query/functions/src/scalars/others/humanize.rs +++ b/src/query/functions/src/scalars/others/humanize.rs @@ -59,7 +59,7 @@ impl Function for GenericHumanizeFunction where T: HumanizeConvertFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/others/ignore.rs b/src/query/functions/src/scalars/others/ignore.rs index 7307051feebed..4e68af5b014db 100644 --- a/src/query/functions/src/scalars/others/ignore.rs +++ b/src/query/functions/src/scalars/others/ignore.rs @@ -61,7 +61,7 @@ impl fmt::Display for IgnoreFunction { impl Function for IgnoreFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/others/inet_aton.rs b/src/query/functions/src/scalars/others/inet_aton.rs index dc4c763c37fbb..f0f763d742d6f 100644 --- a/src/query/functions/src/scalars/others/inet_aton.rs +++ b/src/query/functions/src/scalars/others/inet_aton.rs @@ -54,7 +54,7 @@ impl InetAtonFunctionImpl Function for InetAtonFunctionImpl { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/others/inet_ntoa.rs b/src/query/functions/src/scalars/others/inet_ntoa.rs index 9081bbe9ff539..07b71555edad6 100644 --- a/src/query/functions/src/scalars/others/inet_ntoa.rs +++ b/src/query/functions/src/scalars/others/inet_ntoa.rs @@ -57,7 +57,7 @@ impl InetNtoaFunctionImpl impl Function for InetNtoaFunctionImpl { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/semi_structureds/array_get.rs b/src/query/functions/src/scalars/semi_structureds/array_get.rs index 38f1833d614e3..e001f014cabcc 100644 --- a/src/query/functions/src/scalars/semi_structureds/array_get.rs +++ b/src/query/functions/src/scalars/semi_structureds/array_get.rs @@ -60,7 +60,7 @@ impl ArrayGetFunction { impl Function for ArrayGetFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/semi_structureds/array_length.rs b/src/query/functions/src/scalars/semi_structureds/array_length.rs index 9fa8a6b874c9f..87a4a178d2c10 100644 --- a/src/query/functions/src/scalars/semi_structureds/array_length.rs +++ b/src/query/functions/src/scalars/semi_structureds/array_length.rs @@ -55,7 +55,7 @@ impl ArrayLengthFunction { impl Function for ArrayLengthFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/semi_structureds/check_json.rs b/src/query/functions/src/scalars/semi_structureds/check_json.rs index 9627bc071bf36..b5e45676bec14 100644 --- a/src/query/functions/src/scalars/semi_structureds/check_json.rs +++ b/src/query/functions/src/scalars/semi_structureds/check_json.rs @@ -44,7 +44,7 @@ impl CheckJsonFunction { impl Function for CheckJsonFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/semi_structureds/get.rs b/src/query/functions/src/scalars/semi_structureds/get.rs index 273ca468df814..005f5bae4abef 100644 --- a/src/query/functions/src/scalars/semi_structureds/get.rs +++ b/src/query/functions/src/scalars/semi_structureds/get.rs @@ -68,7 +68,7 @@ impl GetFunctionImpl { impl Function for GetFunctionImpl { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/semi_structureds/get_path.rs b/src/query/functions/src/scalars/semi_structureds/get_path.rs index e2c10b982edaf..7d2cb01313e05 100644 --- a/src/query/functions/src/scalars/semi_structureds/get_path.rs +++ b/src/query/functions/src/scalars/semi_structureds/get_path.rs @@ -60,7 +60,7 @@ impl GetPathFunction { impl Function for GetPathFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/semi_structureds/json_extract_path_text.rs b/src/query/functions/src/scalars/semi_structureds/json_extract_path_text.rs index 72bb7572ad7e1..29fc6593bbb53 100644 --- a/src/query/functions/src/scalars/semi_structureds/json_extract_path_text.rs +++ b/src/query/functions/src/scalars/semi_structureds/json_extract_path_text.rs @@ -58,7 +58,7 @@ impl JsonExtractPathTextFunction { impl Function for JsonExtractPathTextFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/semi_structureds/length.rs b/src/query/functions/src/scalars/semi_structureds/length.rs index d117bb45abf82..533b051351c7a 100644 --- a/src/query/functions/src/scalars/semi_structureds/length.rs +++ b/src/query/functions/src/scalars/semi_structureds/length.rs @@ -55,7 +55,7 @@ impl VariantArrayLengthFunction { impl Function for VariantArrayLengthFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/semi_structureds/object_keys.rs b/src/query/functions/src/scalars/semi_structureds/object_keys.rs index 6eb0811ebb995..a10440d593610 100644 --- a/src/query/functions/src/scalars/semi_structureds/object_keys.rs +++ b/src/query/functions/src/scalars/semi_structureds/object_keys.rs @@ -51,7 +51,7 @@ impl ObjectKeysFunction { impl Function for ObjectKeysFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/semi_structureds/parse_json.rs b/src/query/functions/src/scalars/semi_structureds/parse_json.rs index f37692125a0c1..7b062bcb8ad4e 100644 --- a/src/query/functions/src/scalars/semi_structureds/parse_json.rs +++ b/src/query/functions/src/scalars/semi_structureds/parse_json.rs @@ -74,7 +74,7 @@ impl ParseJsonFunctionImpl Function for ParseJsonFunctionImpl { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/char_.rs b/src/query/functions/src/scalars/strings/char_.rs index 61adbe05bca23..59d7493c6344f 100644 --- a/src/query/functions/src/scalars/strings/char_.rs +++ b/src/query/functions/src/scalars/strings/char_.rs @@ -32,7 +32,7 @@ pub struct CharFunction { impl CharFunction { pub fn try_create(display_name: &str, args: &[&DataTypeImpl]) -> Result> { for arg in args { - assert_numeric(*arg)?; + assert_numeric(arg)?; } Ok(Box::new(CharFunction { _display_name: display_name.to_string(), diff --git a/src/query/functions/src/scalars/strings/concat.rs b/src/query/functions/src/scalars/strings/concat.rs index 3bad4091b8f9e..cc075b41d836f 100644 --- a/src/query/functions/src/scalars/strings/concat.rs +++ b/src/query/functions/src/scalars/strings/concat.rs @@ -31,7 +31,7 @@ pub struct ConcatFunction { impl ConcatFunction { pub fn try_create(display_name: &str, args: &[&DataTypeImpl]) -> Result> { for arg in args { - assert_string(*arg)?; + assert_string(arg)?; } Ok(Box::new(ConcatFunction { _display_name: display_name.to_string(), diff --git a/src/query/functions/src/scalars/strings/concat_ws.rs b/src/query/functions/src/scalars/strings/concat_ws.rs index 73db213034435..03507430b2c74 100644 --- a/src/query/functions/src/scalars/strings/concat_ws.rs +++ b/src/query/functions/src/scalars/strings/concat_ws.rs @@ -35,7 +35,7 @@ impl ConcatWsFunction { NullType::new_impl() } else { for arg in args { - let arg = remove_nullable(*arg); + let arg = remove_nullable(arg); if !arg.is_null() { assert_string(&arg)?; } diff --git a/src/query/functions/src/scalars/strings/elt.rs b/src/query/functions/src/scalars/strings/elt.rs index ece46b652446c..fc88360383c40 100644 --- a/src/query/functions/src/scalars/strings/elt.rs +++ b/src/query/functions/src/scalars/strings/elt.rs @@ -45,7 +45,7 @@ impl EltFunction { assert_numeric(&arg)?; for arg in args[1..].iter() { - let arg = remove_nullable(*arg); + let arg = remove_nullable(arg); if !arg.is_null() { assert_string(&arg)?; } @@ -76,7 +76,7 @@ impl EltFunction { impl Function for EltFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/export_set.rs b/src/query/functions/src/scalars/strings/export_set.rs index 3233c010be416..e1582b91a72c3 100644 --- a/src/query/functions/src/scalars/strings/export_set.rs +++ b/src/query/functions/src/scalars/strings/export_set.rs @@ -63,7 +63,7 @@ impl ExportSetFunction { impl Function for ExportSetFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/field.rs b/src/query/functions/src/scalars/strings/field.rs index 99c2c3ad3b59f..f2469f00a4c01 100644 --- a/src/query/functions/src/scalars/strings/field.rs +++ b/src/query/functions/src/scalars/strings/field.rs @@ -31,7 +31,7 @@ pub struct FieldFunction { impl FieldFunction { pub fn try_create(display_name: &str, args: &[&DataTypeImpl]) -> Result> { for arg in args { - assert_string(*arg)?; + assert_string(arg)?; } Ok(Box::new(FieldFunction { display_name: display_name.to_string(), @@ -49,7 +49,7 @@ impl FieldFunction { impl Function for FieldFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/find_in_set.rs b/src/query/functions/src/scalars/strings/find_in_set.rs index ae35aae32662e..72abe20d2b2f3 100644 --- a/src/query/functions/src/scalars/strings/find_in_set.rs +++ b/src/query/functions/src/scalars/strings/find_in_set.rs @@ -47,7 +47,7 @@ impl FindInSetFunction { impl Function for FindInSetFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/insert.rs b/src/query/functions/src/scalars/strings/insert.rs index 6046b5df88ffb..d4596d6db59b1 100644 --- a/src/query/functions/src/scalars/strings/insert.rs +++ b/src/query/functions/src/scalars/strings/insert.rs @@ -76,7 +76,7 @@ impl InsertFunction { impl Function for InsertFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/leftright.rs b/src/query/functions/src/scalars/strings/leftright.rs index ee642db72dae0..6972e83959e2d 100644 --- a/src/query/functions/src/scalars/strings/leftright.rs +++ b/src/query/functions/src/scalars/strings/leftright.rs @@ -74,7 +74,7 @@ impl LeftRightFunction { impl Function for LeftRightFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/locate.rs b/src/query/functions/src/scalars/strings/locate.rs index a727529d0864b..5592208e83bc2 100644 --- a/src/query/functions/src/scalars/strings/locate.rs +++ b/src/query/functions/src/scalars/strings/locate.rs @@ -64,7 +64,7 @@ impl LocatingFunction { impl Function for LocatingFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/new_trim.rs b/src/query/functions/src/scalars/strings/new_trim.rs index edeac07520cd4..45b0636505329 100644 --- a/src/query/functions/src/scalars/strings/new_trim.rs +++ b/src/query/functions/src/scalars/strings/new_trim.rs @@ -37,7 +37,7 @@ pub struct TrimFunction { impl TrimFunction { pub fn try_create(display_name: &str, args: &[&DataTypeImpl]) -> Result> { for arg in args { - assert_string(*arg)?; + assert_string(arg)?; } Ok(Box::new(Self { display_name: display_name.to_string(), @@ -53,7 +53,7 @@ impl TrimFunction { impl Function for TrimFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/pad.rs b/src/query/functions/src/scalars/strings/pad.rs index f1dcb89516750..db7c35fbea66f 100644 --- a/src/query/functions/src/scalars/strings/pad.rs +++ b/src/query/functions/src/scalars/strings/pad.rs @@ -114,7 +114,7 @@ impl PadFunction { impl Function for PadFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/regexp_like.rs b/src/query/functions/src/scalars/strings/regexp_like.rs index e9b1e9b81d032..135f80dba7d9e 100644 --- a/src/query/functions/src/scalars/strings/regexp_like.rs +++ b/src/query/functions/src/scalars/strings/regexp_like.rs @@ -38,7 +38,7 @@ pub struct RegexpLikeFunction { impl RegexpLikeFunction { pub fn try_create(display_name: &str, args: &[&DataTypeImpl]) -> Result> { for arg in args { - assert_string(*arg)?; + assert_string(arg)?; } Ok(Box::new(Self { @@ -209,6 +209,7 @@ pub fn build_regexp_from_pattern( fn_name, c, ))), }; + #[allow(clippy::question_mark)] if let Err(e) = r { return Err(e); } diff --git a/src/query/functions/src/scalars/strings/replace.rs b/src/query/functions/src/scalars/strings/replace.rs index e78f19aea2ed2..1239be99f8a07 100644 --- a/src/query/functions/src/scalars/strings/replace.rs +++ b/src/query/functions/src/scalars/strings/replace.rs @@ -52,7 +52,7 @@ pub struct ReplaceFunction { impl ReplaceFunction { pub fn try_create(display_name: &str, args: &[&DataTypeImpl]) -> Result> { for arg in args { - assert_string(*arg)?; + assert_string(arg)?; } Ok(Box::new(Self { display_name: display_name.to_string(), @@ -67,7 +67,7 @@ impl ReplaceFunction { impl Function for ReplaceFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/space.rs b/src/query/functions/src/scalars/strings/space.rs index a75fd021e5426..a47fef3a000e0 100644 --- a/src/query/functions/src/scalars/strings/space.rs +++ b/src/query/functions/src/scalars/strings/space.rs @@ -50,7 +50,7 @@ impl SpaceFunction { impl Function for SpaceFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/strcmp.rs b/src/query/functions/src/scalars/strings/strcmp.rs index cdf14773d08ad..a3814f4079eb3 100644 --- a/src/query/functions/src/scalars/strings/strcmp.rs +++ b/src/query/functions/src/scalars/strings/strcmp.rs @@ -35,7 +35,7 @@ pub struct StrcmpFunction { impl StrcmpFunction { pub fn try_create(display_name: &str, args: &[&DataTypeImpl]) -> Result> { for arg in args { - assert_string(*arg)?; + assert_string(arg)?; } Ok(Box::new(StrcmpFunction { display_name: display_name.to_string(), @@ -50,7 +50,7 @@ impl StrcmpFunction { impl Function for StrcmpFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/substring.rs b/src/query/functions/src/scalars/strings/substring.rs index e6a05feceb2f1..782597f99c715 100644 --- a/src/query/functions/src/scalars/strings/substring.rs +++ b/src/query/functions/src/scalars/strings/substring.rs @@ -68,7 +68,7 @@ impl SubstringFunction { impl Function for SubstringFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/functions/src/scalars/strings/substring_index.rs b/src/query/functions/src/scalars/strings/substring_index.rs index aa9d345fa90e1..b9e490b2ca948 100644 --- a/src/query/functions/src/scalars/strings/substring_index.rs +++ b/src/query/functions/src/scalars/strings/substring_index.rs @@ -63,7 +63,7 @@ impl SubstringIndexFunction { impl Function for SubstringIndexFunction { fn name(&self) -> &str { - &*self.display_name + &self.display_name } fn return_type(&self) -> DataTypeImpl { diff --git a/src/query/legacy-planners/src/plan_expression_common.rs b/src/query/legacy-planners/src/plan_expression_common.rs index a612ed67dec41..6cb442e139792 100644 --- a/src/query/legacy-planners/src/plan_expression_common.rs +++ b/src/query/legacy-planners/src/plan_expression_common.rs @@ -277,7 +277,7 @@ where F: Fn(&Expression) -> Result> { Expression::Wildcard => Ok(Expression::Wildcard), Expression::Alias(alias_name, nested_expr) => Ok(Expression::Alias( alias_name.clone(), - Box::new(clone_with_replacement(&**nested_expr, replacement_fn)?), + Box::new(clone_with_replacement(nested_expr, replacement_fn)?), )), Expression::UnaryExpression { @@ -285,13 +285,13 @@ where F: Fn(&Expression) -> Result> { expr: nested_expr, } => Ok(Expression::UnaryExpression { op: op.clone(), - expr: Box::new(clone_with_replacement(&**nested_expr, replacement_fn)?), + expr: Box::new(clone_with_replacement(nested_expr, replacement_fn)?), }), Expression::BinaryExpression { left, op, right } => Ok(Expression::BinaryExpression { - left: Box::new(clone_with_replacement(&**left, replacement_fn)?), + left: Box::new(clone_with_replacement(left, replacement_fn)?), op: op.clone(), - right: Box::new(clone_with_replacement(&**right, replacement_fn)?), + right: Box::new(clone_with_replacement(right, replacement_fn)?), }), Expression::ScalarFunction { op, args } => Ok(Expression::ScalarFunction { @@ -348,7 +348,7 @@ where F: Fn(&Expression) -> Result> { nulls_first, origin_expr, } => Ok(Expression::Sort { - expr: Box::new(clone_with_replacement(&**nested_expr, replacement_fn)?), + expr: Box::new(clone_with_replacement(nested_expr, replacement_fn)?), asc: *asc, nulls_first: *nulls_first, origin_expr: origin_expr.clone(), @@ -358,7 +358,7 @@ where F: Fn(&Expression) -> Result> { data_type, pg_style, } => Ok(Expression::Cast { - expr: Box::new(clone_with_replacement(&**nested_expr, replacement_fn)?), + expr: Box::new(clone_with_replacement(nested_expr, replacement_fn)?), data_type: data_type.clone(), pg_style: *pg_style, }), diff --git a/src/query/pipeline/sinks/src/lib.rs b/src/query/pipeline/sinks/src/lib.rs index b80e54357796c..3830080b8e44b 100644 --- a/src/query/pipeline/sinks/src/lib.rs +++ b/src/query/pipeline/sinks/src/lib.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(generic_associated_types)] -#![deny(unused_crate_dependencies)] #![feature(type_alias_impl_trait)] pub mod processors; diff --git a/src/query/pipeline/sources/src/lib.rs b/src/query/pipeline/sources/src/lib.rs index 0282eb8f4c9bf..d5d0986f4b682 100644 --- a/src/query/pipeline/sources/src/lib.rs +++ b/src/query/pipeline/sources/src/lib.rs @@ -13,7 +13,6 @@ // limitations under the License. #![feature(type_alias_impl_trait)] -#![feature(generic_associated_types)] #![deny(unused_crate_dependencies)] pub mod processors; diff --git a/src/query/pipeline/transforms/src/lib.rs b/src/query/pipeline/transforms/src/lib.rs index 6e4d18641fd7f..46f5c3e7fea28 100644 --- a/src/query/pipeline/transforms/src/lib.rs +++ b/src/query/pipeline/transforms/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(generic_associated_types)] #![deny(unused_crate_dependencies)] pub mod processors; diff --git a/src/query/service/src/api/http_service.rs b/src/query/service/src/api/http_service.rs index 8cc9cca39d0e7..bf258b1c24d86 100644 --- a/src/query/service/src/api/http_service.rs +++ b/src/query/service/src/api/http_service.rs @@ -92,12 +92,12 @@ impl HttpService { fn build_tls(config: &Config) -> Result { let certificate = RustlsCertificate::new() - .cert(std::fs::read(&config.query.api_tls_server_cert.as_str())?) - .key(std::fs::read(&config.query.api_tls_server_key.as_str())?); + .cert(std::fs::read(config.query.api_tls_server_cert.as_str())?) + .key(std::fs::read(config.query.api_tls_server_key.as_str())?); let mut cfg = RustlsConfig::new().fallback(certificate); if Path::new(&config.query.api_tls_server_root_ca_cert).exists() { cfg = cfg.client_auth_required(std::fs::read( - &config.query.api_tls_server_root_ca_cert.as_str(), + config.query.api_tls_server_root_ca_cert.as_str(), )?); } Ok(cfg) diff --git a/src/query/service/src/interpreters/interpreter_query_log.rs b/src/query/service/src/interpreters/interpreter_query_log.rs index 4ae2f439e0400..3698471c82e6a 100644 --- a/src/query/service/src/interpreters/interpreter_query_log.rs +++ b/src/query/service/src/interpreters/interpreter_query_log.rs @@ -231,16 +231,12 @@ impl InterpreterQueryLog { .await?; // info!("{}", serde_json::to_string(event)?); - match QueryLogger::instance().get_subscriber() { - Some(logger) => { - let event_str = serde_json::to_string(event)?; - subscriber::with_default(logger, || { - info!("{}", event_str); - }); - } - None => {} + if let Some(logger) = QueryLogger::instance().get_subscriber() { + let event_str = serde_json::to_string(event)?; + subscriber::with_default(logger, || { + info!("{}", event_str); + }); }; - Ok(()) } diff --git a/src/query/service/src/interpreters/interpreter_table_create_v2.rs b/src/query/service/src/interpreters/interpreter_table_create_v2.rs index 55b88596dcb84..0ce574c4f4330 100644 --- a/src/query/service/src/interpreters/interpreter_table_create_v2.rs +++ b/src/query/service/src/interpreters/interpreter_table_create_v2.rs @@ -55,7 +55,7 @@ impl Interpreter for CreateTableInterpreterV2 { let engine = self.plan.engine(); let catalog = self.ctx.get_catalog(self.plan.catalog.as_str())?; let tables = catalog - .list_tables(&*self.plan.tenant, &*self.plan.database) + .list_tables(&self.plan.tenant, &self.plan.database) .await?; if quota.max_tables_per_database != 0 && tables.len() >= quota.max_tables_per_database as usize diff --git a/src/query/service/src/interpreters/interpreter_view_create.rs b/src/query/service/src/interpreters/interpreter_view_create.rs index c58da219d83ff..0255cb28dd115 100644 --- a/src/query/service/src/interpreters/interpreter_view_create.rs +++ b/src/query/service/src/interpreters/interpreter_view_create.rs @@ -50,7 +50,7 @@ impl Interpreter for CreateViewInterpreter { if self .ctx .get_catalog(&self.plan.catalog)? - .list_tables(&*self.plan.tenant, &*self.plan.database) + .list_tables(&self.plan.tenant, &self.plan.database) .await? .iter() .any(|table| table.name() == self.plan.viewname.as_str()) diff --git a/src/query/service/src/lib.rs b/src/query/service/src/lib.rs index 6c42014739e1a..898da7199b3fb 100644 --- a/src/query/service/src/lib.rs +++ b/src/query/service/src/lib.rs @@ -15,7 +15,6 @@ #![feature(hash_raw_entry)] #![feature(core_intrinsics)] #![feature(arbitrary_self_types)] -#![feature(generic_associated_types)] #![feature(type_alias_impl_trait)] #![feature(assert_matches)] #![feature(trusted_len)] diff --git a/src/query/service/src/servers/http/http_services.rs b/src/query/service/src/servers/http/http_services.rs index 56c445badbf8d..f6d57b771c6e7 100644 --- a/src/query/service/src/servers/http/http_services.rs +++ b/src/query/service/src/servers/http/http_services.rs @@ -109,15 +109,15 @@ impl HttpHandler { fn build_tls(config: &Config) -> Result { let certificate = RustlsCertificate::new() .cert(std::fs::read( - &config.query.http_handler_tls_server_cert.as_str(), + config.query.http_handler_tls_server_cert.as_str(), )?) .key(std::fs::read( - &config.query.http_handler_tls_server_key.as_str(), + config.query.http_handler_tls_server_key.as_str(), )?); let mut cfg = RustlsConfig::new().fallback(certificate); if Path::new(&config.query.http_handler_tls_server_root_ca_cert).exists() { cfg = cfg.client_auth_required(std::fs::read( - &config.query.http_handler_tls_server_root_ca_cert.as_str(), + config.query.http_handler_tls_server_root_ca_cert.as_str(), )?); } Ok(cfg) diff --git a/src/query/service/src/servers/mysql/reject_connection.rs b/src/query/service/src/servers/mysql/reject_connection.rs index 0ef9423d3eabb..74ba3e9edf63a 100644 --- a/src/query/service/src/servers/mysql/reject_connection.rs +++ b/src/query/service/src/servers/mysql/reject_connection.rs @@ -31,7 +31,7 @@ impl RejectConnection { // Send error. Packet[seq = 2] let mut buffer = vec![0xFF_u8]; - buffer.extend(&(code as u16).to_le_bytes()); + buffer.extend((code as u16).to_le_bytes()); buffer.extend(&vec![b'#']); buffer.extend(code.sqlstate()); buffer.extend(error_message.into().as_bytes()); diff --git a/src/query/service/src/sql/executor/expression_builder.rs b/src/query/service/src/sql/executor/expression_builder.rs index 68929f5537a4b..df567ae0f1aeb 100644 --- a/src/query/service/src/sql/executor/expression_builder.rs +++ b/src/query/service/src/sql/executor/expression_builder.rs @@ -87,8 +87,8 @@ where ExpressionBuilder: FiledNameFormat .. }) => self.build_aggr_function(func_name.clone(), *distinct, params.clone(), args), Scalar::AndExpr(AndExpr { left, right, .. }) => { - let left = self.build(&**left)?; - let right = self.build(&**right)?; + let left = self.build(left)?; + let right = self.build(right)?; Ok(Expression::BinaryExpression { left: Box::new(left), op: "and".to_string(), @@ -96,8 +96,8 @@ where ExpressionBuilder: FiledNameFormat }) } Scalar::OrExpr(OrExpr { left, right, .. }) => { - let left = self.build(&**left)?; - let right = self.build(&**right)?; + let left = self.build(left)?; + let right = self.build(right)?; Ok(Expression::BinaryExpression { left: Box::new(left), op: "or".to_string(), diff --git a/src/query/service/src/sql/executor/physical_plan_builder.rs b/src/query/service/src/sql/executor/physical_plan_builder.rs index 5af9298688d5b..59505270c82e8 100644 --- a/src/query/service/src/sql/executor/physical_plan_builder.rs +++ b/src/query/service/src/sql/executor/physical_plan_builder.rs @@ -499,6 +499,7 @@ impl PhysicalPlanBuilder { pub struct PhysicalScalarBuilder; +#[allow(clippy::only_used_in_recursion)] impl PhysicalScalarBuilder { pub fn build(&mut self, scalar: &Scalar) -> Result { match scalar { diff --git a/src/query/service/src/sql/planner/binder/scalar_visitor.rs b/src/query/service/src/sql/planner/binder/scalar_visitor.rs index 0bdf6c170ff71..bf8510f3d8d16 100644 --- a/src/query/service/src/sql/planner/binder/scalar_visitor.rs +++ b/src/query/service/src/sql/planner/binder/scalar_visitor.rs @@ -58,16 +58,16 @@ pub trait ScalarVisitor: Sized { } } Scalar::ComparisonExpr(ComparisonExpr { left, right, .. }) => { - stack.push(RecursionProcessing::Call(&**left)); - stack.push(RecursionProcessing::Call(&**right)); + stack.push(RecursionProcessing::Call(left)); + stack.push(RecursionProcessing::Call(right)); } Scalar::AndExpr(AndExpr { left, right, .. }) => { - stack.push(RecursionProcessing::Call(&**left)); - stack.push(RecursionProcessing::Call(&**right)); + stack.push(RecursionProcessing::Call(left)); + stack.push(RecursionProcessing::Call(right)); } Scalar::OrExpr(OrExpr { left, right, .. }) => { - stack.push(RecursionProcessing::Call(&**left)); - stack.push(RecursionProcessing::Call(&**right)); + stack.push(RecursionProcessing::Call(left)); + stack.push(RecursionProcessing::Call(right)); } Scalar::FunctionCall(FunctionCall { arguments, .. }) => { for arg in arguments.iter() { diff --git a/src/query/service/src/sql/planner/binder/sort.rs b/src/query/service/src/sql/planner/binder/sort.rs index 04b16088b054b..ac5c19739503c 100644 --- a/src/query/service/src/sql/planner/binder/sort.rs +++ b/src/query/service/src/sql/planner/binder/sort.rs @@ -331,6 +331,7 @@ impl<'a> Binder { Ok(SExpr::create_unary(sort_plan.into(), child)) } + #[allow(clippy::only_used_in_recursion)] fn rewrite_scalar_with_replacement( &self, original_scalar: &Scalar, diff --git a/src/query/service/src/sql/planner/format/display_rel_operator.rs b/src/query/service/src/sql/planner/format/display_rel_operator.rs index 530c82a9da476..4e24f6502001e 100644 --- a/src/query/service/src/sql/planner/format/display_rel_operator.rs +++ b/src/query/service/src/sql/planner/format/display_rel_operator.rs @@ -89,7 +89,7 @@ impl Display for FormatContext { } } -pub fn format_scalar(metadata: &MetadataRef, scalar: &Scalar) -> String { +pub fn format_scalar(_metadata: &MetadataRef, scalar: &Scalar) -> String { match scalar { Scalar::BoundColumnRef(column_ref) => { if let Some(table_name) = &column_ref.column.table_name { @@ -107,19 +107,19 @@ pub fn format_scalar(metadata: &MetadataRef, scalar: &Scalar) -> String { Scalar::ConstantExpr(constant) => constant.value.to_string(), Scalar::AndExpr(and) => format!( "({}) AND ({})", - format_scalar(metadata, &and.left), - format_scalar(metadata, &and.right) + format_scalar(_metadata, &and.left), + format_scalar(_metadata, &and.right) ), Scalar::OrExpr(or) => format!( "({}) OR ({})", - format_scalar(metadata, &or.left), - format_scalar(metadata, &or.right) + format_scalar(_metadata, &or.left), + format_scalar(_metadata, &or.right) ), Scalar::ComparisonExpr(comp) => format!( "{} {} {}", - format_scalar(metadata, &comp.left), + format_scalar(_metadata, &comp.left), comp.op.to_func_name(), - format_scalar(metadata, &comp.right) + format_scalar(_metadata, &comp.right) ), Scalar::AggregateFunction(agg) => agg.display_name.clone(), Scalar::FunctionCall(func) => { @@ -128,7 +128,7 @@ pub fn format_scalar(metadata: &MetadataRef, scalar: &Scalar) -> String { &func.func_name, func.arguments .iter() - .map(|arg| { format_scalar(metadata, arg) }) + .map(|arg| { format_scalar(_metadata, arg) }) .collect::>() .join(", ") ) @@ -136,7 +136,7 @@ pub fn format_scalar(metadata: &MetadataRef, scalar: &Scalar) -> String { Scalar::CastExpr(cast) => { format!( "CAST({} AS {})", - format_scalar(metadata, &cast.argument), + format_scalar(_metadata, &cast.argument), format_data_type_sql(&cast.target_type) ) } diff --git a/src/query/service/src/sql/planner/optimizer/rule/rewrite/rule_normalize_disjunctive_filter.rs b/src/query/service/src/sql/planner/optimizer/rule/rewrite/rule_normalize_disjunctive_filter.rs index e83472f47f94c..1e4c632b93381 100644 --- a/src/query/service/src/sql/planner/optimizer/rule/rewrite/rule_normalize_disjunctive_filter.rs +++ b/src/query/service/src/sql/planner/optimizer/rule/rewrite/rule_normalize_disjunctive_filter.rs @@ -42,15 +42,15 @@ fn predicate_scalar(scalar: &Scalar) -> PredicateScalar { match scalar { Scalar::AndExpr(and_expr) => { let args = vec![ - predicate_scalar(&*and_expr.left), - predicate_scalar(&*and_expr.right), + predicate_scalar(&and_expr.left), + predicate_scalar(&and_expr.right), ]; PredicateScalar::And { args } } Scalar::OrExpr(or_expr) => { let args = vec![ - predicate_scalar(&*or_expr.left), - predicate_scalar(&*or_expr.right), + predicate_scalar(&or_expr.left), + predicate_scalar(&or_expr.right), ]; PredicateScalar::Or { args } } diff --git a/src/query/service/src/sql/planner/semantic/type_check.rs b/src/query/service/src/sql/planner/semantic/type_check.rs index 710f7f760eb85..b8e086ddb6962 100644 --- a/src/query/service/src/sql/planner/semantic/type_check.rs +++ b/src/query/service/src/sql/planner/semantic/type_check.rs @@ -611,7 +611,7 @@ impl<'a> TypeChecker<'a> { span, "not", &[&Expr::Exists { - span: *span, + span, not: false, subquery: subquery.clone(), }], @@ -644,7 +644,7 @@ impl<'a> TypeChecker<'a> { subquery: subquery.clone(), not: false, expr: expr.clone(), - span: *span, + span, }], required_type, ) @@ -684,7 +684,7 @@ impl<'a> TypeChecker<'a> { ref column, .. } => { - let box (_, data_type) = self.resolve(&*expr, None).await?; + let box (_, data_type) = self.resolve(&expr, None).await?; if data_type.data_type_id() != TypeID::Struct { break; } @@ -1848,6 +1848,7 @@ impl<'a> TypeChecker<'a> { Ok(Box::new((scalar, data_type))) } + #[allow(clippy::only_used_in_recursion)] fn clone_expr_with_replacement( &self, original_expr: &Expr<'a>, diff --git a/src/query/service/src/sql/statements/analyzer_expr.rs b/src/query/service/src/sql/statements/analyzer_expr.rs index 28efc6502f36a..9b08719f63420 100644 --- a/src/query/service/src/sql/statements/analyzer_expr.rs +++ b/src/query/service/src/sql/statements/analyzer_expr.rs @@ -462,6 +462,7 @@ impl ExpressionAnalyzer { Ok(()) } + #[allow(clippy::only_used_in_recursion)] fn analyze_map_access(&self, keys: &[Value], args: &mut Vec) -> Result<()> { match args.pop() { None => Err(ErrorCode::LogicalError( diff --git a/src/query/service/src/sql/statements/statement_insert.rs b/src/query/service/src/sql/statements/statement_insert.rs index 10addb42ddf63..9f2ff06d2c29d 100644 --- a/src/query/service/src/sql/statements/statement_insert.rs +++ b/src/query/service/src/sql/statements/statement_insert.rs @@ -92,13 +92,8 @@ impl<'a> AnalyzableStatement for DfInsertStatement<'a> { let input_source = match &self.source { InsertSource::Empty => self.analyze_insert_without_source().await, InsertSource::StreamFormat(stream_format) => { - self.analyze_stream_format( - ctx.clone(), - *stream_format, - &schema, - self.format.clone(), - ) - .await + self.analyze_stream_format(ctx.clone(), stream_format, &schema, self.format.clone()) + .await } InsertSource::Select(select) => self.analyze_insert_select(ctx.clone(), select).await, }?; diff --git a/src/query/service/tests/it/main.rs b/src/query/service/tests/it/main.rs index e1f3ea1b28cf4..3f1f059e5265c 100644 --- a/src/query/service/tests/it/main.rs +++ b/src/query/service/tests/it/main.rs @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#![feature(backtrace)] #![feature(thread_local)] mod api; diff --git a/src/query/service/tests/it/storages/fuse/table_test_fixture.rs b/src/query/service/tests/it/storages/fuse/table_test_fixture.rs index 01526eedb041e..a5f099c3755e1 100644 --- a/src/query/service/tests/it/storages/fuse/table_test_fixture.rs +++ b/src/query/service/tests/it/storages/fuse/table_test_fixture.rs @@ -333,6 +333,7 @@ pub async fn test_drive_with_args(ctx: Arc, tbl_args: TableArgs) - let mut stream = test_drive_with_args_and_ctx(tbl_args, ctx).await?; while let Some(res) = stream.next().await { + #[allow(clippy::question_mark)] if let Err(cause) = res { return Err(cause); } diff --git a/src/query/settings/src/lib.rs b/src/query/settings/src/lib.rs index cc59d6edacb57..d14ad02bf5644 100644 --- a/src/query/settings/src/lib.rs +++ b/src/query/settings/src/lib.rs @@ -464,7 +464,7 @@ impl Settings { pub fn set_unquoted_ident_case_sensitive(&self, val: bool) -> Result<()> { static KEY: &str = "unquoted_ident_case_sensitive"; - let v = if val { 1 } else { 0 }; + let v = u64::from(val); self.try_set_u64(KEY, v, false) } @@ -476,7 +476,7 @@ impl Settings { pub fn set_quoted_ident_case_sensitive(&self, val: bool) -> Result<()> { static KEY: &str = "quoted_ident_case_sensitive"; - let v = if val { 1 } else { 0 }; + let v = u64::from(val); self.try_set_u64(KEY, v, false) } @@ -488,7 +488,7 @@ impl Settings { pub fn set_enable_cbo(&self, val: bool) -> Result<()> { static KEY: &str = "enable_cbo"; - let v = if val { 1 } else { 0 }; + let v = u64::from(val); self.try_set_u64(KEY, v, false) } diff --git a/src/query/storages/fuse/src/io/read/block_reader.rs b/src/query/storages/fuse/src/io/read/block_reader.rs index 17b0cafa9193e..801f1aab24472 100644 --- a/src/query/storages/fuse/src/io/read/block_reader.rs +++ b/src/query/storages/fuse/src/io/read/block_reader.rs @@ -114,6 +114,7 @@ impl BlockReader { page_meta_data, Arc::new(|_, _| true), vec![], + usize::MAX, ); Ok(BasicDecompressor::new(pages, vec![])) }) @@ -124,7 +125,13 @@ impl BlockReader { .map(|column_descriptor| &column_descriptor.descriptor.primitive_type) .collect::>(); - Ok(column_iter_to_arrays(columns, types, field, Some(rows))?) + Ok(column_iter_to_arrays( + columns, + types, + field, + Some(rows), + rows, + )?) } // TODO refine these diff --git a/src/query/storages/fuse/src/io/read/bloom_index_reader.rs b/src/query/storages/fuse/src/io/read/bloom_index_reader.rs index 562ca7a0333aa..4c2a647fae600 100644 --- a/src/query/storages/fuse/src/io/read/bloom_index_reader.rs +++ b/src/query/storages/fuse/src/io/read/bloom_index_reader.rs @@ -16,7 +16,6 @@ use std::sync::Arc; use common_arrow::arrow::io::parquet::read::column_iter_to_arrays; use common_arrow::arrow::io::parquet::read::infer_schema; -use common_arrow::arrow::io::parquet::read::read_metadata_async; use common_arrow::arrow::io::parquet::read::RowGroupDeserializer; use common_arrow::parquet::compression::Compression; use common_arrow::parquet::metadata::ColumnChunkMetaData; @@ -162,13 +161,14 @@ mod util_v1 { page_meta_data, Arc::new(|_, _| true), vec![], + usize::MAX, ); let decompressor = BasicDecompressor::new(page_reader, vec![]); let decompressors = vec![decompressor]; let types = vec![&column_descriptors[col_idx].descriptor.primitive_type]; let field = arrow_schema.fields[col_idx].clone(); let arrays = tracing::debug_span!("iter_to_arrays").in_scope(|| { - column_iter_to_arrays(decompressors, types, field, Some(num_values)) + column_iter_to_arrays(decompressors, types, field, Some(num_values), num_values) })?; columns_array_iter.push(arrays); } @@ -265,14 +265,6 @@ mod util_v1 { .await? } - #[tracing::instrument(level = "debug", skip_all)] - async fn load_index_meta_from_storage(dal: Operator, path: String) -> Result { - let object = dal.object(&path); - let mut reader = object.seekable_reader(0..); - let file_meta = read_metadata_async(&mut reader).await?; - Ok(file_meta) - } - #[tracing::instrument(level = "debug", skip_all)] async fn load_index_column_data_from_storage( col_meta: ColumnChunkMetaData, diff --git a/src/query/storages/fuse/src/io/write/block_writer.rs b/src/query/storages/fuse/src/io/write/block_writer.rs index 2dc25cc4b62c7..2bb86ce4fcf72 100644 --- a/src/query/storages/fuse/src/io/write/block_writer.rs +++ b/src/query/storages/fuse/src/io/write/block_writer.rs @@ -112,7 +112,7 @@ impl<'a> BlockWriter<'a> { let index_block_schema = &bloom_index.bloom_schema; let (size, _) = serialize_data_blocks_with_compression( vec![index_block], - &index_block_schema, + index_block_schema, &mut data, CompressionOptions::Uncompressed, )?; diff --git a/src/query/storages/fuse/src/lib.rs b/src/query/storages/fuse/src/lib.rs index a8348cefc4054..0979f31842e38 100644 --- a/src/query/storages/fuse/src/lib.rs +++ b/src/query/storages/fuse/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(generic_associated_types)] #![feature(type_alias_impl_trait)] #![feature(io_error_other)] #![deny(unused_crate_dependencies)] diff --git a/src/query/storages/fuse/src/operations/fuse_sink.rs b/src/query/storages/fuse/src/operations/fuse_sink.rs index 89d94e445cba7..be954ce981d6e 100644 --- a/src/query/storages/fuse/src/operations/fuse_sink.rs +++ b/src/query/storages/fuse/src/operations/fuse_sink.rs @@ -168,7 +168,7 @@ impl Processor for FuseTableSink { let index_block_schema = &bloom_index.bloom_schema; let (size, _) = serialize_data_blocks_with_compression( vec![index_block], - &index_block_schema, + index_block_schema, &mut data, CompressionOptions::Uncompressed, )?; diff --git a/src/query/storages/fuse/src/operations/read.rs b/src/query/storages/fuse/src/operations/read.rs index 69ad3f24b5b48..c7ae6abe840d5 100644 --- a/src/query/storages/fuse/src/operations/read.rs +++ b/src/query/storages/fuse/src/operations/read.rs @@ -107,7 +107,7 @@ impl FuseTable { let remain_reader = if prewhere.remain_columns.is_empty() { None } else { - Some((&*self.create_block_reader(&ctx, prewhere.remain_columns)?).clone()) + Some((*self.create_block_reader(&ctx, prewhere.remain_columns)?).clone()) }; ( diff --git a/src/query/storages/fuse/src/operations/recluster.rs b/src/query/storages/fuse/src/operations/recluster.rs index 0bd880db4bd5c..eb8dde4e64115 100644 --- a/src/query/storages/fuse/src/operations/recluster.rs +++ b/src/query/storages/fuse/src/operations/recluster.rs @@ -19,6 +19,7 @@ use common_catalog::table::Table; use common_catalog::table_context::TableContext; use common_datablocks::SortColumnDescription; use common_exception::Result; +use common_fuse_meta::meta::BlockMeta; use common_legacy_planners::Extras; use common_legacy_planners::ReadDataSourcePlan; use common_legacy_planners::SourceInfo; @@ -66,14 +67,13 @@ impl FuseTable { .await?; let default_cluster_key_id = self.cluster_key_meta.clone().unwrap().0; - - let mut blocks_map = BTreeMap::new(); + let mut blocks_map: BTreeMap> = BTreeMap::new(); block_metas.iter().for_each(|(idx, b)| { if let Some(stats) = &b.cluster_stats { if stats.cluster_key_id == default_cluster_key_id && stats.level >= 0 { blocks_map .entry(stats.level) - .or_insert(Vec::new()) + .or_default() .push((*idx, b.clone())); } } diff --git a/src/query/storages/hive-meta-store/build.rs b/src/query/storages/hive-meta-store/build.rs index 16ace54f6bf2b..e1a97db085ca3 100644 --- a/src/query/storages/hive-meta-store/build.rs +++ b/src/query/storages/hive-meta-store/build.rs @@ -42,7 +42,7 @@ fn main() { ); // thrift -out my_rust_program/src --gen rs -r Tutorial.thrift Command::new("thrift") - .args(&[ + .args([ "-out", &dest_path.as_os_str().to_string_lossy(), "-gen", diff --git a/src/query/storages/hive/src/hive_parquet_block_reader.rs b/src/query/storages/hive/src/hive_parquet_block_reader.rs index 88e2f655eee6e..ed5996af4d6fd 100644 --- a/src/query/storages/hive/src/hive_parquet_block_reader.rs +++ b/src/query/storages/hive/src/hive_parquet_block_reader.rs @@ -30,7 +30,6 @@ use common_datablocks::DataBlock; use common_datavalues::DataSchemaRef; use common_exception::ErrorCode; use common_exception::Result; -use common_legacy_planners::PartInfoPtr; use common_storages_util::file_meta_data_reader::FileMetaDataReader; use common_storages_util::retry; use common_storages_util::retry::Retryable; @@ -129,6 +128,7 @@ impl HiveParquetBlockReader { column_meta, Arc::new(|_, _| true), vec![], + usize::MAX, ); let chunk_size = if let Ok(read_buffer_size_str) = std::env::var("CHUNK_SIZE") { @@ -149,6 +149,7 @@ impl HiveParquetBlockReader { vec![&primitive_type], field, Some(chunk_size), + rows, )?) } @@ -289,9 +290,4 @@ impl HiveParquetBlockReader { .next_block(&self.projected_schema, &self.hive_partition_filler, &part) .map_err(|e| e.add_message(format!(" filename of hive part {}", part.filename))) } - - #[tracing::instrument(level = "debug", skip_all)] - pub async fn read(&self, _part: PartInfoPtr) -> Result { - Err(ErrorCode::UnImplement("deprecated")) - } } diff --git a/src/query/storages/hive/src/hive_table.rs b/src/query/storages/hive/src/hive_table.rs index c6ae2b7a56a6e..7ed580e357b12 100644 --- a/src/query/storages/hive/src/hive_table.rs +++ b/src/query/storages/hive/src/hive_table.rs @@ -535,7 +535,7 @@ mod tests { m.insert("/", "/"); for (hdfs_path, expected_path) in &m { - let path = convert_hdfs_path(*hdfs_path, true); + let path = convert_hdfs_path(hdfs_path, true); assert_eq!(path, *expected_path); } } diff --git a/src/query/storages/preludes/src/lib.rs b/src/query/storages/preludes/src/lib.rs index 4535a278460ae..72f5358de1790 100644 --- a/src/query/storages/preludes/src/lib.rs +++ b/src/query/storages/preludes/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(generic_associated_types)] #![feature(type_alias_impl_trait)] pub mod information_schema; diff --git a/src/query/storages/preludes/src/system/users_table.rs b/src/query/storages/preludes/src/system/users_table.rs index d725a135f1184..5157c1af5ff35 100644 --- a/src/query/storages/preludes/src/system/users_table.rs +++ b/src/query/storages/preludes/src/system/users_table.rs @@ -55,12 +55,7 @@ impl AsyncSystemTable for UsersTable { .collect(); let default_roles: Vec = users .iter() - .map(|x| { - x.option - .default_role() - .cloned() - .unwrap_or_else(|| "".to_string()) - }) + .map(|x| x.option.default_role().cloned().unwrap_or_default()) .collect(); Ok(DataBlock::create(self.table_info.schema(), vec![