diff --git a/.cargo/config.toml b/.cargo/config.toml index c65cd3ac1a4fa..c9165c404ef92 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -32,6 +32,3 @@ rustflags = [ # Flags for all targets. [target.'cfg(all())'] rustflags = ["--cfg", "tokio_unstable"] - -[unstable] -lints = true diff --git a/.github/workflows/nightly-rust.yml b/.github/workflows/nightly-rust.yml index eab964fafa177..5fa90ae1138c8 100644 --- a/.github/workflows/nightly-rust.yml +++ b/.github/workflows/nightly-rust.yml @@ -5,22 +5,25 @@ name: Build with Latest Nightly Rust on: schedule: - cron: "0 0 * * *" + push: + branches: + - xxchan/latest-nightly-rust workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - - name: Maximize build space - uses: easimon/maximize-build-space@master - with: - remove-dotnet: 'true' - remove-android: 'true' - remove-haskell: 'true' - remove-codeql: 'true' - remove-docker-images: 'true' - root-reserve-mb: 2048 - swap-size-mb: 8192 + - name: Maximize build space + uses: easimon/maximize-build-space@master + with: + remove-dotnet: 'true' + remove-android: 'true' + remove-haskell: 'true' + remove-codeql: 'true' + remove-docker-images: 'true' + root-reserve-mb: 10240 + temp-reserve-mb: 10240 - uses: actions/checkout@v3 if: ${{ github.event_name == 'schedule' }} with: @@ -40,3 +43,5 @@ jobs: export CARGO_INCREMENTAL=0 export CARGO_PROFILE_DEV_DEBUG=false cargo check + - name: Show available storage + run: df -h diff --git a/Cargo.lock b/Cargo.lock index 3976ba9fd1012..1f9358de037cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,9 +79,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom", "once_cell", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "const-random", @@ -314,7 +314,7 @@ version = "48.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8919668503a4f2d8b6da96fa7c16e93046bfb3412ffcfa1e5dc7d2e3adcb378" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow-arith 48.0.1", "arrow-array 48.0.1", "arrow-buffer 48.0.1", @@ -385,7 +385,7 @@ version = "48.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6eaf89041fa5937940ae390294ece29e1db584f46d995608d6e5fe65a2e0e9b" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow-buffer 48.0.1", "arrow-data 48.0.1", "arrow-schema 48.0.1", @@ -402,7 +402,7 @@ version = "50.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d390feeb7f21b78ec997a4081a025baef1e2e0d6069e181939b61864c9779609" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow-buffer 50.0.0", "arrow-data 50.0.0", "arrow-schema 50.0.0", @@ -617,7 +617,7 @@ version = "48.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5d664318bc05f930559fc088888f0f7174d3c5bc888c0f4f9ae8f23aa398ba3" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow-array 48.0.1", "arrow-buffer 48.0.1", "arrow-data 48.0.1", @@ -632,7 +632,7 @@ version = "50.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "007035e17ae09c4e8993e4cb8b5b96edf0afb927cd38e2dff27189b274d83dcf" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow-array 50.0.0", "arrow-buffer 50.0.0", "arrow-data 50.0.0", @@ -662,7 +662,7 @@ version = "48.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "374c4c3b812ecc2118727b892252a4a4308f87a8aca1dbf09f3ce4bc578e668a" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow-array 48.0.1", "arrow-buffer 48.0.1", "arrow-data 48.0.1", @@ -676,7 +676,7 @@ version = "50.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ce20973c1912de6514348e064829e50947e35977bb9d7fb637dc99ea9ffd78c" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow-array 50.0.0", "arrow-buffer 50.0.0", "arrow-data 50.0.0", @@ -866,10 +866,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", - "event-listener", + "event-listener 2.5.3", "futures-core", ] +[[package]] +name = "async-channel" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d4d23bcc79e27423727b36823d86233aad06dfea531837b038394d11e9928" +dependencies = [ + "concurrent-queue", + "event-listener 5.2.0", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + [[package]] name = "async-compression" version = "0.4.5" @@ -909,7 +922,7 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-executor", "async-io", "async-lock", @@ -945,7 +958,7 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ - "event-listener", + "event-listener 2.5.3", ] [[package]] @@ -999,7 +1012,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ "async-attributes", - "async-channel", + "async-channel 1.9.0", "async-global-executor", "async-io", "async-lock", @@ -1966,7 +1979,7 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-lock", "async-task", "atomic-waker", @@ -2648,23 +2661,21 @@ checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "const-random" -version = "0.1.15" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368a7a772ead6ce7e1de82bfb04c485f3db8ec744f72925af5735e29a22cc18e" +checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" dependencies = [ "const-random-macro", - "proc-macro-hack", ] [[package]] name = "const-random-macro" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d7d6ab3c3a2282db210df5f02c4dab6e0a7057af0fb7ebd4070f30fe05c0ddb" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ "getrandom", "once_cell", - "proc-macro-hack", "tiny-keccak", ] @@ -2876,9 +2887,9 @@ checksum = "338089f42c427b86394a5ee60ff321da23a5c89c9d89514c829687b26359fcff" [[package]] name = "crc32c" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8f48d60e5b4d2c53d5c2b1d8a58c849a70ae5e5509b08a48d047e3b65714a74" +checksum = "89254598aa9b9fa608de44b3ae54c810f0f06d755e24c50177f1f8f31ff50ce2" dependencies = [ "rustc_version 0.4.0", ] @@ -3121,9 +3132,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", @@ -3348,7 +3359,7 @@ version = "33.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "676796427e638d85e9eadf13765705212be60b34f8fc5d3934d95184c63ca1b4" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow 48.0.1", "arrow-array 48.0.1", "arrow-schema 48.0.1", @@ -3395,7 +3406,7 @@ version = "33.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31e23b3d21a6531259d291bd20ce59282ea794bda1018b0a1e278c13cd52e50c" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow 48.0.1", "arrow-array 48.0.1", "arrow-buffer 48.0.1", @@ -3435,7 +3446,7 @@ version = "33.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18e227fe88bf6730cab378d0cd8fc4c6b2ea42bc7e414a8ea9feba7225932735" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow 48.0.1", "arrow-array 48.0.1", "datafusion-common", @@ -3468,7 +3479,7 @@ version = "33.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f32b8574add16a32411a9b3fb3844ac1fc09ab4e7be289f86fd56d620e4f2508" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow 48.0.1", "arrow-array 48.0.1", "arrow-buffer 48.0.1", @@ -3503,7 +3514,7 @@ version = "33.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "796abd77d5bfecd9e5275a99daf0ec45f5b3a793ec431349ce8211a67826fd22" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow 48.0.1", "arrow-array 48.0.1", "arrow-buffer 48.0.1", @@ -4681,6 +4692,27 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "event-listener" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b5fb89194fa3cad959b833185b3063ba881dbfc7030680b314250779fb4cc91" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332f51cb23d20b0de8458b86580878211da09bcd4503cb579c225b3d124cabb3" +dependencies = [ + "event-listener 5.2.0", + "pin-project-lite", +] + [[package]] name = "expect-test" version = "1.5.0" @@ -4980,7 +5012,7 @@ version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e7321845edd6be7f1d505413409d119cddf1fc110197d1d0606fb28cbec6d28" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "anyhow", "foyer-common", "foyer-intrusive", @@ -4994,7 +5026,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deef44aeda48784c3ec1316fe64ed8d9cacbd50b37afcfd1aa211d4eb6360b61" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "bytes", "cfg-if", "crossbeam", @@ -5026,7 +5058,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28baff47d3b1e4a4d416186066ec7bd590b7b50b6332a25e62fab1686904570" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "bitflags 2.5.0", "cmsketch", "foyer-common", @@ -5046,7 +5078,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3ec3638bdc66bc1c83aba27805770d2cafd18ec553e337e2563d69a5676898b" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "allocator-api2", "anyhow", "bincode 1.3.3", @@ -5622,7 +5654,7 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b2184a5c70b994e6d77eb1c140e193e7f5fe6015e9115322fac24f7e33f003c" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-stream", "google-cloud-auth", "google-cloud-gax", @@ -5763,7 +5795,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", + "ahash 0.7.8", ] [[package]] @@ -5772,7 +5804,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", ] [[package]] @@ -5781,7 +5813,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "allocator-api2", ] @@ -6305,7 +6337,7 @@ version = "0.11.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73c0fefcb6d409a6587c07515951495d482006f89a21daa0f2f783aa4fd5e027" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "indexmap 2.0.0", "is-terminal", "itoa", @@ -6545,9 +6577,9 @@ dependencies = [ [[package]] name = "jsonbb" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2edfc17ad42a5ece82df036301d5ef0c3dc3d071e28aa8a62e461711c55d19" +checksum = "91cdcbd02ee94c68803dd808bf8406e91491eaf875f09da650f5893dc56be18c" dependencies = [ "bytes", "serde", @@ -6966,12 +6998,12 @@ dependencies = [ [[package]] name = "madsim" -version = "0.2.22" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7777a8bc4e68878b6e5433ac7b9bc196d9ccdfeef1f7cb3d23193cb997a520c9" +checksum = "c4d58385da6b81328e3e3ccb60426c0da8069a547d9979e2b11aae831089a37c" dependencies = [ - "ahash 0.7.7", - "async-channel", + "ahash 0.8.11", + "async-channel 2.2.1", "async-stream", "async-task", "bincode 1.3.3", @@ -6990,7 +7022,7 @@ dependencies = [ "spin 0.9.8", "tokio", "tokio-util", - "toml 0.7.8", + "toml 0.8.12", "tracing", "tracing-subscriber", ] @@ -7051,7 +7083,7 @@ version = "0.4.2+0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6038ceb55ecf0d80eeae01a85dc9db052f0629ca2d82732923c022185096a76c" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-trait", "futures-channel", "futures-util", @@ -8257,7 +8289,7 @@ version = "48.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bfe55df96e3f02f11bf197ae37d91bb79801631f82f6195dd196ef521df3597" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow-array 48.0.1", "arrow-buffer 48.0.1", "arrow-cast 48.0.1", @@ -8291,7 +8323,7 @@ version = "50.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "547b92ebf0c1177e3892f44c8f79757ee62e678d564a9834189725f2c5b7a750" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "arrow-array 50.0.0", "arrow-buffer 50.0.0", "arrow-cast 50.0.0", @@ -11456,7 +11488,7 @@ dependencies = [ name = "risingwave_storage" version = "1.9.0-alpha" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "anyhow", "arc-swap", "async-trait", @@ -12133,7 +12165,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "cfg-if", "hashbrown 0.13.2", ] @@ -13176,7 +13208,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "atoi", "bigdecimal 0.3.1", "byteorder", @@ -13186,7 +13218,7 @@ dependencies = [ "crossbeam-queue", "dotenvy", "either", - "event-listener", + "event-listener 2.5.3", "futures-channel", "futures-core", "futures-intrusive", @@ -13549,7 +13581,7 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630c761c74ac8021490b78578cc2223aa4a568241e26505c27bf0e4fd4ad8ec2" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "anyhow", "dashmap", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index c669e6408e5ef..c906f622258bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -154,6 +154,7 @@ deltalake = { git = "https://github.com/risingwavelabs/delta-rs", rev = "5c2dccd "gcs", ] } itertools = "0.12.0" +jsonbb = "0.1.4" lru = { git = "https://github.com/risingwavelabs/lru-rs.git", rev = "2682b85" } parquet = "50" thiserror-ext = "0.1.2" @@ -250,8 +251,11 @@ await_holding_lock = "warn" ptr_arg = "allow" # a little pedantic get_first = "allow" -# https://github.com/rust-lang/rust-clippy/issues/12016 -blocks_in_conditions = "allow" +new_without_default = "allow" +# TODO: remove later https://github.com/rust-lang/rust-clippy/issues/12537 +# duplicated_attributes = "allow" +# TODO: remove later https://github.com/rust-lang/rust-clippy/issues/12436 +mixed_attributes_style = "allow" [workspace.lints.rustdoc] private_intra_doc_links = "allow" diff --git a/ci/Dockerfile b/ci/Dockerfile index d91853232f626..616af35fd118e 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -76,7 +76,7 @@ RUN cargo binstall -y --no-symlinks cargo-llvm-cov cargo-nextest cargo-hakari ca && rm -rf "/root/.cargo/registry/index" \ && rm -rf "/root/.cargo/registry/cache" \ && rm -rf "/root/.cargo/git/db" -RUN cargo install cargo-dylint@2.6.0 dylint-link@2.6.0 +RUN cargo install cargo-dylint@3.1.0 dylint-link@3.1.0 RUN cargo uninstall cargo-binstall cargo-cache # install risedev diff --git a/ci/build-ci-image.sh b/ci/build-ci-image.sh index f9afdd4845d34..778c1a9f315d0 100755 --- a/ci/build-ci-image.sh +++ b/ci/build-ci-image.sh @@ -10,7 +10,7 @@ cat ../rust-toolchain # shellcheck disable=SC2155 # REMEMBER TO ALSO UPDATE ci/docker-compose.yml -export BUILD_ENV_VERSION=v20240424_x +export BUILD_ENV_VERSION=v20240514-1 export BUILD_TAG="public.ecr.aws/w1p7b4n3/rw-build-env:${BUILD_ENV_VERSION}" diff --git a/ci/docker-compose.yml b/ci/docker-compose.yml index 09f2888feaed4..34d629e91cf77 100644 --- a/ci/docker-compose.yml +++ b/ci/docker-compose.yml @@ -71,7 +71,7 @@ services: retries: 5 source-test-env: - image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240424_x + image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240514-1 depends_on: - mysql - db @@ -84,7 +84,7 @@ services: - ..:/risingwave sink-test-env: - image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240424_x + image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240514-1 depends_on: - mysql - db @@ -103,12 +103,12 @@ services: rw-build-env: - image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240424_x + image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240514-1 volumes: - ..:/risingwave ci-flamegraph-env: - image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240424_x + image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240514-1 # NOTE(kwannoel): This is used in order to permit # syscalls for `nperf` (perf_event_open), # so it can do CPU profiling. @@ -119,7 +119,7 @@ services: - ..:/risingwave regress-test-env: - image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240424_x + image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240514-1 depends_on: db: condition: service_healthy diff --git a/ci/rust-toolchain b/ci/rust-toolchain index b1f2df70a8d0f..92ef4a5ff27be 100644 --- a/ci/rust-toolchain +++ b/ci/rust-toolchain @@ -4,4 +4,4 @@ # 3. (optional) **follow the instructions in lints/README.md** to update the toolchain and dependencies for lints [toolchain] -channel = "nightly-2023-12-26" +channel = "nightly-2024-03-12" diff --git a/lints/Cargo.lock b/lints/Cargo.lock index b8fd465fecd7b..3ffb99c6c425e 100644 --- a/lints/Cargo.lock +++ b/lints/Cargo.lock @@ -20,6 +20,55 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" version = "1.0.75" @@ -40,9 +89,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "block-buffer" @@ -113,8 +162,8 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clippy_config" -version = "0.1.77" -source = "git+https://github.com/rust-lang/rust-clippy?rev=6fd0258e45105161b7e759a22e7350958e5cb0b1#6fd0258e45105161b7e759a22e7350958e5cb0b1" +version = "0.1.79" +source = "git+https://github.com/rust-lang/rust-clippy?rev=9d6f41691ed9dbfaec2a2df2661c42451f2fe0d3#9d6f41691ed9dbfaec2a2df2661c42451f2fe0d3" dependencies = [ "rustc-semver", "serde", @@ -123,15 +172,21 @@ dependencies = [ [[package]] name = "clippy_utils" -version = "0.1.77" -source = "git+https://github.com/rust-lang/rust-clippy?rev=6fd0258e45105161b7e759a22e7350958e5cb0b1#6fd0258e45105161b7e759a22e7350958e5cb0b1" +version = "0.1.79" +source = "git+https://github.com/rust-lang/rust-clippy?rev=9d6f41691ed9dbfaec2a2df2661c42451f2fe0d3#9d6f41691ed9dbfaec2a2df2661c42451f2fe0d3" dependencies = [ "arrayvec", "clippy_config", - "itertools 0.11.0", + "itertools", "rustc-semver", ] +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + [[package]] name = "compiletest_rs" version = "0.10.2" @@ -233,9 +288,9 @@ dependencies = [ [[package]] name = "dylint" -version = "2.6.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fdb7b800ab13925402f0048ed0911068db2e5ba6168dd93962269d4f39541d" +checksum = "4c6720f18fdd779ad137ab6bc448c11042b1b32eea625ea618c8b953660bba56" dependencies = [ "ansi_term", "anyhow", @@ -254,12 +309,13 @@ dependencies = [ [[package]] name = "dylint_internal" -version = "2.6.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5154dada2bee2a69f75f54eae57479f56f93ca1db80725a1d82cdb5fe231ef73" +checksum = "395dade88bc1a3103ef91b442498943d0072df869736a7c0107a5753c05d006f" dependencies = [ "ansi_term", "anyhow", + "bitflags 2.5.0", "cargo_metadata", "git2", "home", @@ -267,15 +323,18 @@ dependencies = [ "is-terminal", "log", "once_cell", + "regex", "rust-embed", - "sedregex", + "serde", + "thiserror", + "toml 0.8.8", ] [[package]] name = "dylint_linting" -version = "2.6.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d203baeb8770847314632f652e0e62dd7fec6a21102a116472eec0d6931f5dd9" +checksum = "3d070f934310ccf8f04a940affcce0cd196c1068b6d19c5ae6d975f926968b66" dependencies = [ "cargo_metadata", "dylint_internal", @@ -288,9 +347,9 @@ dependencies = [ [[package]] name = "dylint_testing" -version = "2.6.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1208b1f2c40fc2f3c3fa0d5631efbc7a95721d619410dc2da5b0496810d6a941" +checksum = "7fc8a64c781bde7f1e445dc1205754994012e15a2a6e659ab7166b380c1c22ab" dependencies = [ "anyhow", "cargo_metadata", @@ -310,17 +369,27 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +[[package]] +name = "env_filter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +dependencies = [ + "log", + "regex", +] + [[package]] name = "env_logger" -version = "0.10.1" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" dependencies = [ + "anstream", + "anstyle", + "env_filter", "humantime", - "is-terminal", "log", - "regex", - "termcolor", ] [[package]] @@ -402,7 +471,7 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "libc", "libgit2-sys", "log", @@ -489,13 +558,10 @@ dependencies = [ ] [[package]] -name = "itertools" -version = "0.11.0" +name = "is_terminal_polyfill" +version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" [[package]] name = "itertools" @@ -529,9 +595,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libgit2-sys" @@ -553,7 +619,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "libc", "redox_syscall 0.4.1", ] @@ -592,7 +658,7 @@ dependencies = [ "clippy_utils", "dylint_linting", "dylint_testing", - "itertools 0.12.0", + "itertools", "thiserror-ext", "tracing", ] @@ -605,9 +671,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "memchr" @@ -766,9 +832,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rust-embed" -version = "8.2.0" +version = "8.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82c0bbc10308ed323529fd3c1dce8badda635aa319a5ff0e6466f33b8101e3f" +checksum = "19549741604902eb99a7ed0ee177a0663ee1eda51a29f71401f166e47e77806a" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -777,9 +843,9 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "8.2.0" +version = "8.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6227c01b1783cdfee1bcf844eb44594cd16ec71c35305bf1c9fb5aade2735e16" +checksum = "cb9f96e283ec64401f30d3df8ee2aaeb2561f34c824381efa24a35f79bf40ee4" dependencies = [ "proc-macro2", "quote", @@ -790,9 +856,9 @@ dependencies = [ [[package]] name = "rust-embed-utils" -version = "8.2.0" +version = "8.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb0a25bfbb2d4b4402179c2cf030387d9990857ce08a32592c6238db9fa8665" +checksum = "38c74a686185620830701348de757fd36bef4aa9680fd23c49fc539ddcc1af32" dependencies = [ "globset", "sha2", @@ -819,11 +885,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.30" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -851,15 +917,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "sedregex" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19411e23596093f03bbd11dc45603b6329bb4bfec77b9fd13e2b9fc9b02efe3e" -dependencies = [ - "regex", -] - [[package]] name = "semver" version = "1.0.20" @@ -933,13 +990,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.4.1", "rustix", "windows-sys 0.52.0", ] @@ -955,15 +1011,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "termcolor" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" -dependencies = [ - "winapi-util", -] - [[package]] name = "tester" version = "0.9.1" @@ -1168,6 +1215,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "vcpkg" version = "0.2.15" @@ -1182,9 +1235,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", diff --git a/lints/Cargo.toml b/lints/Cargo.toml index 14bd09faca184..2581c1d3f0483 100644 --- a/lints/Cargo.toml +++ b/lints/Cargo.toml @@ -14,12 +14,12 @@ path = "ui/format_error.rs" # See `README.md` before bumping the version. # Remember to update the version in `ci/Dockerfile` as well. [dependencies] -clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "6fd0258e45105161b7e759a22e7350958e5cb0b1" } -dylint_linting = "2.6.0" +clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "9d6f41691ed9dbfaec2a2df2661c42451f2fe0d3" } +dylint_linting = "3.1.0" itertools = "0.12" [dev-dependencies] -dylint_testing = "2.6.0" +dylint_testing = "3.1.0" # UI test dependencies anyhow = "1" diff --git a/lints/rust-toolchain b/lints/rust-toolchain index ea1f0e928e5c3..e79f69d40f86e 100644 --- a/lints/rust-toolchain +++ b/lints/rust-toolchain @@ -1,5 +1,5 @@ # See `README.md` before bumping the version. [toolchain] -channel = "nightly-2024-01-11" +channel = "nightly-2024-03-21" components = ["llvm-tools-preview", "rustc-dev"] diff --git a/src/batch/src/executor/delete.rs b/src/batch/src/executor/delete.rs index 00b7ffb1ca519..b280197c6a603 100644 --- a/src/batch/src/executor/delete.rs +++ b/src/batch/src/executor/delete.rs @@ -195,8 +195,6 @@ mod tests { use std::sync::Arc; use futures::StreamExt; - use itertools::Itertools; - use risingwave_common::array::Array; use risingwave_common::catalog::{ schema_test_utils, ColumnDesc, ColumnId, INITIAL_TABLE_VERSION_ID, }; diff --git a/src/batch/src/executor/generic_exchange.rs b/src/batch/src/executor/generic_exchange.rs index 24ff47958dd3f..f4992ed845a0d 100644 --- a/src/batch/src/executor/generic_exchange.rs +++ b/src/batch/src/executor/generic_exchange.rs @@ -277,9 +277,8 @@ impl GenericExchangeExec #[cfg(test)] mod tests { - use futures::StreamExt; use rand::Rng; - use risingwave_common::array::{Array, DataChunk, I32Array}; + use risingwave_common::array::{Array, I32Array}; use risingwave_common::types::DataType; use super::*; diff --git a/src/batch/src/executor/group_top_n.rs b/src/batch/src/executor/group_top_n.rs index 3f11bd4430c0f..b1f4791358131 100644 --- a/src/batch/src/executor/group_top_n.rs +++ b/src/batch/src/executor/group_top_n.rs @@ -15,7 +15,6 @@ use std::marker::PhantomData; use std::mem::swap; use std::sync::Arc; -use std::vec::Vec; use futures_async_stream::try_stream; use hashbrown::HashMap; @@ -240,11 +239,9 @@ impl GroupTopNExecutor { #[cfg(test)] mod tests { use futures::stream::StreamExt; - use risingwave_common::array::DataChunk; - use risingwave_common::catalog::{Field, Schema}; + use risingwave_common::catalog::Field; use risingwave_common::metrics::LabelGuardedIntGauge; use risingwave_common::test_prelude::DataChunkTestExt; - use risingwave_common::types::DataType; use risingwave_common::util::sort_util::OrderType; use super::*; diff --git a/src/batch/src/executor/hash_agg.rs b/src/batch/src/executor/hash_agg.rs index bc487553c9b5f..c93296b0cfa98 100644 --- a/src/batch/src/executor/hash_agg.rs +++ b/src/batch/src/executor/hash_agg.rs @@ -310,7 +310,6 @@ mod tests { use std::sync::Arc; use futures_async_stream::for_await; - use risingwave_common::catalog::{Field, Schema}; use risingwave_common::metrics::LabelGuardedIntGauge; use risingwave_common::test_prelude::DataChunkTestExt; use risingwave_pb::data::data_type::TypeName; diff --git a/src/batch/src/executor/hop_window.rs b/src/batch/src/executor/hop_window.rs index d287efc4667d7..ea03d714a7978 100644 --- a/src/batch/src/executor/hop_window.rs +++ b/src/batch/src/executor/hop_window.rs @@ -209,10 +209,8 @@ impl HopWindowExecutor { #[cfg(test)] mod tests { use futures::stream::StreamExt; - use risingwave_common::array::{DataChunk, DataChunkTestExt}; - use risingwave_common::catalog::{Field, Schema}; + use risingwave_common::array::DataChunkTestExt; use risingwave_common::types::test_utils::IntervalTestExt; - use risingwave_common::types::DataType; use risingwave_expr::expr::test_utils::make_hop_window_expression; use super::*; diff --git a/src/batch/src/executor/insert.rs b/src/batch/src/executor/insert.rs index a58c6d64073db..51b247cb884be 100644 --- a/src/batch/src/executor/insert.rs +++ b/src/batch/src/executor/insert.rs @@ -264,18 +264,16 @@ impl BoxedExecutorBuilder for InsertExecutor { #[cfg(test)] mod tests { use std::ops::Bound; - use std::sync::Arc; use assert_matches::assert_matches; use foyer::CacheContext; use futures::StreamExt; - use itertools::Itertools; use risingwave_common::array::{Array, ArrayImpl, I32Array, StructArray}; use risingwave_common::catalog::{ schema_test_utils, ColumnDesc, ColumnId, INITIAL_TABLE_VERSION_ID, }; use risingwave_common::transaction::transaction_message::TxnMsg; - use risingwave_common::types::{DataType, StructType}; + use risingwave_common::types::StructType; use risingwave_dml::dml_manager::DmlManager; use risingwave_storage::hummock::CachePolicy; use risingwave_storage::memory::MemoryStateStore; diff --git a/src/batch/src/executor/join/hash_join.rs b/src/batch/src/executor/join/hash_join.rs index 7a3b51c450cda..bcba929d60c37 100644 --- a/src/batch/src/executor/join/hash_join.rs +++ b/src/batch/src/executor/join/hash_join.rs @@ -584,7 +584,7 @@ impl HashJoinExecutor { } shutdown_rx.check()?; if !ANTI_JOIN { - if hash_map.get(probe_key).is_some() { + if hash_map.contains_key(probe_key) { if let Some(spilled) = Self::append_one_probe_row( &mut chunk_builder, &probe_chunk, diff --git a/src/batch/src/executor/limit.rs b/src/batch/src/executor/limit.rs index eb57a78e1ab12..8c02ed082f2b2 100644 --- a/src/batch/src/executor/limit.rs +++ b/src/batch/src/executor/limit.rs @@ -150,8 +150,8 @@ mod tests { use std::vec; use futures_async_stream::for_await; - use risingwave_common::array::{Array, ArrayRef, BoolArray, DataChunk, PrimitiveArray}; - use risingwave_common::catalog::{Field, Schema}; + use risingwave_common::array::{Array, ArrayRef, BoolArray, PrimitiveArray}; + use risingwave_common::catalog::Field; use risingwave_common::types::DataType; use risingwave_common::util::iter_util::ZipEqDebug; diff --git a/src/batch/src/executor/merge_sort_exchange.rs b/src/batch/src/executor/merge_sort_exchange.rs index 7ebbc6379f4fd..fe8af611f0635 100644 --- a/src/batch/src/executor/merge_sort_exchange.rs +++ b/src/batch/src/executor/merge_sort_exchange.rs @@ -281,10 +281,8 @@ impl BoxedExecutorBuilder for MergeSortExchangeExecutorBuilder { #[cfg(test)] mod tests { - use std::sync::Arc; - use futures::StreamExt; - use risingwave_common::array::{Array, DataChunk}; + use risingwave_common::array::Array; use risingwave_common::test_prelude::DataChunkTestExt; use risingwave_common::types::DataType; use risingwave_common::util::sort_util::OrderType; diff --git a/src/batch/src/executor/order_by.rs b/src/batch/src/executor/order_by.rs index b8be2211c5157..fd07b4fab845e 100644 --- a/src/batch/src/executor/order_by.rs +++ b/src/batch/src/executor/order_by.rs @@ -145,8 +145,7 @@ impl SortExecutor { mod tests { use futures::StreamExt; use risingwave_common::array::*; - use risingwave_common::catalog::{Field, Schema}; - use risingwave_common::test_prelude::DataChunkTestExt; + use risingwave_common::catalog::Field; use risingwave_common::types::{ DataType, Date, Interval, Scalar, StructType, Time, Timestamp, F32, }; diff --git a/src/batch/src/executor/project.rs b/src/batch/src/executor/project.rs index fc5cddaec0787..7fbc5540b975b 100644 --- a/src/batch/src/executor/project.rs +++ b/src/batch/src/executor/project.rs @@ -108,16 +108,14 @@ impl BoxedExecutorBuilder for ProjectExecutor { #[cfg(test)] mod tests { - use futures::stream::StreamExt; use risingwave_common::array::{Array, I32Array}; - use risingwave_common::catalog::{Field, Schema}; use risingwave_common::test_prelude::*; use risingwave_common::types::DataType; use risingwave_expr::expr::{InputRefExpression, LiteralExpression}; use super::*; use crate::executor::test_utils::MockExecutor; - use crate::executor::{Executor, ValuesExecutor}; + use crate::executor::ValuesExecutor; use crate::*; const CHUNK_SIZE: usize = 1024; diff --git a/src/batch/src/executor/project_set.rs b/src/batch/src/executor/project_set.rs index b7291609be586..2d50c1039743c 100644 --- a/src/batch/src/executor/project_set.rs +++ b/src/batch/src/executor/project_set.rs @@ -174,15 +174,13 @@ impl BoxedExecutorBuilder for ProjectSetExecutor { mod tests { use futures::stream::StreamExt; use futures_async_stream::for_await; - use risingwave_common::catalog::{Field, Schema}; use risingwave_common::test_prelude::*; - use risingwave_common::types::DataType; use risingwave_expr::expr::{ExpressionBoxExt, InputRefExpression, LiteralExpression}; use risingwave_expr::table_function::repeat; use super::*; use crate::executor::test_utils::MockExecutor; - use crate::executor::{Executor, ValuesExecutor}; + use crate::executor::ValuesExecutor; use crate::*; const CHUNK_SIZE: usize = 1024; diff --git a/src/batch/src/executor/sort_agg.rs b/src/batch/src/executor/sort_agg.rs index 2f7cea6059367..bcda8773efa40 100644 --- a/src/batch/src/executor/sort_agg.rs +++ b/src/batch/src/executor/sort_agg.rs @@ -360,14 +360,12 @@ mod tests { use futures::StreamExt; use futures_async_stream::for_await; use risingwave_common::array::{Array as _, I64Array}; - use risingwave_common::catalog::{Field, Schema}; use risingwave_common::test_prelude::DataChunkTestExt; use risingwave_common::types::DataType; use risingwave_expr::expr::build_from_pretty; use super::*; use crate::executor::test_utils::MockExecutor; - use crate::task::ShutdownToken; #[tokio::test] async fn execute_count_star_int32() -> Result<()> { diff --git a/src/batch/src/executor/top_n.rs b/src/batch/src/executor/top_n.rs index c02b84ec5b7ca..4811330430682 100644 --- a/src/batch/src/executor/top_n.rs +++ b/src/batch/src/executor/top_n.rs @@ -14,7 +14,6 @@ use std::cmp::Ordering; use std::sync::Arc; -use std::vec::Vec; use futures_async_stream::try_stream; use risingwave_common::array::DataChunk; @@ -296,8 +295,8 @@ impl TopNExecutor { mod tests { use futures::stream::StreamExt; use itertools::Itertools; - use risingwave_common::array::{Array, DataChunk}; - use risingwave_common::catalog::{Field, Schema}; + use risingwave_common::array::Array; + use risingwave_common::catalog::Field; use risingwave_common::test_prelude::DataChunkTestExt; use risingwave_common::types::DataType; use risingwave_common::util::sort_util::OrderType; diff --git a/src/batch/src/executor/update.rs b/src/batch/src/executor/update.rs index 9e9c2fa8f543d..a753aef840f52 100644 --- a/src/batch/src/executor/update.rs +++ b/src/batch/src/executor/update.rs @@ -259,7 +259,6 @@ mod tests { use std::sync::Arc; use futures::StreamExt; - use risingwave_common::array::Array; use risingwave_common::catalog::{ schema_test_utils, ColumnDesc, ColumnId, INITIAL_TABLE_VERSION_ID, }; diff --git a/src/batch/src/lib.rs b/src/batch/src/lib.rs index d937c64826550..b8e6df1ac9538 100644 --- a/src/batch/src/lib.rs +++ b/src/batch/src/lib.rs @@ -25,13 +25,11 @@ #![feature(is_sorted)] #![recursion_limit = "256"] #![feature(let_chains)] -#![feature(bound_map)] #![feature(int_roundings)] #![feature(allocator_api)] #![feature(impl_trait_in_assoc_type)] #![feature(assert_matches)] #![feature(lazy_cell)] -#![feature(array_methods)] #![feature(error_generic_member_access)] #![feature(map_try_insert)] diff --git a/src/batch/src/rpc/service/task_service.rs b/src/batch/src/rpc/service/task_service.rs index 816b62a02fc4d..11ae64e7b3918 100644 --- a/src/batch/src/rpc/service/task_service.rs +++ b/src/batch/src/rpc/service/task_service.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::Into; use std::sync::Arc; use risingwave_common::util::tracing::TracingContext; diff --git a/src/batch/src/task/consistent_hash_shuffle_channel.rs b/src/batch/src/task/consistent_hash_shuffle_channel.rs index 3e42186fcf587..1181654f41249 100644 --- a/src/batch/src/task/consistent_hash_shuffle_channel.rs +++ b/src/batch/src/task/consistent_hash_shuffle_channel.rs @@ -13,7 +13,6 @@ // limitations under the License. use std::fmt::{Debug, Formatter}; -use std::option::Option; use std::sync::Arc; use anyhow::anyhow; diff --git a/src/batch/src/task/hash_shuffle_channel.rs b/src/batch/src/task/hash_shuffle_channel.rs index 3965161030a32..626324e6f3456 100644 --- a/src/batch/src/task/hash_shuffle_channel.rs +++ b/src/batch/src/task/hash_shuffle_channel.rs @@ -13,7 +13,6 @@ // limitations under the License. use std::fmt::{Debug, Formatter}; -use std::option::Option; use std::sync::Arc; use anyhow::anyhow; diff --git a/src/common/Cargo.toml b/src/common/Cargo.toml index a7072f7c79c51..1ac0752575541 100644 --- a/src/common/Cargo.toml +++ b/src/common/Cargo.toml @@ -54,7 +54,7 @@ humantime = "2.1" hytra = { workspace = true } itertools = { workspace = true } itoa = "1.0" -jsonbb = "0.1.2" +jsonbb = { workspace = true } lru = { workspace = true } memcomparable = { version = "0.2", features = ["decimal"] } num-integer = "0.1" diff --git a/src/common/estimate_size/Cargo.toml b/src/common/estimate_size/Cargo.toml index 04bcf369cc588..24cf19b3809e9 100644 --- a/src/common/estimate_size/Cargo.toml +++ b/src/common/estimate_size/Cargo.toml @@ -19,7 +19,7 @@ bytes = "1" educe = "0.5" ethnum = { version = "1", features = ["serde"] } fixedbitset = "0.5" -jsonbb = "0.1.2" +jsonbb = { workspace = true } lru = { workspace = true } risingwave_common_proc_macro = { workspace = true } rust_decimal = "1" diff --git a/src/common/estimate_size/src/collections/btreemap.rs b/src/common/estimate_size/src/collections/btreemap.rs index cf4398eb191df..84ecd687d8df1 100644 --- a/src/common/estimate_size/src/collections/btreemap.rs +++ b/src/common/estimate_size/src/collections/btreemap.rs @@ -92,7 +92,11 @@ where // [ left, [mid], right ] let mut mid_right = self.inner.split_off(start); - let mid_right_split_key = mid_right.lower_bound(Bound::Excluded(end)).key().cloned(); + let mid_right_split_key = mid_right + .lower_bound(Bound::Excluded(end)) + .peek_next() + .map(|(k, _)| k) + .cloned(); let right = if let Some(ref mid_right_split_key) = mid_right_split_key { mid_right.split_off(mid_right_split_key) } else { diff --git a/src/common/heap_profiling/src/jeprof.rs b/src/common/heap_profiling/src/jeprof.rs index b0ae0f1658c9e..6c17fed7045a5 100644 --- a/src/common/heap_profiling/src/jeprof.rs +++ b/src/common/heap_profiling/src/jeprof.rs @@ -14,7 +14,6 @@ use std::path::Path; use std::process::Command; -use std::result::Result; use std::{env, fs}; /// Error type for running `jeprof`. diff --git a/src/common/metrics/src/guarded_metrics.rs b/src/common/metrics/src/guarded_metrics.rs index 9c0919d7a420b..888dc76f73944 100644 --- a/src/common/metrics/src/guarded_metrics.rs +++ b/src/common/metrics/src/guarded_metrics.rs @@ -21,31 +21,15 @@ use std::sync::Arc; use itertools::Itertools; use parking_lot::Mutex; use prometheus::core::{ - Atomic, AtomicF64, AtomicI64, AtomicU64, Collector, Desc, GenericCounter, GenericCounterVec, - GenericGauge, GenericGaugeVec, GenericLocalCounter, MetricVec, MetricVecBuilder, + Atomic, AtomicF64, AtomicI64, AtomicU64, Collector, Desc, GenericCounter, GenericLocalCounter, + MetricVec, MetricVecBuilder, }; use prometheus::local::{LocalHistogram, LocalIntCounter}; use prometheus::proto::MetricFamily; -use prometheus::{Gauge, Histogram, HistogramVec, IntCounter, IntGauge}; +use prometheus::{Gauge, Histogram, IntCounter, IntGauge}; use thiserror_ext::AsReport; use tracing::warn; -pub fn __extract_counter_builder( - vec: GenericCounterVec

, -) -> MetricVec> { - vec -} - -pub fn __extract_gauge_builder( - vec: GenericGaugeVec

, -) -> MetricVec> { - vec -} - -pub fn __extract_histogram_builder(vec: HistogramVec) -> MetricVec { - vec -} - #[macro_export] macro_rules! register_guarded_histogram_vec_with_registry { ($NAME:expr, $HELP:expr, $LABELS_NAMES:expr, $REGISTRY:expr $(,)?) => {{ @@ -105,9 +89,35 @@ macro_rules! register_guarded_int_counter_vec_with_registry { }}; } -pub type VecBuilderOfCounter = impl MetricVecBuilder>; -pub type VecBuilderOfGauge = impl MetricVecBuilder>; -pub type VecBuilderOfHistogram = impl MetricVecBuilder; +// put TAITs in a separate module to avoid "non-defining opaque type use in defining scope" +mod tait { + use prometheus::core::{ + Atomic, GenericCounter, GenericCounterVec, GenericGauge, GenericGaugeVec, MetricVec, + MetricVecBuilder, + }; + use prometheus::{Histogram, HistogramVec}; + + pub type VecBuilderOfCounter = impl MetricVecBuilder>; + pub type VecBuilderOfGauge = impl MetricVecBuilder>; + pub type VecBuilderOfHistogram = impl MetricVecBuilder; + + pub fn __extract_counter_builder( + vec: GenericCounterVec

, + ) -> MetricVec> { + vec + } + + pub fn __extract_gauge_builder( + vec: GenericGaugeVec

, + ) -> MetricVec> { + vec + } + + pub fn __extract_histogram_builder(vec: HistogramVec) -> MetricVec { + vec + } +} +pub use tait::*; pub type LabelGuardedHistogramVec = LabelGuardedMetricVec; pub type LabelGuardedIntCounterVec = diff --git a/src/common/metrics/src/lib.rs b/src/common/metrics/src/lib.rs index a2e4156b525d1..574e684c6703b 100644 --- a/src/common/metrics/src/lib.rs +++ b/src/common/metrics/src/lib.rs @@ -15,7 +15,6 @@ #![feature(lazy_cell)] #![feature(type_alias_impl_trait)] #![feature(impl_trait_in_assoc_type)] -#![feature(array_methods)] use std::ops::Deref; use std::sync::LazyLock; diff --git a/src/common/src/acl/mod.rs b/src/common/src/acl/mod.rs index 391ad0e5781f4..b1c41bc8ec6ad 100644 --- a/src/common/src/acl/mod.rs +++ b/src/common/src/acl/mod.rs @@ -14,7 +14,6 @@ //! `Acl` defines all grantable privileges. -use std::convert::Into; use std::fmt::Formatter; use std::sync::LazyLock; diff --git a/src/common/src/array/arrow/arrow_impl.rs b/src/common/src/array/arrow/arrow_impl.rs index 514d3b299769c..773efdd088e3d 100644 --- a/src/common/src/array/arrow/arrow_impl.rs +++ b/src/common/src/array/arrow/arrow_impl.rs @@ -36,8 +36,11 @@ //! mod arrow_impl; //! ``` +// Is this a bug? Why do we have these lints? +#![allow(unused_imports)] +#![allow(dead_code)] + use std::fmt::Write; -use std::sync::Arc; use arrow_buffer::OffsetBuffer; use chrono::{NaiveDateTime, NaiveTime}; @@ -47,7 +50,6 @@ use itertools::Itertools; use super::{arrow_array, arrow_buffer, arrow_cast, arrow_schema}; // Other import should always use the absolute path. use crate::array::*; -use crate::buffer::Bitmap; use crate::types::*; use crate::util::iter_util::ZipEqFast; diff --git a/src/common/src/array/arrow/arrow_udf.rs b/src/common/src/array/arrow/arrow_udf.rs index 5a44ef1439619..83383044f506d 100644 --- a/src/common/src/array/arrow/arrow_udf.rs +++ b/src/common/src/array/arrow/arrow_udf.rs @@ -124,11 +124,8 @@ impl FromArrow for UdfArrowConvert { #[cfg(test)] mod tests { - use std::sync::Arc; - use super::*; use crate::array::*; - use crate::buffer::Bitmap; #[test] fn struct_array() { diff --git a/src/common/src/array/data_chunk.rs b/src/common/src/array/data_chunk.rs index 6d5b2247979ca..7fb908ecc138f 100644 --- a/src/common/src/array/data_chunk.rs +++ b/src/common/src/array/data_chunk.rs @@ -13,10 +13,10 @@ // limitations under the License. use std::borrow::Cow; +use std::fmt; use std::fmt::Display; use std::hash::BuildHasher; use std::sync::Arc; -use std::{fmt, usize}; use bytes::Bytes; use either::Either; diff --git a/src/common/src/array/primitive_array.rs b/src/common/src/array/primitive_array.rs index 9840ba68135c5..29c7bfb49289a 100644 --- a/src/common/src/array/primitive_array.rs +++ b/src/common/src/array/primitive_array.rs @@ -315,7 +315,6 @@ impl ArrayBuilder for PrimitiveArrayBuilder { #[cfg(test)] mod tests { use super::*; - use crate::types::{F32, F64}; fn helper_test_builder(data: Vec>) -> PrimitiveArray { let mut builder = PrimitiveArrayBuilder::::new(data.len()); diff --git a/src/common/src/array/proto_reader.rs b/src/common/src/array/proto_reader.rs index b0b133d1b2df0..073ad0b3de7ba 100644 --- a/src/common/src/array/proto_reader.rs +++ b/src/common/src/array/proto_reader.rs @@ -17,16 +17,10 @@ use std::io::{Cursor, Read}; use anyhow::Context; use byteorder::{BigEndian, ReadBytesExt}; use paste::paste; -use risingwave_pb::data::{PbArray, PbArrayType}; +use risingwave_pb::data::PbArrayType; use super::*; use crate::array::value_reader::{PrimitiveValueReader, VarSizedValueReader}; -use crate::array::{ - Array, ArrayBuilder, ArrayImpl, ArrayResult, BoolArray, DateArrayBuilder, IntervalArrayBuilder, - PrimitiveArrayBuilder, PrimitiveArrayItemType, TimeArrayBuilder, TimestampArrayBuilder, -}; -use crate::buffer::Bitmap; -use crate::types::{Date, Interval, Time, Timestamp}; impl ArrayImpl { pub fn from_protobuf(array: &PbArray, cardinality: usize) -> ArrayResult { @@ -252,12 +246,6 @@ fn read_string_array>( #[cfg(test)] mod tests { use super::*; - use crate::array::{ - Array, ArrayBuilder, BoolArray, BoolArrayBuilder, DateArray, DateArrayBuilder, - DecimalArray, DecimalArrayBuilder, I32Array, I32ArrayBuilder, TimeArray, TimeArrayBuilder, - TimestampArray, TimestampArrayBuilder, Utf8Array, Utf8ArrayBuilder, - }; - use crate::types::{Date, Decimal, Time, Timestamp}; // Convert a column to protobuf, then convert it back to column, and ensures the two are // identical. diff --git a/src/common/src/cache.rs b/src/common/src/cache.rs index 99a373d6a94a8..bb4af1d615eb9 100644 --- a/src/common/src/cache.rs +++ b/src/common/src/cache.rs @@ -1019,14 +1019,12 @@ impl Clone for CacheableEntry { #[cfg(test)] mod tests { use std::collections::hash_map::DefaultHasher; - use std::hash::{Hash, Hasher}; + use std::hash::Hasher; use std::pin::Pin; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering::Relaxed; - use std::sync::Arc; use std::task::{Context, Poll}; - use futures::FutureExt; use rand::rngs::SmallRng; use rand::{RngCore, SeedableRng}; use tokio::sync::oneshot::error::TryRecvError; diff --git a/src/common/src/config.rs b/src/common/src/config.rs index 2aaff2f500c39..41a4e1415b301 100644 --- a/src/common/src/config.rs +++ b/src/common/src/config.rs @@ -2081,8 +2081,6 @@ pub struct CompactionConfig { #[cfg(test)] mod tests { - use std::collections::BTreeMap; - use super::*; /// This test ensures that `config/example.toml` is up-to-date with the default values specified diff --git a/src/common/src/field_generator/varchar.rs b/src/common/src/field_generator/varchar.rs index c4af1499620ca..9f68bcb287c46 100644 --- a/src/common/src/field_generator/varchar.rs +++ b/src/common/src/field_generator/varchar.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::string::ToString; - use rand::distributions::Alphanumeric; use rand::rngs::StdRng; use rand::{Rng, SeedableRng}; diff --git a/src/common/src/hash/consistent_hash/mapping.rs b/src/common/src/hash/consistent_hash/mapping.rs index c542ab2050cf1..07e62b7eac275 100644 --- a/src/common/src/hash/consistent_hash/mapping.rs +++ b/src/common/src/hash/consistent_hash/mapping.rs @@ -335,7 +335,6 @@ mod tests { use rand::Rng; use super::*; - use crate::util::iter_util::ZipEqDebug; struct Test; impl VnodeMappingItem for Test { diff --git a/src/common/src/hash/consistent_hash/vnode.rs b/src/common/src/hash/consistent_hash/vnode.rs index 9bc49a9372ac0..fc6dac0978adf 100644 --- a/src/common/src/hash/consistent_hash/vnode.rs +++ b/src/common/src/hash/consistent_hash/vnode.rs @@ -169,7 +169,6 @@ mod tests { use super::*; use crate::array::DataChunkTestExt; use crate::row::OwnedRow; - use crate::types::ScalarImpl; use crate::util::row_id::RowIdGenerator; #[test] diff --git a/src/common/src/hash/key.rs b/src/common/src/hash/key.rs index c136710edb23f..4911e041370a9 100644 --- a/src/common/src/hash/key.rs +++ b/src/common/src/hash/key.rs @@ -21,7 +21,6 @@ //! are encoded from both `t.b` and `t.c`. If `t.b="abc"` and `t.c=1`, the hashkey may be //! encoded in certain format of `("abc", 1)`. -use std::convert::TryInto; use std::default::Default; use std::fmt::Debug; use std::hash::{BuildHasher, Hasher}; @@ -643,11 +642,9 @@ mod tests { DateArray, DecimalArray, F32Array, F64Array, I16Array, I32Array, I32ArrayBuilder, I64Array, TimeArray, TimestampArray, Utf8Array, }; - use crate::hash::{ - HashKey, Key128, Key16, Key256, Key32, Key64, KeySerialized, PrecomputedBuildHasher, - }; + use crate::hash::{HashKey, Key128, Key16, Key256, Key32, Key64, KeySerialized}; use crate::test_utils::rand_array::seed_rand_array_ref; - use crate::types::{DataType, Datum}; + use crate::types::Datum; #[derive(Hash, PartialEq, Eq)] struct Row(Vec); diff --git a/src/common/src/lib.rs b/src/common/src/lib.rs index ea3cd4a4f7102..c30b12ba4cf2d 100644 --- a/src/common/src/lib.rs +++ b/src/common/src/lib.rs @@ -34,16 +34,14 @@ #![feature(inline_const_pat)] #![allow(incomplete_features)] #![feature(iterator_try_collect)] -#![feature(round_ties_even)] #![feature(iter_order_by)] #![feature(exclusive_range_pattern)] #![feature(binary_heap_into_iter_sorted)] #![feature(impl_trait_in_assoc_type)] #![feature(map_entry_replace)] #![feature(negative_impls)] -#![feature(bound_map)] -#![feature(array_methods)] #![feature(register_tool)] +#![feature(btree_cursors)] #![register_tool(rw)] #[cfg_attr(not(test), allow(unused_extern_crates))] diff --git a/src/common/src/row/owned_row.rs b/src/common/src/row/owned_row.rs index 8ea3803538d84..15a01d192a64c 100644 --- a/src/common/src/row/owned_row.rs +++ b/src/common/src/row/owned_row.rs @@ -182,7 +182,7 @@ mod tests { use super::*; use crate::row::RowExt; - use crate::types::{DataType as Ty, Interval, ScalarImpl}; + use crate::types::DataType as Ty; use crate::util::hash_util::Crc32FastBuilder; #[test] diff --git a/src/common/src/system_param/mod.rs b/src/common/src/system_param/mod.rs index 06d4cce2e4e6b..f71324cb4e55d 100644 --- a/src/common/src/system_param/mod.rs +++ b/src/common/src/system_param/mod.rs @@ -77,10 +77,10 @@ macro_rules! for_all_params { { barrier_interval_ms, u32, Some(1000_u32), true, "The interval of periodic barrier.", }, { checkpoint_frequency, u64, Some(1_u64), true, "There will be a checkpoint for every n barriers.", }, { sstable_size_mb, u32, Some(256_u32), false, "Target size of the Sstable.", }, - { parallel_compact_size_mb, u32, Some(512_u32), false, "", }, + { parallel_compact_size_mb, u32, Some(512_u32), false, "The size of parallel task for one compact/flush job.", }, { block_size_kb, u32, Some(64_u32), false, "Size of each block in bytes in SST.", }, { bloom_false_positive, f64, Some(0.001_f64), false, "False positive probability of bloom filter.", }, - { state_store, String, None, false, "", }, + { state_store, String, None, false, "URL for the state store", }, { data_directory, String, None, false, "Remote directory for storing data and metadata objects.", }, { backup_storage_url, String, None, true, "Remote storage url for storing snapshots.", }, { backup_storage_directory, String, None, true, "Remote directory for storing snapshots.", }, diff --git a/src/common/src/types/interval.rs b/src/common/src/types/interval.rs index 4436181059d78..495561561e937 100644 --- a/src/common/src/types/interval.rs +++ b/src/common/src/types/interval.rs @@ -22,15 +22,12 @@ use std::sync::LazyLock; use byteorder::{BigEndian, NetworkEndian, ReadBytesExt, WriteBytesExt}; use bytes::BytesMut; -use chrono::Timelike; use num_traits::{CheckedAdd, CheckedNeg, CheckedSub, Zero}; -use postgres_types::{to_sql_checked, FromSql}; +use postgres_types::to_sql_checked; use regex::Regex; -use risingwave_common_estimate_size::ZeroHeapSize; use risingwave_pb::data::PbInterval; use rust_decimal::prelude::Decimal; -use super::to_binary::ToBinary; use super::*; /// Every interval can be represented by a `Interval`. diff --git a/src/common/src/types/mod.rs b/src/common/src/types/mod.rs index 9364f438cfacf..bb41e75c8a4f8 100644 --- a/src/common/src/types/mod.rs +++ b/src/common/src/types/mod.rs @@ -17,7 +17,6 @@ // NOTE: When adding or modifying data types, remember to update the type matrix in // src/expr/macro/src/types.rs -use std::convert::TryFrom; use std::fmt::Debug; use std::hash::Hash; use std::str::FromStr; diff --git a/src/common/src/types/num256.rs b/src/common/src/types/num256.rs index 43c97fd8b155a..2acbcf636a037 100644 --- a/src/common/src/types/num256.rs +++ b/src/common/src/types/num256.rs @@ -335,7 +335,6 @@ impl EstimateSize for Int256 { #[cfg(test)] mod tests { use super::*; - use crate::types::F64; macro_rules! check_op { ($t:ty, $lhs:expr, $rhs:expr, [$($op:tt),+]) => { diff --git a/src/common/src/types/ordered.rs b/src/common/src/types/ordered.rs index 77a0588e06672..bb2b0c9f316c1 100644 --- a/src/common/src/types/ordered.rs +++ b/src/common/src/types/ordered.rs @@ -14,7 +14,7 @@ //! `ScalarImpl` and `Datum` wrappers that implement `PartialOrd` and `Ord` with default order type. -use std::cmp::{Ord, Ordering}; +use std::cmp::Ordering; use std::ops::Deref; use risingwave_common_estimate_size::EstimateSize; diff --git a/src/common/src/types/scalar_impl.rs b/src/common/src/types/scalar_impl.rs index db2732ca67c48..d222473fa6bbb 100644 --- a/src/common/src/types/scalar_impl.rs +++ b/src/common/src/types/scalar_impl.rs @@ -15,8 +15,6 @@ use std::hash::Hasher; use super::*; -use crate::array::list_array::{ListRef, ListValue}; -use crate::array::struct_array::{StructRef, StructValue}; use crate::{dispatch_scalar_ref_variants, dispatch_scalar_variants, for_all_native_types}; /// `ScalarPartialOrd` allows comparison between `Scalar` and `ScalarRef`. diff --git a/src/common/src/util/memcmp_encoding.rs b/src/common/src/util/memcmp_encoding.rs index 5709d42d226f8..7f262d0ff8d2c 100644 --- a/src/common/src/util/memcmp_encoding.rs +++ b/src/common/src/util/memcmp_encoding.rs @@ -333,15 +333,12 @@ pub fn decode_row( mod tests { use std::ops::Neg; - use itertools::Itertools; use rand::thread_rng; use super::*; - use crate::array::{DataChunk, ListValue, StructValue}; - use crate::row::{OwnedRow, RowExt}; - use crate::types::{DataType, FloatExt, ScalarImpl, F32}; - use crate::util::iter_util::ZipEqFast; - use crate::util::sort_util::{ColumnOrder, OrderType}; + use crate::array::{ListValue, StructValue}; + use crate::row::RowExt; + use crate::types::FloatExt; #[test] fn test_memcomparable() { diff --git a/src/common/src/util/panic.rs b/src/common/src/util/panic.rs index 43db76df4f768..517a040e03b09 100644 --- a/src/common/src/util/panic.rs +++ b/src/common/src/util/panic.rs @@ -71,8 +71,8 @@ pub fn is_catching_unwind() -> bool { } #[cfg(all(test, not(madsim)))] +#[expect(clippy::disallowed_methods)] mod tests { - #![allow(clippy::disallowed_methods)] use rusty_fork::rusty_fork_test; diff --git a/src/common/src/util/sort_util.rs b/src/common/src/util/sort_util.rs index 015222136d382..ff4bde652496d 100644 --- a/src/common/src/util/sort_util.rs +++ b/src/common/src/util/sort_util.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::cmp::{Ord, Ordering}; +use std::cmp::Ordering; use std::fmt; use std::sync::Arc; @@ -574,13 +574,11 @@ pub fn cmp_rows(lhs: impl Row, rhs: impl Row, order_types: &[OrderType]) -> Orde #[cfg(test)] mod tests { - use std::cmp::Ordering; - use itertools::Itertools; use super::*; - use crate::array::{DataChunk, ListValue, StructValue}; - use crate::row::{OwnedRow, Row}; + use crate::array::{ListValue, StructValue}; + use crate::row::OwnedRow; use crate::types::{DataType, Datum, ScalarImpl}; #[test] diff --git a/src/common/src/util/value_encoding/column_aware_row_encoding.rs b/src/common/src/util/value_encoding/column_aware_row_encoding.rs index 28fcb65c4d8db..1bfbc0c926410 100644 --- a/src/common/src/util/value_encoding/column_aware_row_encoding.rs +++ b/src/common/src/util/value_encoding/column_aware_row_encoding.rs @@ -26,7 +26,6 @@ use bitflags::bitflags; use super::*; use crate::catalog::ColumnId; -use crate::row::Row; // deprecated design of have a Width to represent number of datum // may be considered should `ColumnId` representation be optimized diff --git a/src/common/src/util/value_encoding/mod.rs b/src/common/src/util/value_encoding/mod.rs index 57e21c3782aa0..aa80c15617048 100644 --- a/src/common/src/util/value_encoding/mod.rs +++ b/src/common/src/util/value_encoding/mod.rs @@ -20,7 +20,7 @@ use either::{for_both, Either}; use enum_as_inner::EnumAsInner; use risingwave_pb::data::PbDatum; -use crate::array::{ArrayImpl, ListRef, ListValue, StructRef, StructValue}; +use crate::array::ArrayImpl; use crate::row::{Row, RowDeserializer as BasicDeserializer}; use crate::types::*; diff --git a/src/compute/src/lib.rs b/src/compute/src/lib.rs index 2c25f7808d93d..87f052470ea7d 100644 --- a/src/compute/src/lib.rs +++ b/src/compute/src/lib.rs @@ -87,7 +87,7 @@ pub struct ComputeNodeOpts { pub total_memory_bytes: usize, /// Reserved memory for the compute node in bytes. - /// If not set, a portion (default to 30%) for the total_memory_bytes will be used as the reserved memory. + /// If not set, a portion (default to 30%) for the `total_memory_bytes` will be used as the reserved memory. /// /// The total memory compute and storage can use is `total_memory_bytes` - `reserved_memory_bytes`. #[clap(long, env = "RW_RESERVED_MEMORY_BYTES")] diff --git a/src/compute/src/rpc/service/config_service.rs b/src/compute/src/rpc/service/config_service.rs index 97793f71722c9..e827ef176413e 100644 --- a/src/compute/src/rpc/service/config_service.rs +++ b/src/compute/src/rpc/service/config_service.rs @@ -18,7 +18,6 @@ use risingwave_common::error::tonic::ToTonicStatus; use risingwave_pb::compute::config_service_server::ConfigService; use risingwave_pb::compute::{ShowConfigRequest, ShowConfigResponse}; use risingwave_stream::task::LocalStreamManager; -use serde_json; use tonic::{Code, Request, Response, Status}; pub struct ConfigServiceImpl { diff --git a/src/compute/src/telemetry.rs b/src/compute/src/telemetry.rs index 143ec51c5bc39..c35a6063ae267 100644 --- a/src/compute/src/telemetry.rs +++ b/src/compute/src/telemetry.rs @@ -33,6 +33,7 @@ impl ComputeTelemetryCreator { #[async_trait::async_trait] impl TelemetryReportCreator for ComputeTelemetryCreator { + #[allow(refining_impl_trait)] async fn create_report( &self, tracking_id: String, diff --git a/src/config/docs.md b/src/config/docs.md index aa5cab015c7ee..d8f551f96fdf4 100644 --- a/src/config/docs.md +++ b/src/config/docs.md @@ -155,7 +155,7 @@ This page is automatically generated by `./risedev generate-example-config` | data_directory | Remote directory for storing data and metadata objects. | | | enable_tracing | Whether to enable distributed tracing. | false | | max_concurrent_creating_streaming_jobs | Max number of concurrent creating streaming jobs. | 1 | -| parallel_compact_size_mb | | 512 | +| parallel_compact_size_mb | The size of parallel task for one compact/flush job. | 512 | | pause_on_next_bootstrap | Whether to pause all data sources on next bootstrap. | false | | sstable_size_mb | Target size of the Sstable. | 256 | -| state_store | | | +| state_store | URL for the state store | | diff --git a/src/connector/src/parser/avro/parser.rs b/src/connector/src/parser/avro/parser.rs index 65601d9c3a3e6..c1950313b5e5c 100644 --- a/src/connector/src/parser/avro/parser.rs +++ b/src/connector/src/parser/avro/parser.rs @@ -182,8 +182,8 @@ mod test { use std::path::PathBuf; use apache_avro::schema::RecordSchema; - use apache_avro::types::{Record, Value}; - use apache_avro::{Codec, Days, Duration, Millis, Months, Reader, Schema, Writer}; + use apache_avro::types::Record; + use apache_avro::{Codec, Days, Duration, Millis, Months, Writer}; use itertools::Itertools; use risingwave_common::array::Op; use risingwave_common::catalog::ColumnId; @@ -195,12 +195,9 @@ mod test { use super::*; use crate::connector_common::AwsAuthProps; - use crate::error::ConnectorResult; use crate::parser::plain_parser::PlainParser; use crate::parser::unified::avro::unix_epoch_days; - use crate::parser::{ - AccessBuilderImpl, EncodingType, SourceStreamChunkBuilder, SpecificParserConfig, - }; + use crate::parser::{AccessBuilderImpl, SourceStreamChunkBuilder, SpecificParserConfig}; use crate::source::{SourceColumnDesc, SourceContext}; fn test_data_path(file_name: &str) -> String { diff --git a/src/connector/src/parser/canal/simd_json_parser.rs b/src/connector/src/parser/canal/simd_json_parser.rs index 9bc236392eb48..ac8a63a6457e7 100644 --- a/src/connector/src/parser/canal/simd_json_parser.rs +++ b/src/connector/src/parser/canal/simd_json_parser.rs @@ -141,7 +141,6 @@ mod tests { use super::*; use crate::parser::SourceStreamChunkBuilder; - use crate::source::SourceColumnDesc; #[tokio::test] async fn test_data_types() { diff --git a/src/connector/src/parser/debezium/avro_parser.rs b/src/connector/src/parser/debezium/avro_parser.rs index 29d9139d221cf..3b11a1926f107 100644 --- a/src/connector/src/parser/debezium/avro_parser.rs +++ b/src/connector/src/parser/debezium/avro_parser.rs @@ -139,7 +139,6 @@ mod tests { use std::io::Read; use std::path::PathBuf; - use apache_avro::Schema; use itertools::Itertools; use maplit::{convert_args, hashmap}; use risingwave_common::array::Op; @@ -151,9 +150,7 @@ mod tests { use risingwave_pb::plan_common::{PbEncodeType, PbFormatType}; use super::*; - use crate::parser::{ - DebeziumAvroParserConfig, DebeziumParser, SourceStreamChunkBuilder, SpecificParserConfig, - }; + use crate::parser::{DebeziumParser, SourceStreamChunkBuilder, SpecificParserConfig}; use crate::source::{SourceColumnDesc, SourceContext}; const DEBEZIUM_AVRO_DATA: &[u8] = b"\x00\x00\x00\x00\x06\x00\x02\xd2\x0f\x0a\x53\x61\x6c\x6c\x79\x0c\x54\x68\x6f\x6d\x61\x73\x2a\x73\x61\x6c\x6c\x79\x2e\x74\x68\x6f\x6d\x61\x73\x40\x61\x63\x6d\x65\x2e\x63\x6f\x6d\x16\x32\x2e\x31\x2e\x32\x2e\x46\x69\x6e\x61\x6c\x0a\x6d\x79\x73\x71\x6c\x12\x64\x62\x73\x65\x72\x76\x65\x72\x31\xc0\xb4\xe8\xb7\xc9\x61\x00\x30\x66\x69\x72\x73\x74\x5f\x69\x6e\x5f\x64\x61\x74\x61\x5f\x63\x6f\x6c\x6c\x65\x63\x74\x69\x6f\x6e\x12\x69\x6e\x76\x65\x6e\x74\x6f\x72\x79\x00\x02\x12\x63\x75\x73\x74\x6f\x6d\x65\x72\x73\x00\x00\x20\x6d\x79\x73\x71\x6c\x2d\x62\x69\x6e\x2e\x30\x30\x30\x30\x30\x33\x8c\x06\x00\x00\x00\x02\x72\x02\x92\xc3\xe8\xb7\xc9\x61\x00"; diff --git a/src/connector/src/parser/debezium/simd_json_parser.rs b/src/connector/src/parser/debezium/simd_json_parser.rs index 63cb939d81238..dff681687bc47 100644 --- a/src/connector/src/parser/debezium/simd_json_parser.rs +++ b/src/connector/src/parser/debezium/simd_json_parser.rs @@ -99,8 +99,6 @@ impl AccessBuilder for DebeziumMongoJsonAccessBuilder { #[cfg(test)] mod tests { - use std::convert::TryInto; - use chrono::{NaiveDate, NaiveTime}; use risingwave_common::array::{Op, StructValue}; use risingwave_common::catalog::ColumnId; diff --git a/src/connector/src/parser/protobuf/parser.rs b/src/connector/src/parser/protobuf/parser.rs index e9ae317ca5ebc..7dcb502b1f674 100644 --- a/src/connector/src/parser/protobuf/parser.rs +++ b/src/connector/src/parser/protobuf/parser.rs @@ -583,7 +583,7 @@ mod test { use std::path::PathBuf; use prost::Message; - use risingwave_common::types::{DataType, ListValue, StructType}; + use risingwave_common::types::StructType; use risingwave_pb::catalog::StreamSourceInfo; use risingwave_pb::data::data_type::PbTypeName; use risingwave_pb::plan_common::{PbEncodeType, PbFormatType}; diff --git a/src/connector/src/parser/unified/avro.rs b/src/connector/src/parser/unified/avro.rs index 4e7d134f42554..257ca2926c342 100644 --- a/src/connector/src/parser/unified/avro.rs +++ b/src/connector/src/parser/unified/avro.rs @@ -431,7 +431,7 @@ pub(crate) fn unix_epoch_days() -> i32 { #[cfg(test)] mod tests { use apache_avro::Decimal as AvroDecimal; - use risingwave_common::types::{Decimal, Timestamptz}; + use risingwave_common::types::Decimal; use super::*; diff --git a/src/connector/src/sink/encoder/avro.rs b/src/connector/src/sink/encoder/avro.rs index 924beb281eda7..20d8a0997a7ff 100644 --- a/src/connector/src/sink/encoder/avro.rs +++ b/src/connector/src/sink/encoder/avro.rs @@ -526,7 +526,7 @@ mod tests { test_ok( &DataType::Int64, - Some(ScalarImpl::Int64(std::i64::MAX)), + Some(ScalarImpl::Int64(i64::MAX)), r#""long""#, Value::Long(i64::MAX), ); diff --git a/src/connector/src/sink/encoder/json.rs b/src/connector/src/sink/encoder/json.rs index 6eb7ca5cd1b50..2ee8bfcc0d27c 100644 --- a/src/connector/src/sink/encoder/json.rs +++ b/src/connector/src/sink/encoder/json.rs @@ -436,8 +436,8 @@ fn type_as_json_schema(rw_type: &DataType) -> Map { mod tests { use risingwave_common::types::{ - DataType, Date, Decimal, Interval, Scalar, ScalarImpl, StructRef, StructType, StructValue, - Time, Timestamp, + Date, Decimal, Interval, Scalar, ScalarImpl, StructRef, StructType, StructValue, Time, + Timestamp, }; use super::*; @@ -485,7 +485,7 @@ mod tests { data_type: DataType::Int64, ..mock_field.clone() }, - Some(ScalarImpl::Int64(std::i64::MAX).as_scalar_ref_impl()), + Some(ScalarImpl::Int64(i64::MAX).as_scalar_ref_impl()), DateHandlingMode::FromCe, TimestampHandlingMode::String, TimestamptzHandlingMode::UtcString, @@ -495,7 +495,7 @@ mod tests { .unwrap(); assert_eq!( serde_json::to_string(&int64_value).unwrap(), - std::i64::MAX.to_string() + i64::MAX.to_string() ); // https://github.com/debezium/debezium/blob/main/debezium-core/src/main/java/io/debezium/time/ZonedTimestamp.java diff --git a/src/connector/src/sink/redis.rs b/src/connector/src/sink/redis.rs index 9da1d8b4d3f03..6baeccdd32ed8 100644 --- a/src/connector/src/sink/redis.rs +++ b/src/connector/src/sink/redis.rs @@ -378,8 +378,8 @@ mod test { use std::collections::BTreeMap; use rdkafka::message::FromBytes; - use risingwave_common::array::{Array, I32Array, Op, StreamChunk, Utf8Array}; - use risingwave_common::catalog::{Field, Schema}; + use risingwave_common::array::{Array, I32Array, Op, Utf8Array}; + use risingwave_common::catalog::Field; use risingwave_common::types::DataType; use risingwave_common::util::iter_util::ZipEqDebug; diff --git a/src/connector/src/sink/remote.rs b/src/connector/src/sink/remote.rs index 679434d08b194..63fc60ecc4510 100644 --- a/src/connector/src/sink/remote.rs +++ b/src/connector/src/sink/remote.rs @@ -166,7 +166,7 @@ impl Sink for RemoteSink { async fn validate_remote_sink(param: &SinkParam, sink_name: &str) -> ConnectorResult<()> { if sink_name == ElasticSearchSink::SINK_NAME && param.downstream_pk.len() > 1 - && param.properties.get(ES_OPTION_DELIMITER).is_none() + && !param.properties.contains_key(ES_OPTION_DELIMITER) { bail!("Es sink only support single pk or pk with delimiter option"); } diff --git a/src/connector/src/sink/snowflake_connector.rs b/src/connector/src/sink/snowflake_connector.rs index eee4af2258b09..ee1cb90b70a52 100644 --- a/src/connector/src/sink/snowflake_connector.rs +++ b/src/connector/src/sink/snowflake_connector.rs @@ -19,7 +19,6 @@ use std::time::{SystemTime, UNIX_EPOCH}; use anyhow::{anyhow, Context}; use jsonwebtoken::{encode, Algorithm, EncodingKey, Header}; use reqwest::{header, Client, RequestBuilder, StatusCode}; -use risingwave_common::config::ObjectStoreConfig; use risingwave_object_store::object::*; use serde::{Deserialize, Serialize}; diff --git a/src/connector/src/source/cdc/external/mock_external_table.rs b/src/connector/src/source/cdc/external/mock_external_table.rs index fcfb1505225ea..7242f5614d409 100644 --- a/src/connector/src/source/cdc/external/mock_external_table.rs +++ b/src/connector/src/source/cdc/external/mock_external_table.rs @@ -86,7 +86,7 @@ impl MockExternalTableReader { ]), ]; - let snapshots = vec![snap0]; + let snapshots = [snap0]; if snap_idx >= snapshots.len() { return Ok(()); } diff --git a/src/connector/src/source/filesystem/opendal_source/opendal_enumerator.rs b/src/connector/src/source/filesystem/opendal_source/opendal_enumerator.rs index 96646ade0e1df..f65eacd9a9696 100644 --- a/src/connector/src/source/filesystem/opendal_source/opendal_enumerator.rs +++ b/src/connector/src/source/filesystem/opendal_source/opendal_enumerator.rs @@ -56,10 +56,7 @@ impl SplitEnumerator for OpendalEnumerator { impl OpendalEnumerator { pub async fn list(&self) -> ConnectorResult { - let prefix = match &self.prefix { - Some(prefix) => prefix, - None => "", - }; + let prefix = self.prefix.as_deref().unwrap_or(""); let object_lister = self .op diff --git a/src/connector/src/source/kafka/mod.rs b/src/connector/src/source/kafka/mod.rs index 0f16108bb5c82..4c560d30ecce6 100644 --- a/src/connector/src/source/kafka/mod.rs +++ b/src/connector/src/source/kafka/mod.rs @@ -195,8 +195,6 @@ impl RdKafkaPropertiesConsumer { #[cfg(test)] mod test { - use std::collections::HashMap; - use maplit::hashmap; use super::*; diff --git a/src/connector/src/source/kinesis/enumerator/client.rs b/src/connector/src/source/kinesis/enumerator/client.rs index b8966f99ae1ac..840def08f6855 100644 --- a/src/connector/src/source/kinesis/enumerator/client.rs +++ b/src/connector/src/source/kinesis/enumerator/client.rs @@ -19,7 +19,7 @@ use aws_sdk_kinesis::Client as kinesis_client; use risingwave_common::bail; use crate::error::ConnectorResult as Result; -use crate::source::kinesis::split::{KinesisOffset, KinesisSplit}; +use crate::source::kinesis::split::KinesisOffset; use crate::source::kinesis::*; use crate::source::{SourceEnumeratorContextRef, SplitEnumerator}; diff --git a/src/connector/src/source/kinesis/mod.rs b/src/connector/src/source/kinesis/mod.rs index 019cefb500643..de393a5121961 100644 --- a/src/connector/src/source/kinesis/mod.rs +++ b/src/connector/src/source/kinesis/mod.rs @@ -65,8 +65,6 @@ impl crate::source::UnknownFields for KinesisProperties { #[cfg(test)] mod test { - use std::collections::HashMap; - use maplit::hashmap; use super::*; diff --git a/src/connector/src/source/kinesis/source/reader.rs b/src/connector/src/source/kinesis/source/reader.rs index c9026428d1df0..4504324c5fb96 100644 --- a/src/connector/src/source/kinesis/source/reader.rs +++ b/src/connector/src/source/kinesis/source/reader.rs @@ -24,7 +24,6 @@ use aws_sdk_kinesis::Client as KinesisClient; use futures_async_stream::try_stream; use risingwave_common::bail; use thiserror_ext::AsReport; -use tokio_retry; use crate::error::ConnectorResult as Result; use crate::parser::ParserConfig; @@ -306,7 +305,6 @@ mod tests { use super::*; use crate::connector_common::KinesisCommon; - use crate::source::kinesis::split::KinesisSplit; use crate::source::SourceContext; #[tokio::test] diff --git a/src/connector/src/source/nats/source/message.rs b/src/connector/src/source/nats/source/message.rs index 3944cd6bd4c71..55c91457d4bfc 100644 --- a/src/connector/src/source/nats/source/message.rs +++ b/src/connector/src/source/nats/source/message.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use async_nats; use async_nats::jetstream::Message; use crate::source::base::SourceMessage; diff --git a/src/connector/src/source/nexmark/source/reader.rs b/src/connector/src/source/nexmark/source/reader.rs index 6441baa154ae4..d1f10f4a00fc6 100644 --- a/src/connector/src/source/nexmark/source/reader.rs +++ b/src/connector/src/source/nexmark/source/reader.rs @@ -210,7 +210,7 @@ impl NexmarkSplitReader { #[cfg(test)] mod tests { use super::*; - use crate::source::nexmark::{NexmarkProperties, NexmarkSplitEnumerator}; + use crate::source::nexmark::NexmarkSplitEnumerator; use crate::source::{SourceContext, SourceEnumeratorContext, SplitEnumerator}; #[tokio::test] diff --git a/src/ctl/src/cmd_impl/compute.rs b/src/ctl/src/cmd_impl/compute.rs index 0150c00058773..ff519efcfffa7 100644 --- a/src/ctl/src/cmd_impl/compute.rs +++ b/src/ctl/src/cmd_impl/compute.rs @@ -11,12 +11,10 @@ // 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. -use std::convert::TryFrom; use risingwave_common::config::{BatchConfig, StreamingConfig}; use risingwave_common::util::addr::HostAddr; use risingwave_rpc_client::ComputeClient; -use serde_json; pub async fn show_config(host: &str) -> anyhow::Result<()> { let listen_addr = HostAddr::try_from(host)?; diff --git a/src/ctl/src/cmd_impl/meta/reschedule.rs b/src/ctl/src/cmd_impl/meta/reschedule.rs index 64d3e229c9112..8d0a45be842fb 100644 --- a/src/ctl/src/cmd_impl/meta/reschedule.rs +++ b/src/ctl/src/cmd_impl/meta/reschedule.rs @@ -24,7 +24,6 @@ use risingwave_pb::meta::get_reschedule_plan_request::PbPolicy; use risingwave_pb::meta::table_fragments::ActorStatus; use risingwave_pb::meta::{GetClusterInfoResponse, GetReschedulePlanResponse, Reschedule}; use serde::{Deserialize, Serialize}; -use serde_yaml; use thiserror_ext::AsReport; use crate::CtlContext; diff --git a/src/ctl/src/cmd_impl/scale/resize.rs b/src/ctl/src/cmd_impl/scale/resize.rs index 6ef0b3c15d7e1..6b990c7865519 100644 --- a/src/ctl/src/cmd_impl/scale/resize.rs +++ b/src/ctl/src/cmd_impl/scale/resize.rs @@ -24,7 +24,6 @@ use risingwave_pb::meta::get_reschedule_plan_request::{ use risingwave_pb::meta::update_worker_node_schedulability_request::Schedulability; use risingwave_pb::meta::{GetClusterInfoResponse, GetReschedulePlanResponse}; use risingwave_stream::task::FragmentId; -use serde_yaml; use thiserror_ext::AsReport; use crate::cmd_impl::meta::ReschedulePayload; diff --git a/src/dml/src/dml_manager.rs b/src/dml/src/dml_manager.rs index f6611b6c94c21..d3502f1f9d2de 100644 --- a/src/dml/src/dml_manager.rs +++ b/src/dml/src/dml_manager.rs @@ -170,7 +170,6 @@ mod tests { use risingwave_common::array::StreamChunk; use risingwave_common::catalog::INITIAL_TABLE_VERSION_ID; use risingwave_common::test_prelude::StreamChunkTestExt; - use risingwave_common::transaction::transaction_id::TxnId; use risingwave_common::types::DataType; use super::*; diff --git a/src/dml/src/table.rs b/src/dml/src/table.rs index 4981ebce2e8a3..a5d0ecf8c23a4 100644 --- a/src/dml/src/table.rs +++ b/src/dml/src/table.rs @@ -283,14 +283,11 @@ impl TableStreamReader { #[cfg(test)] mod tests { - use std::sync::Arc; - use assert_matches::assert_matches; use futures::StreamExt; use itertools::Itertools; - use risingwave_common::array::{Array, I64Array, Op, StreamChunk}; + use risingwave_common::array::{Array, I64Array, Op}; use risingwave_common::catalog::ColumnId; - use risingwave_common::transaction::transaction_id::TxnId; use risingwave_common::types::DataType; use super::*; diff --git a/src/error/src/macros.rs b/src/error/src/macros.rs index b3079aa281ce9..16a11d2dba4d6 100644 --- a/src/error/src/macros.rs +++ b/src/error/src/macros.rs @@ -149,9 +149,6 @@ pub use must_match; #[cfg(test)] mod ensure_tests { - use std::convert::Into; - use std::result::Result::Err; - use anyhow::anyhow; use thiserror::Error; diff --git a/src/expr/core/src/expr/and_or.rs b/src/expr/core/src/expr/and_or.rs index fac820a61b5b3..f265a8a208d29 100644 --- a/src/expr/core/src/expr/and_or.rs +++ b/src/expr/core/src/expr/and_or.rs @@ -142,9 +142,6 @@ fn or(l: Option, r: Option) -> Option { #[cfg(test)] mod tests { - use risingwave_common::array::DataChunk; - use risingwave_common::test_prelude::DataChunkTestExt; - use super::*; use crate::expr::build_from_pretty; diff --git a/src/expr/core/src/expr/expr_literal.rs b/src/expr/core/src/expr/expr_literal.rs index ff6fdb79197a2..e85e6f03af6d7 100644 --- a/src/expr/core/src/expr/expr_literal.rs +++ b/src/expr/core/src/expr/expr_literal.rs @@ -96,7 +96,6 @@ mod tests { use risingwave_pb::data::{PbDataType, PbDatum}; use risingwave_pb::expr::expr_node::RexNode::{self, Constant}; use risingwave_pb::expr::expr_node::Type; - use risingwave_pb::expr::ExprNode; use super::*; diff --git a/src/expr/core/src/expr/expr_some_all.rs b/src/expr/core/src/expr/expr_some_all.rs index 9250aa6d877cf..3f7bc7abbc9f5 100644 --- a/src/expr/core/src/expr/expr_some_all.rs +++ b/src/expr/core/src/expr/expr_some_all.rs @@ -272,7 +272,6 @@ impl Build for SomeAllExpression { #[cfg(test)] mod tests { - use risingwave_common::array::DataChunk; use risingwave_common::row::Row; use risingwave_common::test_prelude::DataChunkTestExt; use risingwave_common::types::ToOwnedDatum; diff --git a/src/expr/core/src/table_function/user_defined.rs b/src/expr/core/src/table_function/user_defined.rs index bf8354df0ea4b..79b14a126f10d 100644 --- a/src/expr/core/src/table_function/user_defined.rs +++ b/src/expr/core/src/table_function/user_defined.rs @@ -24,7 +24,7 @@ use arrow_udf_js_deno::{CallMode as DenoCallMode, Runtime as DenoRuntime}; use arrow_udf_python::{CallMode as PythonCallMode, Runtime as PythonRuntime}; use cfg_or_panic::cfg_or_panic; use risingwave_common::array::arrow::{FromArrow, ToArrow, UdfArrowConvert}; -use risingwave_common::array::{DataChunk, I32Array}; +use risingwave_common::array::I32Array; use risingwave_common::bail; use super::*; diff --git a/src/expr/impl/Cargo.toml b/src/expr/impl/Cargo.toml index 437fcad7cbac3..c20c46436e6fc 100644 --- a/src/expr/impl/Cargo.toml +++ b/src/expr/impl/Cargo.toml @@ -32,7 +32,7 @@ futures-util = "0.3" hex = "0.4" icelake = { workspace = true } itertools = { workspace = true } -jsonbb = "0.1.2" +jsonbb = { workspace = true } linkme = { version = "0.3", features = ["used_linker"] } md5 = "0.7" num-traits = "0.2" diff --git a/src/expr/impl/benches/expr.rs b/src/expr/impl/benches/expr.rs index 8468ae86e241b..e04bc9faee35e 100644 --- a/src/expr/impl/benches/expr.rs +++ b/src/expr/impl/benches/expr.rs @@ -29,7 +29,6 @@ use risingwave_common::types::*; use risingwave_expr::aggregate::{build_append_only, AggArgs, AggCall, AggKind}; use risingwave_expr::expr::*; use risingwave_expr::sig::FUNCTION_REGISTRY; -use risingwave_expr::ExprError; use risingwave_pb::expr::expr_node::PbType; use thiserror_ext::AsReport; diff --git a/src/expr/impl/src/aggregate/general.rs b/src/expr/impl/src/aggregate/general.rs index 2ee55f0a16d52..8c006377642bf 100644 --- a/src/expr/impl/src/aggregate/general.rs +++ b/src/expr/impl/src/aggregate/general.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::From; - use num_traits::{CheckedAdd, CheckedSub}; use risingwave_expr::{aggregate, ExprError, Result}; diff --git a/src/expr/impl/src/lib.rs b/src/expr/impl/src/lib.rs index a47754cb4e821..5bc4a758b42a1 100644 --- a/src/expr/impl/src/lib.rs +++ b/src/expr/impl/src/lib.rs @@ -27,7 +27,6 @@ #![feature(iterator_try_collect)] #![feature(exclusive_range_pattern)] #![feature(lazy_cell)] -#![feature(round_ties_even)] #![feature(coroutines)] #![feature(test)] #![feature(iter_array_chunks)] diff --git a/src/expr/impl/src/scalar/arithmetic_op.rs b/src/expr/impl/src/scalar/arithmetic_op.rs index ad5fe8497d8bb..e48b0b5e94b59 100644 --- a/src/expr/impl/src/scalar/arithmetic_op.rs +++ b/src/expr/impl/src/scalar/arithmetic_op.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::TryInto; use std::fmt::Debug; use chrono::{Duration, NaiveDateTime}; @@ -443,9 +442,7 @@ mod tests { use num_traits::Float; use risingwave_common::types::test_utils::IntervalTestExt; - use risingwave_common::types::{ - Date, Decimal, Int256, Int256Ref, Interval, Scalar, Timestamp, F32, F64, - }; + use risingwave_common::types::{Int256, Int256Ref, Scalar, F32}; use super::*; diff --git a/src/expr/impl/src/scalar/bitwise_op.rs b/src/expr/impl/src/scalar/bitwise_op.rs index 38aa4d194ea60..0d7f14bb6965a 100644 --- a/src/expr/impl/src/scalar/bitwise_op.rs +++ b/src/expr/impl/src/scalar/bitwise_op.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. use std::any::type_name; -use std::convert::TryInto; use std::fmt::Debug; use std::ops::{BitAnd, BitOr, BitXor, Not}; diff --git a/src/expr/impl/src/scalar/case.rs b/src/expr/impl/src/scalar/case.rs index 99ec8cb880ddc..f7fb9d89ef41b 100644 --- a/src/expr/impl/src/scalar/case.rs +++ b/src/expr/impl/src/scalar/case.rs @@ -285,7 +285,6 @@ fn build_case_expr( #[cfg(test)] mod tests { - use risingwave_common::row::Row; use risingwave_common::test_prelude::DataChunkTestExt; use risingwave_common::types::ToOwnedDatum; use risingwave_common::util::iter_util::ZipEqDebug; diff --git a/src/expr/impl/src/scalar/cast.rs b/src/expr/impl/src/scalar/cast.rs index cb990bdcec6a7..48218d7200809 100644 --- a/src/expr/impl/src/scalar/cast.rs +++ b/src/expr/impl/src/scalar/cast.rs @@ -244,11 +244,9 @@ fn struct_cast(input: StructRef<'_>, ctx: &Context) -> Result { #[cfg(test)] mod tests { use chrono::NaiveDateTime; - use itertools::Itertools; use risingwave_common::array::*; use risingwave_common::types::*; use risingwave_expr::expr::build_from_pretty; - use risingwave_pb::expr::expr_node::PbType; use super::*; diff --git a/src/expr/impl/src/scalar/cmp.rs b/src/expr/impl/src/scalar/cmp.rs index 69dfcb5f57ef3..02c1662f18025 100644 --- a/src/expr/impl/src/scalar/cmp.rs +++ b/src/expr/impl/src/scalar/cmp.rs @@ -519,7 +519,7 @@ mod tests { use risingwave_common::array::*; use risingwave_common::row::OwnedRow; use risingwave_common::types::test_utils::IntervalTestExt; - use risingwave_common::types::{Date, Interval, Scalar}; + use risingwave_common::types::{Date, Interval}; use risingwave_pb::expr::expr_node::Type; use crate::scalar::arithmetic_op::{date_interval_add, date_interval_sub}; diff --git a/src/expr/impl/src/scalar/proctime.rs b/src/expr/impl/src/scalar/proctime.rs index 2e96e602633cb..2c3c2c651c3df 100644 --- a/src/expr/impl/src/scalar/proctime.rs +++ b/src/expr/impl/src/scalar/proctime.rs @@ -25,7 +25,6 @@ fn proctime() -> Result { #[cfg(test)] mod tests { - use risingwave_common::types::Timestamptz; use risingwave_common::util::epoch::{Epoch, EpochPair}; use super::*; diff --git a/src/expr/impl/src/scalar/round.rs b/src/expr/impl/src/scalar/round.rs index a43dd425e13c3..90c9512c6c9b2 100644 --- a/src/expr/impl/src/scalar/round.rs +++ b/src/expr/impl/src/scalar/round.rs @@ -73,9 +73,6 @@ pub fn round_decimal(input: Decimal) -> Decimal { mod tests { use std::str::FromStr; - use risingwave_common::types::{Decimal, F64}; - - use super::ceil_f64; use crate::scalar::round::*; fn do_test(input: &str, digits: i32, expected_output: Option<&str>) { diff --git a/src/expr/impl/src/scalar/trigonometric.rs b/src/expr/impl/src/scalar/trigonometric.rs index 705ee8f3eeba2..20e2b3523716b 100644 --- a/src/expr/impl/src/scalar/trigonometric.rs +++ b/src/expr/impl/src/scalar/trigonometric.rs @@ -362,7 +362,7 @@ pub fn radians_f64(input: F64) -> F64 { mod tests { use std::f64::consts::PI; - use risingwave_common::types::{FloatExt, F64}; + use risingwave_common::types::FloatExt; use crate::scalar::trigonometric::*; diff --git a/src/frontend/Cargo.toml b/src/frontend/Cargo.toml index 6a09101dc3e59..3decb8535ca67 100644 --- a/src/frontend/Cargo.toml +++ b/src/frontend/Cargo.toml @@ -41,7 +41,7 @@ futures-async-stream = { workspace = true } iana-time-zone = "0.1" icelake = { workspace = true } itertools = { workspace = true } -jsonbb = "0.1.2" +jsonbb = { workspace = true } linkme = { version = "0.3", features = ["used_linker"] } maplit = "1" md5 = "0.7.0" diff --git a/src/frontend/src/binder/expr/value.rs b/src/frontend/src/binder/expr/value.rs index 0b6eace27083f..a0758a15d4440 100644 --- a/src/frontend/src/binder/expr/value.rs +++ b/src/frontend/src/binder/expr/value.rs @@ -221,13 +221,12 @@ impl Binder { #[cfg(test)] mod tests { use risingwave_common::types::test_utils::IntervalTestExt; - use risingwave_common::types::DataType; use risingwave_expr::expr::build_from_prost; use risingwave_sqlparser::ast::Value::Number; use super::*; use crate::binder::test_utils::mock_binder; - use crate::expr::{Expr, ExprImpl, ExprType, FunctionCall}; + use crate::expr::Expr; #[tokio::test] async fn test_bind_value() { diff --git a/src/frontend/src/binder/insert.rs b/src/frontend/src/binder/insert.rs index 1cc719d066420..e0b5ce422e75a 100644 --- a/src/frontend/src/binder/insert.rs +++ b/src/frontend/src/binder/insert.rs @@ -175,14 +175,14 @@ impl Binder { // is given and it is NOT equivalent to assignment cast over potential implicit cast inside. // For example, the following is valid: // - // ``` + // ```sql // create table t (v1 time); // insert into t values (timestamp '2020-01-01 01:02:03'), (time '03:04:05'); // ``` // // But the followings are not: // - // ``` + // ```sql // values (timestamp '2020-01-01 01:02:03'), (time '03:04:05'); // insert into t values (timestamp '2020-01-01 01:02:03'), (time '03:04:05') limit 1; // ``` diff --git a/src/frontend/src/binder/relation/join.rs b/src/frontend/src/binder/relation/join.rs index c2f820aff7744..d13b683be08b0 100644 --- a/src/frontend/src/binder/relation/join.rs +++ b/src/frontend/src/binder/relation/join.rs @@ -164,10 +164,10 @@ impl Binder { JoinConstraint::Using(cols) => { // sanity check for col in &cols { - if old_context.indices_of.get(&col.real_value()).is_none() { + if !old_context.indices_of.contains_key(&col.real_value()) { return Err(ErrorCode::ItemNotFound(format!("column \"{}\" specified in USING clause does not exist in left table", col.real_value())).into()); } - if self.context.indices_of.get(&col.real_value()).is_none() { + if !self.context.indices_of.contains_key(&col.real_value()) { return Err(ErrorCode::ItemNotFound(format!("column \"{}\" specified in USING clause does not exist in right table", col.real_value())).into()); } } diff --git a/src/frontend/src/binder/relation/table_function.rs b/src/frontend/src/binder/relation/table_function.rs index 9189e176e0d55..efb4de3c55510 100644 --- a/src/frontend/src/binder/relation/table_function.rs +++ b/src/frontend/src/binder/relation/table_function.rs @@ -143,7 +143,7 @@ impl Binder { // Note: named return value should take precedence over table alias. // But we don't support it yet. // e.g., - // ``` + // ```sql // > create function foo(ret out int) language sql as 'select 1'; // > select t.ret from foo() as t; // ``` diff --git a/src/frontend/src/binder/values.rs b/src/frontend/src/binder/values.rs index 93f9e3f4f8a18..9e190c3cf4dc5 100644 --- a/src/frontend/src/binder/values.rs +++ b/src/frontend/src/binder/values.rs @@ -154,7 +154,7 @@ impl Binder { #[cfg(test)] mod tests { - use risingwave_common::util::iter_util::{zip_eq_fast, ZipEqFast}; + use risingwave_common::util::iter_util::zip_eq_fast; use risingwave_sqlparser::ast::{Expr, Value}; use super::*; diff --git a/src/frontend/src/catalog/system_catalog/rw_catalog/rw_iceberg_files.rs b/src/frontend/src/catalog/system_catalog/rw_catalog/rw_iceberg_files.rs index 7afe2561e1775..73c88b58ba5f7 100644 --- a/src/frontend/src/catalog/system_catalog/rw_catalog/rw_iceberg_files.rs +++ b/src/frontend/src/catalog/system_catalog/rw_catalog/rw_iceberg_files.rs @@ -44,7 +44,7 @@ struct RwIcebergFiles { /// Total file size in bytes pub file_size_in_bytes: i64, /// Field ids used to determine row equality in equality delete files. - /// Required when content is EqualityDeletes and should be null + /// Required when content is `EqualityDeletes` and should be null /// otherwise. Fields with ids listed in this column must be present /// in the delete file pub equality_ids: Option>, diff --git a/src/frontend/src/catalog/table_catalog.rs b/src/frontend/src/catalog/table_catalog.rs index 9b02402571d0f..d66e01bac1dc1 100644 --- a/src/frontend/src/catalog/table_catalog.rs +++ b/src/frontend/src/catalog/table_catalog.rs @@ -595,19 +595,15 @@ impl OwnedByUserCatalog for TableCatalog { #[cfg(test)] mod tests { - use risingwave_common::catalog::{ - row_id_column_desc, ColumnCatalog, ColumnDesc, ColumnId, TableId, - }; + use risingwave_common::catalog::{row_id_column_desc, ColumnDesc, ColumnId}; use risingwave_common::test_prelude::*; use risingwave_common::types::*; use risingwave_common::util::sort_util::OrderType; - use risingwave_pb::catalog::{PbStreamJobStatus, PbTable}; use risingwave_pb::plan_common::{ AdditionalColumn, ColumnDescVersion, PbColumnCatalog, PbColumnDesc, }; use super::*; - use crate::catalog::table_catalog::{TableCatalog, TableType}; #[test] fn test_into_table_catalog() { diff --git a/src/frontend/src/handler/create_function.rs b/src/frontend/src/handler/create_function.rs index 471145a12a3e4..c6cafdea37fa7 100644 --- a/src/frontend/src/handler/create_function.rs +++ b/src/frontend/src/handler/create_function.rs @@ -15,15 +15,12 @@ use anyhow::Context; use arrow_schema::Fields; use bytes::Bytes; -use itertools::Itertools; -use pgwire::pg_response::StatementType; use risingwave_common::array::arrow::{ToArrow, UdfArrowConvert}; use risingwave_common::catalog::FunctionId; use risingwave_common::types::DataType; use risingwave_expr::expr::{get_or_create_flight_client, get_or_create_wasm_runtime}; use risingwave_pb::catalog::function::{Kind, ScalarFunction, TableFunction}; use risingwave_pb::catalog::Function; -use risingwave_sqlparser::ast::{CreateFunctionBody, ObjectName, OperateFunctionArg}; use super::*; use crate::catalog::CatalogError; diff --git a/src/frontend/src/handler/create_sink.rs b/src/frontend/src/handler/create_sink.rs index 803c1de034ebb..b81a40f6d5759 100644 --- a/src/frontend/src/handler/create_sink.rs +++ b/src/frontend/src/handler/create_sink.rs @@ -556,7 +556,7 @@ fn check_cycle_for_sink( path.push(table.name.clone()); self.visit_table(table.as_ref(), target_table_id, path)?; path.pop(); - } else if self.source_index.get(&table_id.table_id).is_some() { + } else if self.source_index.contains_key(&table_id.table_id) { continue; } else { bail!("streaming job not found: {:?}", table_id); diff --git a/src/frontend/src/handler/create_source.rs b/src/frontend/src/handler/create_source.rs index 4ead8066a2736..1dd5a879354cf 100644 --- a/src/frontend/src/handler/create_source.rs +++ b/src/frontend/src/handler/create_source.rs @@ -1695,7 +1695,7 @@ pub mod tests { ); // Options are not merged into props. - assert!(source.with_properties.get("schema.location").is_none()); + assert!(!source.with_properties.contains_key("schema.location")); } #[tokio::test] diff --git a/src/frontend/src/handler/create_sql_function.rs b/src/frontend/src/handler/create_sql_function.rs index ae7b2730e25d5..a9ac2f394c68f 100644 --- a/src/frontend/src/handler/create_sql_function.rs +++ b/src/frontend/src/handler/create_sql_function.rs @@ -15,15 +15,10 @@ use std::collections::HashMap; use fancy_regex::Regex; -use itertools::Itertools; -use pgwire::pg_response::StatementType; use risingwave_common::catalog::FunctionId; use risingwave_common::types::DataType; use risingwave_pb::catalog::function::{Kind, ScalarFunction, TableFunction}; use risingwave_pb::catalog::Function; -use risingwave_sqlparser::ast::{ - CreateFunctionBody, FunctionDefinition, ObjectName, OperateFunctionArg, -}; use risingwave_sqlparser::parser::{Parser, ParserError}; use super::*; diff --git a/src/frontend/src/handler/create_table.rs b/src/frontend/src/handler/create_table.rs index 3689d30d3793f..41415d5987676 100644 --- a/src/frontend/src/handler/create_table.rs +++ b/src/frontend/src/handler/create_table.rs @@ -1192,15 +1192,10 @@ pub async fn generate_stream_graph_for_table( #[cfg(test)] mod tests { - use std::collections::HashMap; - - use risingwave_common::catalog::{ - Field, DEFAULT_DATABASE_NAME, DEFAULT_SCHEMA_NAME, ROWID_PREFIX, - }; + use risingwave_common::catalog::{Field, DEFAULT_DATABASE_NAME, ROWID_PREFIX}; use risingwave_common::types::DataType; use super::*; - use crate::catalog::root_catalog::SchemaPath; use crate::test_utils::{create_proto_file, LocalFrontend, PROTO_FILE_DATA}; #[test] @@ -1417,6 +1412,6 @@ mod tests { ); // Options are not merged into props. - assert!(source.with_properties.get("schema.location").is_none()); + assert!(!source.with_properties.contains_key("schema.location")); } } diff --git a/src/frontend/src/handler/drop_function.rs b/src/frontend/src/handler/drop_function.rs index 61eaa8d0c0ad0..bd6ad11b7d5c5 100644 --- a/src/frontend/src/handler/drop_function.rs +++ b/src/frontend/src/handler/drop_function.rs @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use pgwire::pg_response::StatementType; -use risingwave_sqlparser::ast::{FunctionDesc, ReferentialAction}; - use super::*; use crate::catalog::root_catalog::SchemaPath; use crate::catalog::CatalogError; diff --git a/src/frontend/src/handler/show.rs b/src/frontend/src/handler/show.rs index 9f7b357201d6f..6a1261b871f77 100644 --- a/src/frontend/src/handler/show.rs +++ b/src/frontend/src/handler/show.rs @@ -29,7 +29,6 @@ use risingwave_pb::catalog::connection; use risingwave_sqlparser::ast::{ display_comma_separated, Ident, ObjectName, ShowCreateType, ShowObject, ShowStatementFilter, }; -use serde_json; use super::{fields_to_descriptors, RwPgResponse, RwPgResponseBuilderExt}; use crate::binder::{Binder, Relation}; diff --git a/src/frontend/src/handler/util.rs b/src/frontend/src/handler/util.rs index 33392049fce3a..7fd4f0b92822b 100644 --- a/src/frontend/src/handler/util.rs +++ b/src/frontend/src/handler/util.rs @@ -231,10 +231,8 @@ pub fn convert_logstore_u64_to_unix_millis(logstore_u64: u64) -> u64 { #[cfg(test)] mod tests { - use bytes::BytesMut; use postgres_types::{ToSql, Type}; use risingwave_common::array::*; - use risingwave_common::types::Timestamptz; use super::*; diff --git a/src/frontend/src/lib.rs b/src/frontend/src/lib.rs index 9435b2952f2d2..2c0eac6d0ad88 100644 --- a/src/frontend/src/lib.rs +++ b/src/frontend/src/lib.rs @@ -32,7 +32,6 @@ #![feature(impl_trait_in_assoc_type)] #![feature(result_flattening)] #![feature(error_generic_member_access)] -#![feature(round_ties_even)] #![feature(iterator_try_collect)] #![feature(used_with_arg)] #![feature(entry_insert)] diff --git a/src/frontend/src/optimizer/logical_optimization.rs b/src/frontend/src/optimizer/logical_optimization.rs index 14fa66be68d5f..1c73245a0afcf 100644 --- a/src/frontend/src/optimizer/logical_optimization.rs +++ b/src/frontend/src/optimizer/logical_optimization.rs @@ -732,8 +732,8 @@ impl LogicalOptimizer { // Do a final column pruning and predicate pushing down to clean up the plan. plan = Self::column_pruning(plan, explain_trace, &ctx); if last_total_rule_applied_before_predicate_pushdown != ctx.total_rule_applied() { - #[allow(unused_assignments)] - last_total_rule_applied_before_predicate_pushdown = ctx.total_rule_applied(); + (#[allow(unused_assignments)] + last_total_rule_applied_before_predicate_pushdown) = ctx.total_rule_applied(); plan = Self::predicate_pushdown(plan, explain_trace, &ctx); } diff --git a/src/frontend/src/optimizer/mod.rs b/src/frontend/src/optimizer/mod.rs index 67b265e02d3a2..44ec95054d9a1 100644 --- a/src/frontend/src/optimizer/mod.rs +++ b/src/frontend/src/optimizer/mod.rs @@ -1099,11 +1099,7 @@ fn require_additional_exchange_on_root_in_local_mode(plan: PlanRef) -> bool { #[cfg(test)] mod tests { - use risingwave_common::catalog::Field; - use risingwave_common::types::DataType; - use super::*; - use crate::optimizer::optimizer_context::OptimizerContext; use crate::optimizer::plan_node::LogicalValues; #[tokio::test] diff --git a/src/frontend/src/optimizer/optimizer_context.rs b/src/frontend/src/optimizer/optimizer_context.rs index eb6e410378749..78a0bba8317d7 100644 --- a/src/frontend/src/optimizer/optimizer_context.rs +++ b/src/frontend/src/optimizer/optimizer_context.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use core::convert::Into; use core::fmt::Formatter; use std::cell::{RefCell, RefMut}; use std::marker::PhantomData; diff --git a/src/frontend/src/optimizer/plan_node/batch_delete.rs b/src/frontend/src/optimizer/plan_node/batch_delete.rs index 62499a495d1de..8980f58a9e2c4 100644 --- a/src/frontend/src/optimizer/plan_node/batch_delete.rs +++ b/src/frontend/src/optimizer/plan_node/batch_delete.rs @@ -22,7 +22,6 @@ use super::{ }; use crate::error::Result; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; -use crate::optimizer::plan_node::generic::PhysicalPlanRef; use crate::optimizer::plan_node::{utils, ToLocalBatch}; use crate::optimizer::plan_visitor::DistributedDmlVisitor; use crate::optimizer::property::{Distribution, Order, RequiredDist}; diff --git a/src/frontend/src/optimizer/plan_node/batch_hash_agg.rs b/src/frontend/src/optimizer/plan_node/batch_hash_agg.rs index af5f4c4accbb6..341d1281009eb 100644 --- a/src/frontend/src/optimizer/plan_node/batch_hash_agg.rs +++ b/src/frontend/src/optimizer/plan_node/batch_hash_agg.rs @@ -17,7 +17,7 @@ use risingwave_pb::batch_plan::plan_node::NodeBody; use risingwave_pb::batch_plan::HashAggNode; use super::batch::prelude::*; -use super::generic::{self, GenericPlanRef, PlanAggCall}; +use super::generic::{self, PlanAggCall}; use super::utils::impl_distill_by_unit; use super::{ ExprRewritable, PlanBase, PlanNodeType, PlanRef, PlanTreeNodeUnary, ToBatchPb, diff --git a/src/frontend/src/optimizer/plan_node/batch_hash_join.rs b/src/frontend/src/optimizer/plan_node/batch_hash_join.rs index 8b92f722490d5..399817336e4ca 100644 --- a/src/frontend/src/optimizer/plan_node/batch_hash_join.rs +++ b/src/frontend/src/optimizer/plan_node/batch_hash_join.rs @@ -18,10 +18,9 @@ use risingwave_pb::batch_plan::HashJoinNode; use risingwave_pb::plan_common::JoinType; use super::batch::prelude::*; -use super::generic::{self, GenericPlanRef}; use super::utils::{childless_record, Distill}; use super::{ - EqJoinPredicate, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeBinary, ToBatchPb, + generic, EqJoinPredicate, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeBinary, ToBatchPb, ToDistributedBatch, }; use crate::error::Result; diff --git a/src/frontend/src/optimizer/plan_node/batch_insert.rs b/src/frontend/src/optimizer/plan_node/batch_insert.rs index 1dbe387bb708f..8a3e511efc83c 100644 --- a/src/frontend/src/optimizer/plan_node/batch_insert.rs +++ b/src/frontend/src/optimizer/plan_node/batch_insert.rs @@ -18,7 +18,6 @@ use risingwave_pb::batch_plan::InsertNode; use risingwave_pb::plan_common::{DefaultColumns, IndexAndExpr}; use super::batch::prelude::*; -use super::generic::GenericPlanRef; use super::utils::{childless_record, Distill}; use super::{generic, ExprRewritable, PlanRef, PlanTreeNodeUnary, ToBatchPb, ToDistributedBatch}; use crate::error::Result; diff --git a/src/frontend/src/optimizer/plan_node/batch_limit.rs b/src/frontend/src/optimizer/plan_node/batch_limit.rs index 1dfe9215be1ea..ef717d179130e 100644 --- a/src/frontend/src/optimizer/plan_node/batch_limit.rs +++ b/src/frontend/src/optimizer/plan_node/batch_limit.rs @@ -16,7 +16,6 @@ use risingwave_pb::batch_plan::plan_node::NodeBody; use risingwave_pb::batch_plan::LimitNode; use super::batch::prelude::*; -use super::generic::PhysicalPlanRef; use super::utils::impl_distill_by_unit; use super::{ generic, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, ToBatchPb, ToDistributedBatch, diff --git a/src/frontend/src/optimizer/plan_node/batch_lookup_join.rs b/src/frontend/src/optimizer/plan_node/batch_lookup_join.rs index a20b4ad316cd7..a181c590e0e65 100644 --- a/src/frontend/src/optimizer/plan_node/batch_lookup_join.rs +++ b/src/frontend/src/optimizer/plan_node/batch_lookup_join.rs @@ -18,9 +18,8 @@ use risingwave_pb::batch_plan::plan_node::NodeBody; use risingwave_pb::batch_plan::{DistributedLookupJoinNode, LocalLookupJoinNode}; use super::batch::prelude::*; -use super::generic::{self, GenericPlanRef}; use super::utils::{childless_record, Distill}; -use super::ExprRewritable; +use super::{generic, ExprRewritable}; use crate::error::Result; use crate::expr::{Expr, ExprRewriter, ExprVisitor}; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; diff --git a/src/frontend/src/optimizer/plan_node/batch_max_one_row.rs b/src/frontend/src/optimizer/plan_node/batch_max_one_row.rs index 94b8b3e6e0483..e35d6976672c4 100644 --- a/src/frontend/src/optimizer/plan_node/batch_max_one_row.rs +++ b/src/frontend/src/optimizer/plan_node/batch_max_one_row.rs @@ -17,7 +17,7 @@ use risingwave_pb::batch_plan::plan_node::NodeBody; use risingwave_pb::batch_plan::MaxOneRowNode; use super::batch::prelude::*; -use super::generic::{DistillUnit, PhysicalPlanRef}; +use super::generic::DistillUnit; use super::utils::Distill; use super::{ generic, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, ToBatchPb, ToDistributedBatch, diff --git a/src/frontend/src/optimizer/plan_node/batch_nested_loop_join.rs b/src/frontend/src/optimizer/plan_node/batch_nested_loop_join.rs index 401166b1a298a..5d07aad86017b 100644 --- a/src/frontend/src/optimizer/plan_node/batch_nested_loop_join.rs +++ b/src/frontend/src/optimizer/plan_node/batch_nested_loop_join.rs @@ -17,9 +17,10 @@ use risingwave_pb::batch_plan::plan_node::NodeBody; use risingwave_pb::batch_plan::NestedLoopJoinNode; use super::batch::prelude::*; -use super::generic::{self, GenericPlanRef}; use super::utils::{childless_record, Distill}; -use super::{ExprRewritable, PlanBase, PlanRef, PlanTreeNodeBinary, ToBatchPb, ToDistributedBatch}; +use super::{ + generic, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeBinary, ToBatchPb, ToDistributedBatch, +}; use crate::error::Result; use crate::expr::{Expr, ExprImpl, ExprRewriter, ExprVisitor}; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; diff --git a/src/frontend/src/optimizer/plan_node/batch_over_window.rs b/src/frontend/src/optimizer/plan_node/batch_over_window.rs index 1712e87bbabbf..b9355fb117098 100644 --- a/src/frontend/src/optimizer/plan_node/batch_over_window.rs +++ b/src/frontend/src/optimizer/plan_node/batch_over_window.rs @@ -17,7 +17,6 @@ use risingwave_pb::batch_plan::plan_node::NodeBody; use risingwave_pb::batch_plan::SortOverWindowNode; use super::batch::prelude::*; -use super::batch::BatchPlanRef; use super::generic::PlanWindowFunction; use super::utils::impl_distill_by_unit; use super::{ diff --git a/src/frontend/src/optimizer/plan_node/batch_simple_agg.rs b/src/frontend/src/optimizer/plan_node/batch_simple_agg.rs index a112e36c3a98f..ff20df7a4d177 100644 --- a/src/frontend/src/optimizer/plan_node/batch_simple_agg.rs +++ b/src/frontend/src/optimizer/plan_node/batch_simple_agg.rs @@ -16,7 +16,7 @@ use risingwave_pb::batch_plan::plan_node::NodeBody; use risingwave_pb::batch_plan::SortAggNode; use super::batch::prelude::*; -use super::generic::{self, GenericPlanRef, PlanAggCall}; +use super::generic::{self, PlanAggCall}; use super::utils::impl_distill_by_unit; use super::{ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, ToBatchPb, ToDistributedBatch}; use crate::error::Result; diff --git a/src/frontend/src/optimizer/plan_node/batch_sort.rs b/src/frontend/src/optimizer/plan_node/batch_sort.rs index 413103ee98c89..9136e3f7c685a 100644 --- a/src/frontend/src/optimizer/plan_node/batch_sort.rs +++ b/src/frontend/src/optimizer/plan_node/batch_sort.rs @@ -17,7 +17,6 @@ use risingwave_pb::batch_plan::plan_node::NodeBody; use risingwave_pb::batch_plan::SortNode; use super::batch::prelude::*; -use super::batch::BatchPlanRef; use super::utils::{childless_record, Distill}; use super::{ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, ToBatchPb, ToDistributedBatch}; use crate::error::Result; diff --git a/src/frontend/src/optimizer/plan_node/batch_sort_agg.rs b/src/frontend/src/optimizer/plan_node/batch_sort_agg.rs index 7393c10edc8f0..f8ea17dcd837e 100644 --- a/src/frontend/src/optimizer/plan_node/batch_sort_agg.rs +++ b/src/frontend/src/optimizer/plan_node/batch_sort_agg.rs @@ -17,7 +17,7 @@ use risingwave_pb::batch_plan::SortAggNode; use risingwave_pb::expr::ExprNode; use super::batch::prelude::*; -use super::generic::{self, GenericPlanRef, PlanAggCall}; +use super::generic::{self, PlanAggCall}; use super::utils::impl_distill_by_unit; use super::{ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, ToBatchPb, ToDistributedBatch}; use crate::error::Result; diff --git a/src/frontend/src/optimizer/plan_node/batch_topn.rs b/src/frontend/src/optimizer/plan_node/batch_topn.rs index d8f96668f88a7..643ef0fcc01fc 100644 --- a/src/frontend/src/optimizer/plan_node/batch_topn.rs +++ b/src/frontend/src/optimizer/plan_node/batch_topn.rs @@ -22,7 +22,6 @@ use super::{ generic, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, ToBatchPb, ToDistributedBatch, }; use crate::error::Result; -use crate::optimizer::plan_node::batch::BatchPlanRef; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; use crate::optimizer::plan_node::{BatchLimit, ToLocalBatch}; use crate::optimizer::property::{Order, RequiredDist}; diff --git a/src/frontend/src/optimizer/plan_node/batch_update.rs b/src/frontend/src/optimizer/plan_node/batch_update.rs index 34d1eb3db3d74..d0351e6fdec2e 100644 --- a/src/frontend/src/optimizer/plan_node/batch_update.rs +++ b/src/frontend/src/optimizer/plan_node/batch_update.rs @@ -18,7 +18,6 @@ use risingwave_pb::batch_plan::plan_node::NodeBody; use risingwave_pb::batch_plan::UpdateNode; use super::batch::prelude::*; -use super::generic::GenericPlanRef; use super::utils::impl_distill_by_unit; use super::{ generic, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, ToBatchPb, ToDistributedBatch, diff --git a/src/frontend/src/optimizer/plan_node/convert.rs b/src/frontend/src/optimizer/plan_node/convert.rs index a39ed7d3b048d..db961b3b1e20a 100644 --- a/src/frontend/src/optimizer/plan_node/convert.rs +++ b/src/frontend/src/optimizer/plan_node/convert.rs @@ -19,8 +19,7 @@ use risingwave_common::catalog::FieldDisplay; use risingwave_pb::stream_plan::StreamScanType; use super::*; -use crate::optimizer::property::{Order, RequiredDist}; -use crate::utils::ColIndexMapping; +use crate::optimizer::property::RequiredDist; use crate::{for_batch_plan_nodes, for_logical_plan_nodes, for_stream_plan_nodes}; /// `ToStream` converts a logical plan node to streaming physical node diff --git a/src/frontend/src/optimizer/plan_node/expr_rewritable.rs b/src/frontend/src/optimizer/plan_node/expr_rewritable.rs index 33deebde1cdf9..4a30a599742ed 100644 --- a/src/frontend/src/optimizer/plan_node/expr_rewritable.rs +++ b/src/frontend/src/optimizer/plan_node/expr_rewritable.rs @@ -12,10 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::ops::Deref; - use super::*; -use crate::expr::ExprRewriter; /// Rewrites expressions in a `PlanRef`. Due to `Share` operator, /// the `ExprRewriter` needs to be idempotent i.e., applying it more than once diff --git a/src/frontend/src/optimizer/plan_node/expr_visitable.rs b/src/frontend/src/optimizer/plan_node/expr_visitable.rs index e4454fa92a7e5..e5527dfa17785 100644 --- a/src/frontend/src/optimizer/plan_node/expr_visitable.rs +++ b/src/frontend/src/optimizer/plan_node/expr_visitable.rs @@ -12,10 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::ops::Deref; - use super::*; -use crate::expr::ExprVisitor; /// Vistis expressions in a `PlanRef`. /// To visit recursively, call `visit_exprs_recursive` on [`VisitExprsRecursive`]. diff --git a/src/frontend/src/optimizer/plan_node/generic/project.rs b/src/frontend/src/optimizer/plan_node/generic/project.rs index 10329c9f8ca91..68c652f0e006f 100644 --- a/src/frontend/src/optimizer/plan_node/generic/project.rs +++ b/src/frontend/src/optimizer/plan_node/generic/project.rs @@ -86,7 +86,7 @@ impl GenericPlanNode for Project { Some(input_idx) => { let mut field = input_schema.fields()[input_idx].clone(); if let Some(name) = self.field_names.get(&i) { - field.name = name.clone(); + field.name.clone_from(name); } (field.name, field.sub_fields, field.type_name) } diff --git a/src/frontend/src/optimizer/plan_node/logical_agg.rs b/src/frontend/src/optimizer/plan_node/logical_agg.rs index f3d7d8e4d7bdf..ba0c1f9608279 100644 --- a/src/frontend/src/optimizer/plan_node/logical_agg.rs +++ b/src/frontend/src/optimizer/plan_node/logical_agg.rs @@ -1154,12 +1154,9 @@ impl ToStream for LogicalAgg { #[cfg(test)] mod tests { use risingwave_common::catalog::{Field, Schema}; - use risingwave_common::types::DataType; use super::*; - use crate::expr::{ - assert_eq_input_ref, input_ref_to_column_indices, AggCall, ExprType, FunctionCall, OrderBy, - }; + use crate::expr::{assert_eq_input_ref, input_ref_to_column_indices}; use crate::optimizer::optimizer_context::OptimizerContext; use crate::optimizer::plan_node::LogicalValues; diff --git a/src/frontend/src/optimizer/plan_node/logical_filter.rs b/src/frontend/src/optimizer/plan_node/logical_filter.rs index 6bae6cc7efb22..4ea9adf7aacac 100644 --- a/src/frontend/src/optimizer/plan_node/logical_filter.rs +++ b/src/frontend/src/optimizer/plan_node/logical_filter.rs @@ -247,11 +247,11 @@ mod tests { use std::collections::HashSet; use risingwave_common::catalog::{Field, Schema}; - use risingwave_common::types::{DataType, ScalarImpl}; + use risingwave_common::types::ScalarImpl; use risingwave_pb::expr::expr_node::Type; use super::*; - use crate::expr::{assert_eq_input_ref, FunctionCall, InputRef, Literal}; + use crate::expr::{assert_eq_input_ref, Literal}; use crate::optimizer::optimizer_context::OptimizerContext; use crate::optimizer::plan_node::LogicalValues; use crate::optimizer::property::FunctionalDependency; diff --git a/src/frontend/src/optimizer/plan_node/logical_hop_window.rs b/src/frontend/src/optimizer/plan_node/logical_hop_window.rs index 37f1dba5c2720..b15424d6d892a 100644 --- a/src/frontend/src/optimizer/plan_node/logical_hop_window.rs +++ b/src/frontend/src/optimizer/plan_node/logical_hop_window.rs @@ -366,7 +366,6 @@ mod test { use risingwave_common::types::DataType; use super::*; - use crate::expr::InputRef; use crate::optimizer::optimizer_context::OptimizerContext; use crate::optimizer::plan_node::LogicalValues; use crate::optimizer::property::FunctionalDependency; diff --git a/src/frontend/src/optimizer/plan_node/logical_join.rs b/src/frontend/src/optimizer/plan_node/logical_join.rs index 89cebd6a0c458..e9dac0de38b5a 100644 --- a/src/frontend/src/optimizer/plan_node/logical_join.rs +++ b/src/frontend/src/optimizer/plan_node/logical_join.rs @@ -1471,7 +1471,7 @@ mod tests { use risingwave_pb::expr::expr_node::Type; use super::*; - use crate::expr::{assert_eq_input_ref, FunctionCall, InputRef, Literal}; + use crate::expr::{assert_eq_input_ref, FunctionCall, Literal}; use crate::optimizer::optimizer_context::OptimizerContext; use crate::optimizer::plan_node::LogicalValues; use crate::optimizer::property::FunctionalDependency; diff --git a/src/frontend/src/optimizer/plan_node/logical_multi_join.rs b/src/frontend/src/optimizer/plan_node/logical_multi_join.rs index a47c75d31bd27..a30b78d44e00c 100644 --- a/src/frontend/src/optimizer/plan_node/logical_multi_join.rs +++ b/src/frontend/src/optimizer/plan_node/logical_multi_join.rs @@ -871,7 +871,7 @@ mod test { use risingwave_pb::expr::expr_node::Type; use super::*; - use crate::expr::{FunctionCall, InputRef}; + use crate::expr::InputRef; use crate::optimizer::optimizer_context::OptimizerContext; use crate::optimizer::plan_node::generic::GenericPlanRef; use crate::optimizer::plan_node::LogicalValues; diff --git a/src/frontend/src/optimizer/plan_node/logical_project.rs b/src/frontend/src/optimizer/plan_node/logical_project.rs index a0f26548da2b1..78bd74969b2c1 100644 --- a/src/frontend/src/optimizer/plan_node/logical_project.rs +++ b/src/frontend/src/optimizer/plan_node/logical_project.rs @@ -303,7 +303,7 @@ mod tests { use risingwave_pb::expr::expr_node::Type; use super::*; - use crate::expr::{assert_eq_input_ref, FunctionCall, InputRef, Literal}; + use crate::expr::{assert_eq_input_ref, FunctionCall, Literal}; use crate::optimizer::optimizer_context::OptimizerContext; use crate::optimizer::plan_node::LogicalValues; diff --git a/src/frontend/src/optimizer/plan_node/logical_project_set.rs b/src/frontend/src/optimizer/plan_node/logical_project_set.rs index 53e7995c1517e..984fdac720b90 100644 --- a/src/frontend/src/optimizer/plan_node/logical_project_set.rs +++ b/src/frontend/src/optimizer/plan_node/logical_project_set.rs @@ -412,10 +412,8 @@ mod test { use std::collections::HashSet; use risingwave_common::catalog::{Field, Schema}; - use risingwave_common::types::DataType; use super::*; - use crate::expr::{ExprImpl, InputRef, TableFunction}; use crate::optimizer::optimizer_context::OptimizerContext; use crate::optimizer::plan_node::LogicalValues; use crate::optimizer::property::FunctionalDependency; diff --git a/src/frontend/src/optimizer/plan_node/logical_union.rs b/src/frontend/src/optimizer/plan_node/logical_union.rs index 99de2748dca4e..6238e63fd9f51 100644 --- a/src/frontend/src/optimizer/plan_node/logical_union.rs +++ b/src/frontend/src/optimizer/plan_node/logical_union.rs @@ -327,8 +327,7 @@ impl ToStream for LogicalUnion { #[cfg(test)] mod tests { - use risingwave_common::catalog::{Field, Schema}; - use risingwave_common::types::DataType; + use risingwave_common::catalog::Field; use super::*; use crate::optimizer::optimizer_context::OptimizerContext; diff --git a/src/frontend/src/optimizer/plan_node/logical_values.rs b/src/frontend/src/optimizer/plan_node/logical_values.rs index cdf9af3c93541..7a585f7e0801f 100644 --- a/src/frontend/src/optimizer/plan_node/logical_values.rs +++ b/src/frontend/src/optimizer/plan_node/logical_values.rs @@ -205,11 +205,9 @@ impl ToStream for LogicalValues { #[cfg(test)] mod tests { - use risingwave_common::catalog::Field; - use risingwave_common::types::{DataType, Datum}; + use risingwave_common::types::Datum; use super::*; - use crate::expr::Literal; use crate::optimizer::optimizer_context::OptimizerContext; fn literal(val: i32) -> ExprImpl { diff --git a/src/frontend/src/optimizer/plan_node/mod.rs b/src/frontend/src/optimizer/plan_node/mod.rs index b35b97a724bcb..928107a908b1f 100644 --- a/src/frontend/src/optimizer/plan_node/mod.rs +++ b/src/frontend/src/optimizer/plan_node/mod.rs @@ -33,7 +33,7 @@ use std::ops::Deref; use std::rc::Rc; use downcast_rs::{impl_downcast, Downcast}; -use dyn_clone::{self, DynClone}; +use dyn_clone::DynClone; use fixedbitset::FixedBitSet; use itertools::Itertools; use paste::paste; diff --git a/src/frontend/src/optimizer/plan_node/plan_base.rs b/src/frontend/src/optimizer/plan_node/plan_base.rs index 3e9783894d40f..12fba475241c5 100644 --- a/src/frontend/src/optimizer/plan_node/plan_base.rs +++ b/src/frontend/src/optimizer/plan_node/plan_base.rs @@ -13,13 +13,10 @@ // limitations under the License. use educe::Educe; -use fixedbitset::FixedBitSet; -use risingwave_common::catalog::Schema; use super::generic::GenericPlanNode; use super::*; -use crate::optimizer::optimizer_context::OptimizerContextRef; -use crate::optimizer::property::{Distribution, FunctionalDependencySet, Order}; +use crate::optimizer::property::Distribution; /// No extra fields for logical plan nodes. #[derive(Clone, Debug, PartialEq, Eq, Hash)] diff --git a/src/frontend/src/optimizer/plan_node/predicate_pushdown.rs b/src/frontend/src/optimizer/plan_node/predicate_pushdown.rs index 64abc6bcd2de8..af56ae3f76582 100644 --- a/src/frontend/src/optimizer/plan_node/predicate_pushdown.rs +++ b/src/frontend/src/optimizer/plan_node/predicate_pushdown.rs @@ -19,7 +19,6 @@ use paste::paste; use super::*; use crate::optimizer::plan_visitor::ShareParentCounter; use crate::optimizer::PlanVisitor; -use crate::utils::Condition; use crate::{for_batch_plan_nodes, for_stream_plan_nodes}; /// The trait for predicate pushdown, only logical plan node will use it, though all plan node impl diff --git a/src/frontend/src/optimizer/plan_node/stream_delta_join.rs b/src/frontend/src/optimizer/plan_node/stream_delta_join.rs index 89b1402cba919..49257676bc004 100644 --- a/src/frontend/src/optimizer/plan_node/stream_delta_join.rs +++ b/src/frontend/src/optimizer/plan_node/stream_delta_join.rs @@ -20,10 +20,9 @@ use risingwave_pb::plan_common::JoinType; use risingwave_pb::stream_plan::stream_node::NodeBody; use risingwave_pb::stream_plan::{ArrangementInfo, DeltaIndexJoinNode}; -use super::generic::{self, GenericPlanRef}; use super::stream::prelude::*; use super::utils::{childless_record, Distill}; -use super::{ExprRewritable, PlanBase, PlanRef, PlanTreeNodeBinary}; +use super::{generic, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeBinary}; use crate::expr::{Expr, ExprRewriter, ExprVisitor}; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; use crate::optimizer::plan_node::utils::IndicesDisplay; diff --git a/src/frontend/src/optimizer/plan_node/stream_dml.rs b/src/frontend/src/optimizer/plan_node/stream_dml.rs index bdda75d061012..e777041718291 100644 --- a/src/frontend/src/optimizer/plan_node/stream_dml.rs +++ b/src/frontend/src/optimizer/plan_node/stream_dml.rs @@ -18,7 +18,6 @@ use risingwave_common::catalog::{ColumnDesc, INITIAL_TABLE_VERSION_ID}; use risingwave_pb::stream_plan::stream_node::PbNodeBody; use super::stream::prelude::*; -use super::stream::StreamPlanRef; use super::utils::{childless_record, Distill}; use super::{ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, StreamNode}; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; diff --git a/src/frontend/src/optimizer/plan_node/stream_dynamic_filter.rs b/src/frontend/src/optimizer/plan_node/stream_dynamic_filter.rs index 974c6fca5df1a..a90cd4b77c669 100644 --- a/src/frontend/src/optimizer/plan_node/stream_dynamic_filter.rs +++ b/src/frontend/src/optimizer/plan_node/stream_dynamic_filter.rs @@ -17,9 +17,8 @@ pub use risingwave_pb::expr::expr_node::Type as ExprType; use risingwave_pb::stream_plan::stream_node::NodeBody; use risingwave_pb::stream_plan::DynamicFilterNode; -use super::generic::{DynamicFilter, GenericPlanRef}; +use super::generic::DynamicFilter; use super::stream::prelude::*; -use super::stream::StreamPlanRef; use super::utils::{ childless_record, column_names_pretty, plan_node_name, watermark_pretty, Distill, }; diff --git a/src/frontend/src/optimizer/plan_node/stream_eowc_over_window.rs b/src/frontend/src/optimizer/plan_node/stream_eowc_over_window.rs index 7cd9bb533a807..78cb0e3b9d605 100644 --- a/src/frontend/src/optimizer/plan_node/stream_eowc_over_window.rs +++ b/src/frontend/src/optimizer/plan_node/stream_eowc_over_window.rs @@ -18,7 +18,7 @@ use fixedbitset::FixedBitSet; use risingwave_common::util::sort_util::OrderType; use risingwave_pb::stream_plan::stream_node::PbNodeBody; -use super::generic::{self, GenericPlanRef, PlanWindowFunction}; +use super::generic::{self, PlanWindowFunction}; use super::stream::prelude::*; use super::utils::{impl_distill_by_unit, TableCatalogBuilder}; use super::{ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, StreamNode}; diff --git a/src/frontend/src/optimizer/plan_node/stream_group_topn.rs b/src/frontend/src/optimizer/plan_node/stream_group_topn.rs index e48d23d14e04e..8500e24b0fd9f 100644 --- a/src/frontend/src/optimizer/plan_node/stream_group_topn.rs +++ b/src/frontend/src/optimizer/plan_node/stream_group_topn.rs @@ -16,9 +16,8 @@ use fixedbitset::FixedBitSet; use pretty_xmlish::XmlNode; use risingwave_pb::stream_plan::stream_node::PbNodeBody; -use super::generic::{DistillUnit, GenericPlanRef, TopNLimit}; +use super::generic::{DistillUnit, TopNLimit}; use super::stream::prelude::*; -use super::stream::StreamPlanRef; use super::utils::{plan_node_name, watermark_pretty, Distill}; use super::{generic, ExprRewritable, PlanBase, PlanTreeNodeUnary, StreamNode}; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; diff --git a/src/frontend/src/optimizer/plan_node/stream_hash_agg.rs b/src/frontend/src/optimizer/plan_node/stream_hash_agg.rs index d5d7bde249a17..eb69d5c259bb6 100644 --- a/src/frontend/src/optimizer/plan_node/stream_hash_agg.rs +++ b/src/frontend/src/optimizer/plan_node/stream_hash_agg.rs @@ -17,14 +17,13 @@ use itertools::Itertools; use pretty_xmlish::XmlNode; use risingwave_pb::stream_plan::stream_node::PbNodeBody; -use super::generic::{self, GenericPlanRef, PlanAggCall}; +use super::generic::{self, PlanAggCall}; use super::stream::prelude::*; use super::utils::{childless_record, plan_node_name, watermark_pretty, Distill}; use super::{ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, StreamNode}; use crate::error::{ErrorCode, Result}; use crate::expr::{ExprRewriter, ExprVisitor}; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; -use crate::optimizer::plan_node::stream::StreamPlanRef; use crate::stream_fragmenter::BuildFragmentGraphState; use crate::utils::{ColIndexMapping, ColIndexMappingRewriteExt, IndexSet}; diff --git a/src/frontend/src/optimizer/plan_node/stream_hash_join.rs b/src/frontend/src/optimizer/plan_node/stream_hash_join.rs index d5e5e9838ac66..b803fccef7b07 100644 --- a/src/frontend/src/optimizer/plan_node/stream_hash_join.rs +++ b/src/frontend/src/optimizer/plan_node/stream_hash_join.rs @@ -20,9 +20,8 @@ use risingwave_pb::plan_common::JoinType; use risingwave_pb::stream_plan::stream_node::NodeBody; use risingwave_pb::stream_plan::{DeltaExpression, HashJoinNode, PbInequalityPair}; -use super::generic::{GenericPlanRef, Join}; +use super::generic::Join; use super::stream::prelude::*; -use super::stream::StreamPlanRef; use super::utils::{childless_record, plan_node_name, watermark_pretty, Distill}; use super::{ generic, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeBinary, StreamDeltaJoin, StreamNode, diff --git a/src/frontend/src/optimizer/plan_node/stream_hop_window.rs b/src/frontend/src/optimizer/plan_node/stream_hop_window.rs index 9cb5800cc7220..0cdddf77ed0e5 100644 --- a/src/frontend/src/optimizer/plan_node/stream_hop_window.rs +++ b/src/frontend/src/optimizer/plan_node/stream_hop_window.rs @@ -17,9 +17,7 @@ use risingwave_common::util::column_index_mapping::ColIndexMapping; use risingwave_pb::stream_plan::stream_node::PbNodeBody; use risingwave_pb::stream_plan::HopWindowNode; -use super::generic::GenericPlanRef; use super::stream::prelude::*; -use super::stream::StreamPlanRef; use super::utils::{childless_record, watermark_pretty, Distill}; use super::{generic, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, StreamNode}; use crate::expr::{Expr, ExprImpl, ExprRewriter, ExprVisitor}; diff --git a/src/frontend/src/optimizer/plan_node/stream_materialize.rs b/src/frontend/src/optimizer/plan_node/stream_materialize.rs index 3da52ef4f55a2..53b8983bfd0ed 100644 --- a/src/frontend/src/optimizer/plan_node/stream_materialize.rs +++ b/src/frontend/src/optimizer/plan_node/stream_materialize.rs @@ -27,14 +27,12 @@ use risingwave_pb::stream_plan::stream_node::PbNodeBody; use super::derive::derive_columns; use super::stream::prelude::*; -use super::stream::StreamPlanRef; use super::utils::{childless_record, Distill}; use super::{reorganize_elements_id, ExprRewritable, PlanRef, PlanTreeNodeUnary, StreamNode}; use crate::catalog::table_catalog::{TableCatalog, TableType, TableVersion}; use crate::error::Result; use crate::optimizer::plan_node::derive::derive_pk; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; -use crate::optimizer::plan_node::generic::GenericPlanRef; use crate::optimizer::plan_node::{PlanBase, PlanNodeMeta}; use crate::optimizer::property::{Cardinality, Distribution, Order, RequiredDist}; use crate::stream_fragmenter::BuildFragmentGraphState; diff --git a/src/frontend/src/optimizer/plan_node/stream_over_window.rs b/src/frontend/src/optimizer/plan_node/stream_over_window.rs index 7173e3a46e0cd..be6c63bcb50de 100644 --- a/src/frontend/src/optimizer/plan_node/stream_over_window.rs +++ b/src/frontend/src/optimizer/plan_node/stream_over_window.rs @@ -23,7 +23,6 @@ use super::stream::prelude::*; use super::utils::{impl_distill_by_unit, TableCatalogBuilder}; use super::{generic, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, StreamNode}; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; -use crate::optimizer::plan_node::generic::GenericPlanRef; use crate::stream_fragmenter::BuildFragmentGraphState; use crate::TableCatalog; diff --git a/src/frontend/src/optimizer/plan_node/stream_project.rs b/src/frontend/src/optimizer/plan_node/stream_project.rs index 1b97835e9896f..c077af9241aa1 100644 --- a/src/frontend/src/optimizer/plan_node/stream_project.rs +++ b/src/frontend/src/optimizer/plan_node/stream_project.rs @@ -17,9 +17,7 @@ use pretty_xmlish::XmlNode; use risingwave_pb::stream_plan::stream_node::PbNodeBody; use risingwave_pb::stream_plan::ProjectNode; -use super::generic::GenericPlanRef; use super::stream::prelude::*; -use super::stream::StreamPlanRef; use super::utils::{childless_record, watermark_pretty, Distill}; use super::{generic, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, StreamNode}; use crate::expr::{ diff --git a/src/frontend/src/optimizer/plan_node/stream_share.rs b/src/frontend/src/optimizer/plan_node/stream_share.rs index 395a32bc9be8a..5bf575f622bce 100644 --- a/src/frontend/src/optimizer/plan_node/stream_share.rs +++ b/src/frontend/src/optimizer/plan_node/stream_share.rs @@ -16,7 +16,6 @@ use pretty_xmlish::XmlNode; use risingwave_pb::stream_plan::stream_node::PbNodeBody; use risingwave_pb::stream_plan::PbStreamNode; -use super::generic::GenericPlanRef; use super::stream::prelude::*; use super::utils::Distill; use super::{generic, ExprRewritable, PlanRef, PlanTreeNodeUnary, StreamExchange, StreamNode}; diff --git a/src/frontend/src/optimizer/plan_node/stream_sink.rs b/src/frontend/src/optimizer/plan_node/stream_sink.rs index ff8f12b49db0b..94dbf36591444 100644 --- a/src/frontend/src/optimizer/plan_node/stream_sink.rs +++ b/src/frontend/src/optimizer/plan_node/stream_sink.rs @@ -37,12 +37,11 @@ use risingwave_pb::stream_plan::stream_node::PbNodeBody; use risingwave_pb::stream_plan::SinkLogStoreType; use super::derive::{derive_columns, derive_pk}; -use super::generic::{self, GenericPlanRef}; use super::stream::prelude::*; use super::utils::{ childless_record, infer_kv_log_store_table_catalog_inner, Distill, IndicesDisplay, }; -use super::{ExprRewritable, PlanBase, PlanRef, StreamNode, StreamProject}; +use super::{generic, ExprRewritable, PlanBase, PlanRef, StreamNode, StreamProject}; use crate::error::{ErrorCode, Result}; use crate::expr::{ExprImpl, FunctionCall, InputRef}; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; diff --git a/src/frontend/src/optimizer/plan_node/stream_stateless_simple_agg.rs b/src/frontend/src/optimizer/plan_node/stream_stateless_simple_agg.rs index d5fce4eecdc1c..8ce0997b7fe1f 100644 --- a/src/frontend/src/optimizer/plan_node/stream_stateless_simple_agg.rs +++ b/src/frontend/src/optimizer/plan_node/stream_stateless_simple_agg.rs @@ -22,7 +22,6 @@ use super::utils::impl_distill_by_unit; use super::{ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, StreamNode}; use crate::expr::{ExprRewriter, ExprVisitor}; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; -use crate::optimizer::plan_node::generic::PhysicalPlanRef; use crate::optimizer::property::RequiredDist; use crate::stream_fragmenter::BuildFragmentGraphState; diff --git a/src/frontend/src/optimizer/plan_node/stream_temporal_join.rs b/src/frontend/src/optimizer/plan_node/stream_temporal_join.rs index ce8753b9ddbc8..aa090143b925b 100644 --- a/src/frontend/src/optimizer/plan_node/stream_temporal_join.rs +++ b/src/frontend/src/optimizer/plan_node/stream_temporal_join.rs @@ -20,9 +20,7 @@ use risingwave_pb::stream_plan::stream_node::NodeBody; use risingwave_pb::stream_plan::TemporalJoinNode; use risingwave_sqlparser::ast::AsOf; -use super::generic::GenericPlanRef; use super::stream::prelude::*; -use super::stream::StreamPlanRef; use super::utils::{childless_record, watermark_pretty, Distill}; use super::{generic, ExprRewritable, PlanBase, PlanRef, PlanTreeNodeBinary}; use crate::expr::{Expr, ExprRewriter, ExprVisitor}; diff --git a/src/frontend/src/optimizer/plan_node/stream_union.rs b/src/frontend/src/optimizer/plan_node/stream_union.rs index 7a317a2677495..1c269ec0c5ad2 100644 --- a/src/frontend/src/optimizer/plan_node/stream_union.rs +++ b/src/frontend/src/optimizer/plan_node/stream_union.rs @@ -19,9 +19,7 @@ use pretty_xmlish::XmlNode; use risingwave_pb::stream_plan::stream_node::PbNodeBody; use risingwave_pb::stream_plan::UnionNode; -use super::generic::GenericPlanRef; use super::stream::prelude::*; -use super::stream::StreamPlanRef; use super::utils::{childless_record, watermark_pretty, Distill}; use super::{generic, ExprRewritable, PlanRef}; use crate::optimizer::plan_node::expr_visitable::ExprVisitable; diff --git a/src/frontend/src/optimizer/plan_node/stream_watermark_filter.rs b/src/frontend/src/optimizer/plan_node/stream_watermark_filter.rs index ed7e367f93715..ffb08776b3fe5 100644 --- a/src/frontend/src/optimizer/plan_node/stream_watermark_filter.rs +++ b/src/frontend/src/optimizer/plan_node/stream_watermark_filter.rs @@ -20,7 +20,6 @@ use risingwave_pb::catalog::WatermarkDesc; use risingwave_pb::stream_plan::stream_node::PbNodeBody; use super::stream::prelude::*; -use super::stream::StreamPlanRef; use super::utils::{childless_record, watermark_pretty, Distill, TableCatalogBuilder}; use super::{ExprRewritable, PlanBase, PlanRef, PlanTreeNodeUnary, StreamNode}; use crate::expr::{ExprDisplay, ExprImpl}; diff --git a/src/frontend/src/optimizer/plan_visitor/jsonb_stream_key_checker.rs b/src/frontend/src/optimizer/plan_visitor/jsonb_stream_key_checker.rs index d0a4358b4582a..c41e1c5b36463 100644 --- a/src/frontend/src/optimizer/plan_visitor/jsonb_stream_key_checker.rs +++ b/src/frontend/src/optimizer/plan_visitor/jsonb_stream_key_checker.rs @@ -17,7 +17,7 @@ use risingwave_common::types::DataType; use super::{DefaultBehavior, Merge}; use crate::optimizer::plan_node::generic::GenericPlanRef; -use crate::optimizer::plan_node::{PlanNode, *}; +use crate::optimizer::plan_node::*; use crate::optimizer::plan_visitor::PlanVisitor; #[derive(Debug, Clone, Default)] diff --git a/src/frontend/src/optimizer/property/distribution.rs b/src/frontend/src/optimizer/property/distribution.rs index 4999e1d8630bf..358ad934a9ccf 100644 --- a/src/frontend/src/optimizer/property/distribution.rs +++ b/src/frontend/src/optimizer/property/distribution.rs @@ -62,7 +62,6 @@ use crate::catalog::catalog_service::CatalogReader; use crate::catalog::FragmentId; use crate::error::Result; use crate::optimizer::property::Order; -use crate::optimizer::PlanRef; /// the distribution property provided by a operator. #[derive(Debug, Clone, PartialEq, Eq, Hash)] diff --git a/src/frontend/src/optimizer/property/order.rs b/src/frontend/src/optimizer/property/order.rs index 1a657e190fac4..68f2120df567b 100644 --- a/src/frontend/src/optimizer/property/order.rs +++ b/src/frontend/src/optimizer/property/order.rs @@ -22,7 +22,6 @@ use risingwave_pb::common::PbColumnOrder; use super::super::plan_node::*; use crate::error::Result; -use crate::optimizer::PlanRef; // TODO(rc): use this type to replace all `Vec` #[derive(Debug, Clone, Default, PartialEq, Eq, Hash)] diff --git a/src/frontend/src/optimizer/rule/pull_up_correlated_predicate_agg_rule.rs b/src/frontend/src/optimizer/rule/pull_up_correlated_predicate_agg_rule.rs index 7823c7f41f7b4..c9cb4edc860cd 100644 --- a/src/frontend/src/optimizer/rule/pull_up_correlated_predicate_agg_rule.rs +++ b/src/frontend/src/optimizer/rule/pull_up_correlated_predicate_agg_rule.rs @@ -24,7 +24,6 @@ use crate::expr::{Expr, ExprImpl, ExprRewriter, ExprType, FunctionCall, InputRef use crate::optimizer::plan_expr_visitor::Strong; use crate::optimizer::plan_node::generic::{Agg, GenericPlanNode, GenericPlanRef}; use crate::optimizer::plan_visitor::{PlanCorrelatedIdFinder, PlanVisitor}; -use crate::optimizer::PlanRef; use crate::utils::{Condition, IndexSet}; /// Pull up correlated predicates from the right agg side of Apply to the `on` clause of Join. diff --git a/src/frontend/src/optimizer/rule/pull_up_correlated_predicate_rule.rs b/src/frontend/src/optimizer/rule/pull_up_correlated_predicate_rule.rs index b5df4f1738072..d6b59b9553911 100644 --- a/src/frontend/src/optimizer/rule/pull_up_correlated_predicate_rule.rs +++ b/src/frontend/src/optimizer/rule/pull_up_correlated_predicate_rule.rs @@ -20,7 +20,6 @@ use super::{BoxedRule, Rule}; use crate::expr::{CorrelatedId, CorrelatedInputRef, Expr, ExprImpl, ExprRewriter, InputRef}; use crate::optimizer::plan_node::generic::GenericPlanRef; use crate::optimizer::plan_visitor::{PlanCorrelatedIdFinder, PlanVisitor}; -use crate::optimizer::PlanRef; use crate::utils::Condition; /// This rule is for pattern: Apply->Project->Filter. diff --git a/src/frontend/src/scheduler/distributed/query.rs b/src/frontend/src/scheduler/distributed/query.rs index c6e866630067b..b556bc3af6c85 100644 --- a/src/frontend/src/scheduler/distributed/query.rs +++ b/src/frontend/src/scheduler/distributed/query.rs @@ -13,7 +13,6 @@ // limitations under the License. use std::collections::HashMap; -use std::default::Default; use std::fmt::{Debug, Formatter}; use std::mem; use std::sync::Arc; diff --git a/src/frontend/src/telemetry.rs b/src/frontend/src/telemetry.rs index 631914cee7a4f..d50b9999b946f 100644 --- a/src/frontend/src/telemetry.rs +++ b/src/frontend/src/telemetry.rs @@ -33,6 +33,7 @@ impl FrontendTelemetryCreator { #[async_trait::async_trait] impl TelemetryReportCreator for FrontendTelemetryCreator { + #[allow(refining_impl_trait)] async fn create_report( &self, tracking_id: String, @@ -97,7 +98,6 @@ mod tests { assert_eq!(report.base.node_type, TelemetryNodeType::Frontend); } - use risingwave_common::telemetry::pb_compatible::TelemetryToProtobuf; use risingwave_common::telemetry::{post_telemetry_report_pb, TELEMETRY_REPORT_URL}; // It is ok to diff --git a/src/frontend/src/utils/condition.rs b/src/frontend/src/utils/condition.rs index 5161877d1d163..d78adcbd07a97 100644 --- a/src/frontend/src/utils/condition.rs +++ b/src/frontend/src/utils/condition.rs @@ -1018,10 +1018,8 @@ mod cast_compare { #[cfg(test)] mod tests { use rand::Rng; - use risingwave_common::types::DataType; use super::*; - use crate::expr::{FunctionCall, InputRef}; #[test] fn test_split() { diff --git a/src/frontend/src/utils/with_options.rs b/src/frontend/src/utils/with_options.rs index 5526e92d7be67..b5848d124c9d3 100644 --- a/src/frontend/src/utils/with_options.rs +++ b/src/frontend/src/utils/with_options.rs @@ -13,7 +13,6 @@ // limitations under the License. use std::collections::{BTreeMap, HashMap}; -use std::convert::TryFrom; use std::num::NonZeroU32; use risingwave_connector::source::kafka::private_link::{ diff --git a/src/jni_core/src/jvm_runtime.rs b/src/jni_core/src/jvm_runtime.rs index 5950cf7685ea7..f848b7d44240d 100644 --- a/src/jni_core/src/jvm_runtime.rs +++ b/src/jni_core/src/jvm_runtime.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use core::option::Option::Some; use std::ffi::c_void; use std::path::PathBuf; use std::sync::OnceLock; diff --git a/src/meta/model_v2/src/lib.rs b/src/meta/model_v2/src/lib.rs index b34cd5e73e6ce..87d7e3e3597f6 100644 --- a/src/meta/model_v2/src/lib.rs +++ b/src/meta/model_v2/src/lib.rs @@ -256,7 +256,7 @@ macro_rules! derive_array_from_blob { }; } -pub(crate) use {derive_array_from_blob, derive_from_blob, derive_from_json_struct}; +pub(crate) use {derive_array_from_blob, derive_from_blob}; derive_from_json_struct!(I32Array, Vec); diff --git a/src/meta/service/src/session_config.rs b/src/meta/service/src/session_config.rs index a4a7d1b70591a..a3999a3d27426 100644 --- a/src/meta/service/src/session_config.rs +++ b/src/meta/service/src/session_config.rs @@ -19,7 +19,6 @@ use risingwave_pb::meta::{ GetSessionParamsRequest, GetSessionParamsResponse, SetSessionParamRequest, SetSessionParamResponse, }; -use serde_json; use thiserror_ext::AsReport; use tonic::{Request, Response, Status}; diff --git a/src/meta/src/barrier/command.rs b/src/meta/src/barrier/command.rs index 51175ca9475f2..865835c49edeb 100644 --- a/src/meta/src/barrier/command.rs +++ b/src/meta/src/barrier/command.rs @@ -13,7 +13,6 @@ // limitations under the License. use std::collections::{HashMap, HashSet}; -use std::default::Default; use std::sync::Arc; use futures::future::try_join_all; @@ -96,7 +95,7 @@ pub struct ReplaceTablePlan { /// We need to reassign splits for it. /// /// Note that there's no `SourceBackfillExecutor` involved for table with connector, so we don't need to worry about - /// backfill_splits. + /// `backfill_splits`. pub init_split_assignment: SplitAssignment, } @@ -389,7 +388,7 @@ pub struct CommandContext { /// Differs from [`TracedEpoch`], this span focuses on the lifetime of the corresponding /// barrier, including the process of waiting for the barrier to be sent, flowing through the /// stream graph on compute nodes, and finishing its `post_collect` stuffs. - pub span: tracing::Span, + pub _span: tracing::Span, } impl CommandContext { @@ -412,7 +411,7 @@ impl CommandContext { command, kind, barrier_manager_context, - span, + _span: span, } } diff --git a/src/meta/src/barrier/info.rs b/src/meta/src/barrier/info.rs index e07cb705b26a1..aa8882d438dce 100644 --- a/src/meta/src/barrier/info.rs +++ b/src/meta/src/barrier/info.rs @@ -51,7 +51,7 @@ pub struct InflightActorInfo { /// `actor_id` => `WorkerId` pub actor_location_map: HashMap, - /// mv_table_id => subscription_id => retention seconds + /// `mv_table_id` => `subscription_id` => retention seconds pub mv_depended_subscriptions: HashMap>, } diff --git a/src/meta/src/barrier/mod.rs b/src/meta/src/barrier/mod.rs index c1620bce7d20b..6d5657a158e48 100644 --- a/src/meta/src/barrier/mod.rs +++ b/src/meta/src/barrier/mod.rs @@ -426,6 +426,7 @@ enum CompletingCommand { // that has finished but not checkpointed. If there is any, we will force checkpoint on the next barrier join_handle: JoinHandle>, }, + #[expect(dead_code)] Err(MetaError), } diff --git a/src/meta/src/controller/catalog.rs b/src/meta/src/controller/catalog.rs index 409672138d79f..f8ec470a74918 100644 --- a/src/meta/src/controller/catalog.rs +++ b/src/meta/src/controller/catalog.rs @@ -3008,7 +3008,6 @@ impl CatalogControllerInner { #[cfg(test)] #[cfg(not(madsim))] mod tests { - use risingwave_meta_model_v2::ViewId; use super::*; diff --git a/src/meta/src/controller/fragment.rs b/src/meta/src/controller/fragment.rs index 552008914d76e..7bf5b02f971af 100644 --- a/src/meta/src/controller/fragment.rs +++ b/src/meta/src/controller/fragment.rs @@ -1346,7 +1346,6 @@ impl CatalogController { #[cfg(test)] mod tests { use std::collections::{BTreeMap, HashMap}; - use std::default::Default; use itertools::Itertools; use risingwave_common::hash::{ParallelUnitId, ParallelUnitMapping}; diff --git a/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs b/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs index 6dac7394dfb46..f98e14203d95b 100644 --- a/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs +++ b/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs @@ -30,7 +30,7 @@ use crate::hummock::compaction::{create_overlap_strategy, CompactionDeveloperCon use crate::hummock::level_handler::LevelHandler; std::thread_local! { - static LOG_COUNTER: RefCell = RefCell::new(0); + static LOG_COUNTER: RefCell = const { RefCell::new(0) }; } pub struct LevelCompactionPicker { @@ -285,14 +285,11 @@ impl LevelCompactionPicker { #[cfg(test)] pub mod tests { - use itertools::Itertools; use super::*; use crate::hummock::compaction::compaction_config::CompactionConfigBuilder; use crate::hummock::compaction::selector::tests::*; - use crate::hummock::compaction::{ - CompactionDeveloperConfig, CompactionMode, TierCompactionPicker, - }; + use crate::hummock::compaction::{CompactionMode, TierCompactionPicker}; fn create_compaction_picker_for_test() -> LevelCompactionPicker { let config = Arc::new( diff --git a/src/meta/src/hummock/compaction/picker/manual_compaction_picker.rs b/src/meta/src/hummock/compaction/picker/manual_compaction_picker.rs index f46a99bc80c0d..82e58b87c5517 100644 --- a/src/meta/src/hummock/compaction/picker/manual_compaction_picker.rs +++ b/src/meta/src/hummock/compaction/picker/manual_compaction_picker.rs @@ -326,10 +326,10 @@ impl CompactionPicker for ManualCompactionPicker { #[cfg(test)] pub mod tests { - use std::collections::{HashMap, HashSet}; + use std::collections::HashMap; use risingwave_pb::hummock::compact_task; - pub use risingwave_pb::hummock::{KeyRange, Level, LevelType}; + pub use risingwave_pb::hummock::KeyRange; use super::*; use crate::hummock::compaction::compaction_config::CompactionConfigBuilder; diff --git a/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs b/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs index 994ca4297a502..f082c405a61ff 100644 --- a/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs +++ b/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs @@ -533,8 +533,6 @@ impl NonOverlapSubLevelPicker { pub mod tests { use std::collections::BTreeSet; - pub use risingwave_pb::hummock::{Level, LevelType}; - use super::*; use crate::hummock::compaction::overlap_strategy::RangeOverlapStrategy; use crate::hummock::compaction::selector::tests::{ diff --git a/src/meta/src/hummock/compaction/picker/space_reclaim_compaction_picker.rs b/src/meta/src/hummock/compaction/picker/space_reclaim_compaction_picker.rs index 5d05fedbe5338..ab9f74c063a0b 100644 --- a/src/meta/src/hummock/compaction/picker/space_reclaim_compaction_picker.rs +++ b/src/meta/src/hummock/compaction/picker/space_reclaim_compaction_picker.rs @@ -24,7 +24,7 @@ use crate::hummock::level_handler::LevelHandler; // key_range and selects the appropriate files to generate compaction pub struct SpaceReclaimCompactionPicker { // config - pub max_space_reclaim_bytes: u64, + pub _max_space_reclaim_bytes: u64, // for filter pub all_table_ids: HashSet, @@ -40,7 +40,7 @@ pub struct SpaceReclaimPickerState { impl SpaceReclaimCompactionPicker { pub fn new(max_space_reclaim_bytes: u64, all_table_ids: HashSet) -> Self { Self { - max_space_reclaim_bytes, + _max_space_reclaim_bytes: max_space_reclaim_bytes, all_table_ids, } } diff --git a/src/meta/src/hummock/manager/compaction.rs b/src/meta/src/hummock/manager/compaction.rs index e17bfbf3b2647..ba9954607ab73 100644 --- a/src/meta/src/hummock/manager/compaction.rs +++ b/src/meta/src/hummock/manager/compaction.rs @@ -50,7 +50,7 @@ pub struct Compaction { /// `CompactStatus` of each compaction group pub compaction_statuses: BTreeMap, - pub deterministic_mode: bool, + pub _deterministic_mode: bool, } impl HummockManager { diff --git a/src/meta/src/hummock/manager/mod.rs b/src/meta/src/hummock/manager/mod.rs index 6f367350a233c..1b1f99df38fba 100644 --- a/src/meta/src/hummock/manager/mod.rs +++ b/src/meta/src/hummock/manager/mod.rs @@ -926,7 +926,7 @@ impl HummockManager { break; } - if current_version.levels.get(&compaction_group_id).is_none() { + if !current_version.levels.contains_key(&compaction_group_id) { continue; } @@ -1058,8 +1058,9 @@ impl HummockManager { compact_task.set_task_status(TaskStatus::Success); compact_status.report_compact_task(&compact_task); if !is_trivial_reclaim { - compact_task.sorted_output_ssts = - compact_task.input_ssts[0].table_infos.clone(); + compact_task + .sorted_output_ssts + .clone_from(&compact_task.input_ssts[0].table_infos); } self.metrics .compact_frequency diff --git a/src/meta/src/manager/catalog/mod.rs b/src/meta/src/manager/catalog/mod.rs index b600a4a16c54b..040a91a1bc1e5 100644 --- a/src/meta/src/manager/catalog/mod.rs +++ b/src/meta/src/manager/catalog/mod.rs @@ -19,7 +19,6 @@ mod utils; use std::collections::{BTreeMap, HashMap, HashSet, VecDeque}; use std::iter; -use std::option::Option::Some; use std::sync::Arc; use anyhow::{anyhow, Context}; @@ -3969,7 +3968,7 @@ impl CatalogManager { id ))); } - if user_core.catalog_create_ref_count.get(&id).is_some() { + if user_core.catalog_create_ref_count.contains_key(&id) { return Err(MetaError::permission_denied(format!( "User {} cannot be dropped because some objects depend on it", user.name diff --git a/src/meta/src/manager/env.rs b/src/meta/src/manager/env.rs index 5006f5864e84f..1d9ef9fc27452 100644 --- a/src/meta/src/manager/env.rs +++ b/src/meta/src/manager/env.rs @@ -275,7 +275,7 @@ pub struct MetaOpts { /// The maximum number of trivial move tasks to be picked in a single loop pub max_trivial_move_task_count_per_loop: usize, - /// The maximum number of times to probe for PullTaskEvent + /// The maximum number of times to probe for `PullTaskEvent` pub max_get_task_probe_times: usize, } diff --git a/src/meta/src/manager/metadata.rs b/src/meta/src/manager/metadata.rs index ffd791fd23b9d..241a47941755b 100644 --- a/src/meta/src/manager/metadata.rs +++ b/src/meta/src/manager/metadata.rs @@ -64,6 +64,7 @@ pub struct MetadataManagerV2 { #[derive(Debug)] pub(crate) enum ActiveStreamingWorkerChange { Add(WorkerNode), + #[expect(dead_code)] Remove(WorkerNode), Update(WorkerNode), } diff --git a/src/meta/src/rpc/election/sql.rs b/src/meta/src/rpc/election/sql.rs index 49dd0474d4975..9ec5bd199cf76 100644 --- a/src/meta/src/rpc/election/sql.rs +++ b/src/meta/src/rpc/election/sql.rs @@ -715,7 +715,7 @@ where break; } else if prev_leader != election_row.id { tracing::info!("leader is {}", election_row.id); - prev_leader = election_row.id.clone(); + prev_leader.clone_from(&election_row.id) } timeout_ticker.reset(); diff --git a/src/meta/src/storage/etcd_meta_store.rs b/src/meta/src/storage/etcd_meta_store.rs index 8c5f93f9dd9ac..1986dab6247d6 100644 --- a/src/meta/src/storage/etcd_meta_store.rs +++ b/src/meta/src/storage/etcd_meta_store.rs @@ -14,7 +14,6 @@ use std::sync::atomic::{self, AtomicI64}; -use anyhow; use async_trait::async_trait; use etcd_client::{Compare, CompareOp, Error as EtcdError, GetOptions, Txn, TxnOp}; use futures::Future; diff --git a/src/meta/src/stream/stream_manager.rs b/src/meta/src/stream/stream_manager.rs index 58c3b9add64c5..f55caa3ea67b0 100644 --- a/src/meta/src/stream/stream_manager.rs +++ b/src/meta/src/stream/stream_manager.rs @@ -778,13 +778,12 @@ impl GlobalStreamManager { #[cfg(test)] mod tests { - use std::collections::{BTreeMap, HashMap, HashSet}; + use std::collections::BTreeMap; use std::net::SocketAddr; - use std::sync::{Arc, Mutex}; + use std::sync::Mutex; use std::time::Duration; use futures::{Stream, TryStreamExt}; - use risingwave_common::catalog::TableId; use risingwave_common::hash::ParallelUnitMapping; use risingwave_common::system_param::reader::SystemParamsRead; use risingwave_pb::common::{HostAddress, WorkerType}; @@ -797,10 +796,7 @@ mod tests { StreamService, StreamServiceServer, }; use risingwave_pb::stream_service::streaming_control_stream_response::InitResponse; - use risingwave_pb::stream_service::{ - BroadcastActorInfoTableResponse, BuildActorsResponse, DropActorsRequest, - DropActorsResponse, UpdateActorsResponse, *, - }; + use risingwave_pb::stream_service::*; use tokio::spawn; use tokio::sync::mpsc::unbounded_channel; use tokio::sync::oneshot::Sender; @@ -812,14 +808,14 @@ mod tests { use tonic::{Request, Response, Status, Streaming}; use super::*; - use crate::barrier::{GlobalBarrierManager, StreamRpcManager}; + use crate::barrier::GlobalBarrierManager; use crate::hummock::{CompactorManager, HummockManager}; use crate::manager::sink_coordination::SinkCoordinatorManager; use crate::manager::{ CatalogManager, CatalogManagerRef, ClusterManager, FragmentManager, FragmentManagerRef, - MetaSrvEnv, RelationIdEnum, StreamingClusterInfo, + RelationIdEnum, StreamingClusterInfo, }; - use crate::model::{ActorId, FragmentId}; + use crate::model::FragmentId; use crate::rpc::ddl_controller::DropMode; use crate::rpc::metrics::MetaMetrics; use crate::stream::{ScaleController, SourceManager}; diff --git a/src/object_store/Cargo.toml b/src/object_store/Cargo.toml index e4d573e8f4d2d..fa3f50964dcfa 100644 --- a/src/object_store/Cargo.toml +++ b/src/object_store/Cargo.toml @@ -23,14 +23,14 @@ crc32fast = "1" either = "1" fail = "0.5" futures = { version = "0.3", default-features = false, features = ["alloc"] } -hyper = { version = "0.14", features = ["tcp", "client"] } # required by aws sdk +hyper = { version = "0.14", features = ["tcp", "client"] } # required by aws sdk hyper-rustls = { version = "0.24.2", features = ["webpki-roots"] } hyper-tls = "0.5.0" itertools = { workspace = true } -madsim = "0.2.22" +madsim = "0.2.27" opendal = "0.45.1" prometheus = { version = "0.13", features = ["process"] } -reqwest = "0.11" # required by opendal +reqwest = "0.11" # required by opendal risingwave_common = { workspace = true } rustls = "0.23.5" spin = "0.9" diff --git a/src/object_store/src/object/error.rs b/src/object_store/src/object/error.rs index 38399a59a5a2f..aa79f53c4c065 100644 --- a/src/object_store/src/object/error.rs +++ b/src/object_store/src/object/error.rs @@ -13,7 +13,6 @@ // limitations under the License. use std::io; -use std::marker::{Send, Sync}; use aws_sdk_s3::operation::get_object::GetObjectError; use aws_sdk_s3::operation::head_object::HeadObjectError; diff --git a/src/object_store/src/object/mem.rs b/src/object_store/src/object/mem.rs index 3a1a7ed655e81..b790a2cdecf5e 100644 --- a/src/object_store/src/object/mem.rs +++ b/src/object_store/src/object/mem.rs @@ -307,7 +307,6 @@ impl Stream for InMemObjectIter { #[cfg(test)] mod tests { - use bytes::Bytes; use futures::TryStreamExt; use itertools::enumerate; diff --git a/src/object_store/src/object/opendal_engine/opendal_object_store.rs b/src/object_store/src/object/opendal_engine/opendal_object_store.rs index c073df7c1e102..e58fe6cf44192 100644 --- a/src/object_store/src/object/opendal_engine/opendal_object_store.rs +++ b/src/object_store/src/object/opendal_engine/opendal_object_store.rs @@ -307,8 +307,6 @@ impl StreamingUploader for OpendalStreamingUploader { #[cfg(test)] mod tests { - use bytes::Bytes; - use super::*; async fn list_all(prefix: &str, store: &OpendalObjectStore) -> Vec { diff --git a/src/prost/helpers/src/generate.rs b/src/prost/helpers/src/generate.rs index 432f233e74cb9..f674fec5aa2cf 100644 --- a/src/prost/helpers/src/generate.rs +++ b/src/prost/helpers/src/generate.rs @@ -17,8 +17,8 @@ use quote::quote; use syn::ext::IdentExt; use syn::spanned::Spanned; use syn::{ - self, Error, Expr, ExprLit, Field, GenericArgument, Lit, Meta, PathArguments, PathSegment, - Result, Type, + Error, Expr, ExprLit, Field, GenericArgument, Lit, Meta, PathArguments, PathSegment, Result, + Type, }; fn extract_type_from_option(option_segment: &PathSegment) -> Type { diff --git a/src/prost/src/lib.rs b/src/prost/src/lib.rs index 825e721891fed..d4f0359fadab2 100644 --- a/src/prost/src/lib.rs +++ b/src/prost/src/lib.rs @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// for derived code of `Message` #![expect(clippy::all)] #![expect(clippy::doc_markdown)] -#![allow(non_snake_case)] // for derived code of `Message` #![feature(lint_reasons)] use std::str::FromStr; diff --git a/src/risedevtool/src/bin/risedev-compose.rs b/src/risedevtool/src/bin/risedev-compose.rs index 748da07a9d35e..ec805a840fa71 100644 --- a/src/risedevtool/src/bin/risedev-compose.rs +++ b/src/risedevtool/src/bin/risedev-compose.rs @@ -19,7 +19,7 @@ use std::path::Path; use anyhow::{anyhow, Result}; use clap::Parser; use console::style; -use fs_err::{self, File}; +use fs_err::File; use itertools::Itertools; use risedev::{ compose_deploy, generate_risedev_env, Compose, ComposeConfig, ComposeDeployConfig, ComposeFile, diff --git a/src/sqlparser/src/parser.rs b/src/sqlparser/src/parser.rs index 0751eb7aec140..84b1e1d97808d 100644 --- a/src/sqlparser/src/parser.rs +++ b/src/sqlparser/src/parser.rs @@ -25,12 +25,7 @@ use core::fmt; use itertools::Itertools; use tracing::{debug, instrument}; -use self::ddl::AlterSubscriptionOperation; -use crate::ast::ddl::{ - AlterConnectionOperation, AlterDatabaseOperation, AlterFunctionOperation, AlterIndexOperation, - AlterSchemaOperation, AlterSinkOperation, AlterViewOperation, SourceWatermark, -}; -use crate::ast::{ParseTo, *}; +use crate::ast::*; use crate::keywords::{self, Keyword}; use crate::tokenizer::*; diff --git a/src/sqlparser/tests/sqlparser_common.rs b/src/sqlparser/tests/sqlparser_common.rs index ff0e9d2e53c40..ac6a1d310944a 100644 --- a/src/sqlparser/tests/sqlparser_common.rs +++ b/src/sqlparser/tests/sqlparser_common.rs @@ -25,7 +25,6 @@ use risingwave_sqlparser::ast::*; use risingwave_sqlparser::keywords::ALL_KEYWORDS; use risingwave_sqlparser::parser::ParserError; use risingwave_sqlparser::test_utils::*; -use test_utils::{expr_from_projection, join, number, only, table, table_alias}; #[test] fn parse_insert_values() { diff --git a/src/sqlparser/tests/test_utils/mod.rs b/src/sqlparser/tests/test_utils/mod.rs index 6df188a90ff29..c72dbc33d0635 100644 --- a/src/sqlparser/tests/test_utils/mod.rs +++ b/src/sqlparser/tests/test_utils/mod.rs @@ -11,6 +11,7 @@ // limitations under the License. // Re-export everything from `src/test_utils.rs`. +#[allow(unused_imports)] pub use risingwave_sqlparser::test_utils::*; // For the test-only macros we take a different approach of keeping them here diff --git a/src/storage/Cargo.toml b/src/storage/Cargo.toml index 2d123a06ce0cb..844f915192e36 100644 --- a/src/storage/Cargo.toml +++ b/src/storage/Cargo.toml @@ -14,7 +14,7 @@ ignored = ["workspace-hack"] normal = ["workspace-hack"] [dependencies] -ahash = "0.8" +ahash = "0.8.7" anyhow = "1" arc-swap = "1" async-trait = "0.1" diff --git a/src/storage/benches/bench_fs_operation.rs b/src/storage/benches/bench_fs_operation.rs index 0983883fdaa44..8d0b20987686c 100644 --- a/src/storage/benches/bench_fs_operation.rs +++ b/src/storage/benches/bench_fs_operation.rs @@ -217,6 +217,7 @@ fn gen_std_files(path: &Path) -> impl IntoIterator { .read(true) .write(true) .create(true) + .truncate(true) .open(file_path) .unwrap(); ret diff --git a/src/storage/compactor/src/lib.rs b/src/storage/compactor/src/lib.rs index 3ceb9f8954e3b..d9fbe5189f43f 100644 --- a/src/storage/compactor/src/lib.rs +++ b/src/storage/compactor/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![feature(lint_reasons)] + mod compactor_observer; mod rpc; pub mod server; diff --git a/src/storage/compactor/src/telemetry.rs b/src/storage/compactor/src/telemetry.rs index 2bf7aaaa3f508..b01fdd1e258f3 100644 --- a/src/storage/compactor/src/telemetry.rs +++ b/src/storage/compactor/src/telemetry.rs @@ -33,6 +33,7 @@ impl CompactorTelemetryCreator { #[async_trait::async_trait] impl TelemetryReportCreator for CompactorTelemetryCreator { + #[allow(refining_impl_trait)] async fn create_report( &self, tracking_id: String, diff --git a/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs b/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs index 585d64f7d4663..702b9402daaa2 100644 --- a/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs +++ b/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs @@ -1277,13 +1277,7 @@ pub fn validate_version(version: &HummockVersion) -> Vec { let mut prev_table_info: Option<&SstableInfo> = None; for table_info in &level.table_infos { // Ensure table_ids are sorted and unique - if !table_info.table_ids.is_sorted_by(|a, b| { - if a < b { - Some(Ordering::Less) - } else { - Some(Ordering::Greater) - } - }) { + if !table_info.table_ids.is_sorted_by(|a, b| a < b) { res.push(format!( "{} SST {}: table_ids not sorted", level_identifier, table_info.object_id diff --git a/src/storage/hummock_sdk/src/key.rs b/src/storage/hummock_sdk/src/key.rs index fd0d2fcda2059..6a33d1ff1a09b 100644 --- a/src/storage/hummock_sdk/src/key.rs +++ b/src/storage/hummock_sdk/src/key.rs @@ -483,7 +483,11 @@ impl> TableKey { "too short table key: {:?}", self.0.as_ref() ); - let (vnode, inner_key) = self.0.as_ref().split_array_ref::<{ VirtualNode::SIZE }>(); + let (vnode, inner_key) = self + .0 + .as_ref() + .split_first_chunk::<{ VirtualNode::SIZE }>() + .unwrap(); (VirtualNode::from_be_bytes(*vnode), inner_key) } @@ -1111,8 +1115,6 @@ impl + Ord + Eq, const SKIP_DEDUP: bool> FullKeyTracker String { +impl Display for WatermarkDirection { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - WatermarkDirection::Ascending => "Ascending".to_string(), - WatermarkDirection::Descending => "Descending".to_string(), + WatermarkDirection::Ascending => write!(f, "Ascending"), + WatermarkDirection::Descending => write!(f, "Descending"), } } } @@ -551,13 +551,8 @@ impl TableWatermarks { // epoch watermark are added from later epoch to earlier epoch. // reverse to ensure that earlier epochs are at the front result_epoch_watermark.reverse(); - assert!( - result_epoch_watermark.is_sorted_by(|(first_epoch, _), (second_epoch, _)| { - let ret = first_epoch.cmp(second_epoch); - assert_ne!(ret, Ordering::Equal); - Some(ret) - }) - ); + assert!(result_epoch_watermark + .is_sorted_by(|(first_epoch, _), (second_epoch, _)| { first_epoch < second_epoch })); *self = TableWatermarks { watermarks: result_epoch_watermark, direction: self.direction, diff --git a/src/storage/hummock_test/benches/bench_hummock_iter.rs b/src/storage/hummock_test/benches/bench_hummock_iter.rs index 1c92b453fe474..9f0cef22e4e43 100644 --- a/src/storage/hummock_test/benches/bench_hummock_iter.rs +++ b/src/storage/hummock_test/benches/bench_hummock_iter.rs @@ -32,7 +32,6 @@ use risingwave_storage::hummock::test_utils::default_opts_for_test; use risingwave_storage::hummock::{CachePolicy, HummockStorage}; use risingwave_storage::storage_value::StorageValue; use risingwave_storage::store::*; -use risingwave_storage::StateStore; fn gen_interleave_shared_buffer_batch_iter( batch_size: usize, diff --git a/src/storage/hummock_test/src/bin/replay/main.rs b/src/storage/hummock_test/src/bin/replay/main.rs index f5c837208490d..89ad5907fae57 100644 --- a/src/storage/hummock_test/src/bin/replay/main.rs +++ b/src/storage/hummock_test/src/bin/replay/main.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(bound_map)] #![feature(coroutines)] #![feature(stmt_expr_attributes)] #![feature(proc_macro_hygiene)] diff --git a/src/storage/hummock_test/src/hummock_storage_tests.rs b/src/storage/hummock_test/src/hummock_storage_tests.rs index 33c1fcac33dae..599b261a17b8c 100644 --- a/src/storage/hummock_test/src/hummock_storage_tests.rs +++ b/src/storage/hummock_test/src/hummock_storage_tests.rs @@ -37,7 +37,6 @@ use risingwave_storage::hummock::store::version::read_filter_for_version; use risingwave_storage::hummock::{CachePolicy, HummockStorage, LocalHummockStorage}; use risingwave_storage::storage_value::StorageValue; use risingwave_storage::store::*; -use risingwave_storage::StateStore; use crate::local_state_store_test_utils::LocalStateStoreTestExt; use crate::test_utils::{gen_key_from_str, prepare_hummock_test_env, TestIngestBatch}; diff --git a/src/storage/hummock_test/src/lib.rs b/src/storage/hummock_test/src/lib.rs index 890277678b756..a89ead17944f5 100644 --- a/src/storage/hummock_test/src/lib.rs +++ b/src/storage/hummock_test/src/lib.rs @@ -14,9 +14,7 @@ #![feature(proc_macro_hygiene, stmt_expr_attributes)] #![feature(custom_test_frameworks)] #![test_runner(risingwave_test_runner::test_runner::run_failpont_tests)] -#![feature(bound_map)] #![feature(type_alias_impl_trait)] -#![feature(associated_type_bounds)] #[cfg(test)] mod compactor_tests; diff --git a/src/storage/hummock_test/src/test_utils.rs b/src/storage/hummock_test/src/test_utils.rs index 06a0d43ccac83..9a4e674e1f8a9 100644 --- a/src/storage/hummock_test/src/test_utils.rs +++ b/src/storage/hummock_test/src/test_utils.rs @@ -117,6 +117,7 @@ impl TestIngestBatch for S { #[cfg(test)] #[async_trait::async_trait] pub(crate) trait HummockStateStoreTestTrait: StateStore { + #[allow(dead_code)] fn get_pinned_version(&self) -> PinnedVersion; async fn seal_and_sync_epoch(&self, epoch: u64) -> StorageResult { self.seal_epoch(epoch, true); diff --git a/src/storage/hummock_trace/src/lib.rs b/src/storage/hummock_trace/src/lib.rs index 0de5680908254..64417832206e0 100644 --- a/src/storage/hummock_trace/src/lib.rs +++ b/src/storage/hummock_trace/src/lib.rs @@ -14,7 +14,6 @@ #![feature(lazy_cell)] #![feature(cursor_remaining)] -#![feature(bound_map)] #![feature(trait_alias)] #![feature(coroutines)] diff --git a/src/storage/hummock_trace/src/replay/worker.rs b/src/storage/hummock_trace/src/replay/worker.rs index 29e814c3f9ade..2c2cef690b19d 100644 --- a/src/storage/hummock_trace/src/replay/worker.rs +++ b/src/storage/hummock_trace/src/replay/worker.rs @@ -530,13 +530,10 @@ mod tests { use bytes::Bytes; use mockall::predicate; - use tokio::sync::mpsc::unbounded_channel; use super::*; use crate::replay::{MockGlobalReplayInterface, MockLocalReplayInterface}; - use crate::{ - MockReplayIterStream, StorageType, TracedBytes, TracedNewLocalOptions, TracedReadOptions, - }; + use crate::{MockReplayIterStream, TracedBytes, TracedReadOptions}; #[tokio::test] async fn test_handle_record() { diff --git a/src/storage/hummock_trace/src/write.rs b/src/storage/hummock_trace/src/write.rs index 528cdac5f659d..5cf10b39378f2 100644 --- a/src/storage/hummock_trace/src/write.rs +++ b/src/storage/hummock_trace/src/write.rs @@ -103,7 +103,7 @@ impl> Drop for TraceWriterImpl { mod test { use std::io::Cursor; - use bincode::{config, decode_from_slice, encode_to_vec}; + use bincode::{decode_from_slice, encode_to_vec}; use byteorder::{BigEndian, ReadBytesExt}; use bytes::Bytes; diff --git a/src/storage/src/hummock/compactor/compactor_runner.rs b/src/storage/src/hummock/compactor/compactor_runner.rs index bb28d27a1f7d1..05b3d7dd182d9 100644 --- a/src/storage/src/hummock/compactor/compactor_runner.rs +++ b/src/storage/src/hummock/compactor/compactor_runner.rs @@ -276,7 +276,9 @@ pub fn partition_overlapping_sstable_infos( &prev_group.max_right_bound, &sst.key_range.as_ref().unwrap().left, ) { - prev_group.max_right_bound = sst.key_range.as_ref().unwrap().right.clone(); + prev_group + .max_right_bound + .clone_from(&sst.key_range.as_ref().unwrap().right); prev_group.ssts.push(sst); continue; } diff --git a/src/storage/src/hummock/event_handler/refiller.rs b/src/storage/src/hummock/event_handler/refiller.rs index e640c7aae7a8e..a6d9863152ee0 100644 --- a/src/storage/src/hummock/event_handler/refiller.rs +++ b/src/storage/src/hummock/event_handler/refiller.rs @@ -291,9 +291,7 @@ impl CacheRefiller { /// Clear the queue for cache refill and return an event that merges all pending cache refill events /// into a single event that takes the earliest and latest version. pub(crate) fn clear(&mut self) -> Option { - let Some(last_item) = self.queue.pop_back() else { - return None; - }; + let last_item = self.queue.pop_back()?; let mut event = last_item.event; while let Some(item) = self.queue.pop_back() { assert_eq!( diff --git a/src/storage/src/hummock/iterator/backward_user.rs b/src/storage/src/hummock/iterator/backward_user.rs index 64608c5c92213..2418a086c4a39 100644 --- a/src/storage/src/hummock/iterator/backward_user.rs +++ b/src/storage/src/hummock/iterator/backward_user.rs @@ -313,7 +313,6 @@ mod tests { }; use crate::hummock::iterator::MergeIterator; use crate::hummock::test_utils::gen_test_sstable; - use crate::hummock::value::HummockValue; use crate::hummock::{BackwardSstableIterator, SstableStoreRef, TableHolder}; #[tokio::test] diff --git a/src/storage/src/hummock/iterator/change_log.rs b/src/storage/src/hummock/iterator/change_log.rs index f2b39c524cb18..7f4d17af6d740 100644 --- a/src/storage/src/hummock/iterator/change_log.rs +++ b/src/storage/src/hummock/iterator/change_log.rs @@ -56,10 +56,10 @@ struct ChangeLogIteratorInner< /// Indicate whether the current new value is delete. is_new_value_delete: bool, - /// Whether Indicate whether the current `old_value_iter` represents the old value in ChangeLogValue + /// Whether Indicate whether the current `old_value_iter` represents the old value in `ChangeLogValue` is_old_value_set: bool, - /// Whether the iterator is currently pointing at a valid key with ChangeLogValue + /// Whether the iterator is currently pointing at a valid key with `ChangeLogValue` is_current_pos_valid: bool, } diff --git a/src/storage/src/hummock/iterator/forward_user.rs b/src/storage/src/hummock/iterator/forward_user.rs index 3a9f2a7dd9318..32456eaa27ca5 100644 --- a/src/storage/src/hummock/iterator/forward_user.rs +++ b/src/storage/src/hummock/iterator/forward_user.rs @@ -274,7 +274,6 @@ mod tests { SstableIterator, SstableIteratorReadOptions, SstableIteratorType, }; use crate::hummock::sstable_store::SstableStoreRef; - use crate::hummock::value::HummockValue; use crate::hummock::TableHolder; #[tokio::test] diff --git a/src/storage/src/hummock/iterator/test_utils.rs b/src/storage/src/hummock/iterator/test_utils.rs index 30c0a80898564..e9b1c7498612b 100644 --- a/src/storage/src/hummock/iterator/test_utils.rs +++ b/src/storage/src/hummock/iterator/test_utils.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::iter::Iterator; use std::sync::Arc; use bytes::Bytes; diff --git a/src/storage/src/hummock/shared_buffer/shared_buffer_batch.rs b/src/storage/src/hummock/shared_buffer/shared_buffer_batch.rs index ecffa11871000..ba9d3311b2e0b 100644 --- a/src/storage/src/hummock/shared_buffer/shared_buffer_batch.rs +++ b/src/storage/src/hummock/shared_buffer/shared_buffer_batch.rs @@ -968,7 +968,7 @@ impl DeleteRangeIterator for SharedBufferDeleteRangeIterator { #[cfg(test)] mod tests { - use std::ops::Bound::{Excluded, Included}; + use std::ops::Bound::Excluded; use itertools::{zip_eq, Itertools}; use risingwave_common::util::epoch::{test_epoch, EpochExt}; diff --git a/src/storage/src/hummock/sstable/block.rs b/src/storage/src/hummock/sstable/block.rs index 3d1baf05cad36..9ba69882db663 100644 --- a/src/storage/src/hummock/sstable/block.rs +++ b/src/storage/src/hummock/sstable/block.rs @@ -23,7 +23,6 @@ use risingwave_common::catalog::TableId; use risingwave_hummock_sdk::key::FullKey; use risingwave_hummock_sdk::KeyComparator; use serde::{Deserialize, Serialize}; -use {lz4, zstd}; use super::utils::{bytes_diff_below_max_key_length, xxhash64_verify, CompressionAlgorithm}; use crate::hummock::sstable::utils; @@ -814,9 +813,9 @@ impl BlockBuilder { #[cfg(test)] mod tests { - use risingwave_common::catalog::TableId; + use risingwave_common::util::epoch::test_epoch; - use risingwave_hummock_sdk::key::{FullKey, MAX_KEY_LEN}; + use risingwave_hummock_sdk::key::MAX_KEY_LEN; use super::*; use crate::hummock::{BlockHolder, BlockIterator}; diff --git a/src/storage/src/hummock/sstable/block_iterator.rs b/src/storage/src/hummock/sstable/block_iterator.rs index 7344d033ddde4..daf25024846c4 100644 --- a/src/storage/src/hummock/sstable/block_iterator.rs +++ b/src/storage/src/hummock/sstable/block_iterator.rs @@ -330,11 +330,10 @@ impl BlockIterator { #[cfg(test)] mod tests { - use risingwave_common::catalog::TableId; use risingwave_common::util::epoch::test_epoch; use super::*; - use crate::hummock::{Block, BlockBuilder, BlockBuilderOptions}; + use crate::hummock::{BlockBuilder, BlockBuilderOptions}; fn build_iterator_for_test() -> BlockIterator { let options = BlockBuilderOptions::default(); diff --git a/src/storage/src/hummock/sstable/builder.rs b/src/storage/src/hummock/sstable/builder.rs index 9159e8209082a..9b007f629f74a 100644 --- a/src/storage/src/hummock/sstable/builder.rs +++ b/src/storage/src/hummock/sstable/builder.rs @@ -626,9 +626,7 @@ pub(super) mod tests { default_builder_opt_for_test, gen_test_sstable_impl, mock_sst_writer, test_key_of, test_value_of, TEST_KEYS_COUNT, }; - use crate::hummock::{ - CachePolicy, Sstable, SstableWriterOptions, Xor16FilterBuilder, Xor8FilterBuilder, - }; + use crate::hummock::{CachePolicy, Sstable, SstableWriterOptions, Xor8FilterBuilder}; use crate::monitor::StoreLocalStatistic; #[tokio::test] diff --git a/src/storage/src/hummock/sstable/multi_builder.rs b/src/storage/src/hummock/sstable/multi_builder.rs index 926a4bdb9bb53..7354cb89c81fc 100644 --- a/src/storage/src/hummock/sstable/multi_builder.rs +++ b/src/storage/src/hummock/sstable/multi_builder.rs @@ -370,13 +370,12 @@ impl TableBuilderFactory for LocalTableBuilderFactory { #[cfg(test)] mod tests { use risingwave_common::catalog::TableId; - use risingwave_common::hash::VirtualNode; use risingwave_common::util::epoch::{test_epoch, EpochExt}; use super::*; use crate::hummock::iterator::test_utils::mock_sstable_store; use crate::hummock::test_utils::{default_builder_opt_for_test, test_key_of, test_user_key_of}; - use crate::hummock::{SstableBuilderOptions, DEFAULT_RESTART_INTERVAL}; + use crate::hummock::DEFAULT_RESTART_INTERVAL; #[tokio::test] async fn test_empty() { diff --git a/src/storage/src/hummock/sstable/xor_filter.rs b/src/storage/src/hummock/sstable/xor_filter.rs index c107599715511..1df4333fca459 100644 --- a/src/storage/src/hummock/sstable/xor_filter.rs +++ b/src/storage/src/hummock/sstable/xor_filter.rs @@ -453,7 +453,7 @@ mod tests { use crate::hummock::sstable::{SstableBuilder, SstableBuilderOptions}; use crate::hummock::test_utils::{test_user_key_of, test_value_of, TEST_KEYS_COUNT}; use crate::hummock::value::HummockValue; - use crate::hummock::{BlockIterator, CachePolicy, Sstable, SstableWriterOptions}; + use crate::hummock::{BlockIterator, CachePolicy, SstableWriterOptions}; use crate::monitor::StoreLocalStatistic; #[tokio::test] diff --git a/src/storage/src/hummock/store/hummock_storage.rs b/src/storage/src/hummock/store/hummock_storage.rs index d082ca89d84db..806ec7e46eeb3 100644 --- a/src/storage/src/hummock/store/hummock_storage.rs +++ b/src/storage/src/hummock/store/hummock_storage.rs @@ -60,7 +60,6 @@ use crate::mem_table::ImmutableMemtable; use crate::monitor::{CompactorMetrics, HummockStateStoreMetrics, StoreLocalStatistic}; use crate::opts::StorageOpts; use crate::store::*; -use crate::StateStore; struct HummockStorageShutdownGuard { shutdown_sender: HummockEventSender, diff --git a/src/storage/src/hummock/store/version.rs b/src/storage/src/hummock/store/version.rs index 9f94895e2bba7..f772fbbe79d93 100644 --- a/src/storage/src/hummock/store/version.rs +++ b/src/storage/src/hummock/store/version.rs @@ -90,7 +90,7 @@ impl StagingSstableInfo { imm_size: usize, ) -> Self { // the epochs are sorted from higher epoch to lower epoch - assert!(epochs.is_sorted_by(|epoch1, epoch2| epoch2.partial_cmp(epoch1))); + assert!(epochs.is_sorted_by(|epoch1, epoch2| epoch2 <= epoch1)); Self { sstable_infos, old_value_sstable_infos, diff --git a/src/storage/src/lib.rs b/src/storage/src/lib.rs index 505eec276fbf4..21c0c7f49ae4c 100644 --- a/src/storage/src/lib.rs +++ b/src/storage/src/lib.rs @@ -14,7 +14,6 @@ #![feature(allocator_api)] #![feature(bound_as_ref)] -#![feature(bound_map)] #![feature(custom_test_frameworks)] #![feature(extract_if)] #![feature(coroutines)] @@ -37,7 +36,6 @@ #![recursion_limit = "256"] #![feature(error_generic_member_access)] #![feature(let_chains)] -#![feature(associated_type_bounds)] #![feature(exclusive_range_pattern)] #![feature(impl_trait_in_assoc_type)] #![feature(maybe_uninit_uninit_array)] diff --git a/src/storage/src/memory.rs b/src/storage/src/memory.rs index 5e645aa7ea57f..3bf4030ce62f8 100644 --- a/src/storage/src/memory.rs +++ b/src/storage/src/memory.rs @@ -350,7 +350,6 @@ mod batched_iter { #[cfg(test)] mod tests { use rand::Rng; - use risingwave_hummock_sdk::key::FullKey; use super::*; use crate::memory::sled::SledRangeKv; diff --git a/src/storage/src/monitor/traced_store.rs b/src/storage/src/monitor/traced_store.rs index 47c0de67729b6..df93f4c2d1a12 100644 --- a/src/storage/src/monitor/traced_store.rs +++ b/src/storage/src/monitor/traced_store.rs @@ -29,7 +29,6 @@ use crate::error::StorageResult; use crate::hummock::sstable_store::SstableStoreRef; use crate::hummock::{HummockStorage, SstableObjectIdManagerRef}; use crate::store::*; -use crate::StateStore; #[derive(Clone)] pub struct TracedStateStore { diff --git a/src/storage/src/row_serde/value_serde.rs b/src/storage/src/row_serde/value_serde.rs index bde7091597605..c4d4ef8b808f7 100644 --- a/src/storage/src/row_serde/value_serde.rs +++ b/src/storage/src/row_serde/value_serde.rs @@ -145,7 +145,6 @@ mod tests { use std::collections::HashSet; use risingwave_common::catalog::ColumnId; - use risingwave_common::row::OwnedRow; use risingwave_common::types::ScalarImpl::*; use risingwave_common::util::value_encoding::column_aware_row_encoding; use risingwave_common::util::value_encoding::column_aware_row_encoding::try_drop_invalid_columns; diff --git a/src/storage/src/store.rs b/src/storage/src/store.rs index ade0ad7ffff64..f389691f94c20 100644 --- a/src/storage/src/store.rs +++ b/src/storage/src/store.rs @@ -66,7 +66,8 @@ pub fn to_owned_item((key, value): StateStoreIterItemRef<'_>) -> StorageResult: StateStoreIter + Sized { - type ItemStream: Stream> + Send; + type ItemStream Fn(T::ItemRef<'a>) -> StorageResult>: Stream> + + Send; fn into_stream Fn(T::ItemRef<'a>) -> StorageResult + Send>( self, @@ -151,7 +152,8 @@ impl> FusedStateStoreIter { } impl> StateStoreIterExt for I { - type ItemStream = impl Stream> + Send; + type ItemStream Fn(T::ItemRef<'a>) -> StorageResult> = + impl Stream> + Send; fn into_stream Fn(T::ItemRef<'a>) -> StorageResult + Send>( self, diff --git a/src/storage/src/store_impl.rs b/src/storage/src/store_impl.rs index de9044d766a21..143cf5cc50080 100644 --- a/src/storage/src/store_impl.rs +++ b/src/storage/src/store_impl.rs @@ -223,7 +223,6 @@ pub mod verify { use crate::storage_value::StorageValue; use crate::store::*; use crate::store_impl::AsHummock; - use crate::StateStore; fn assert_result_eq( first: &std::result::Result, @@ -779,7 +778,6 @@ pub mod boxed_state_store { use crate::hummock::HummockStorage; use crate::store::*; use crate::store_impl::AsHummock; - use crate::StateStore; #[async_trait::async_trait] pub trait DynamicDispatchedStateStoreIter: Send { diff --git a/src/storage/src/table/batch_table/storage_table.rs b/src/storage/src/table/batch_table/storage_table.rs index 29d931c373398..1435eb21029a2 100644 --- a/src/storage/src/table/batch_table/storage_table.rs +++ b/src/storage/src/table/batch_table/storage_table.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::default::Default; use std::ops::Bound::{self, Excluded, Included, Unbounded}; use std::ops::{Index, RangeBounds}; use std::sync::Arc; diff --git a/src/stream/spill_test/src/lib.rs b/src/stream/spill_test/src/lib.rs index 9c2d3d05bda70..deadc48ea9a33 100644 --- a/src/stream/spill_test/src/lib.rs +++ b/src/stream/spill_test/src/lib.rs @@ -13,9 +13,7 @@ // limitations under the License. #![feature(proc_macro_hygiene, stmt_expr_attributes)] #![feature(custom_test_frameworks)] -#![feature(bound_map)] #![feature(type_alias_impl_trait)] -#![feature(associated_type_bounds)] #[cfg(test)] mod test_mem_table; diff --git a/src/stream/src/common/compact_chunk.rs b/src/stream/src/common/compact_chunk.rs index 32dc4d0a996a6..5d6acb5125422 100644 --- a/src/stream/src/common/compact_chunk.rs +++ b/src/stream/src/common/compact_chunk.rs @@ -105,7 +105,7 @@ type OpRowMap<'a, 'b> = pub enum RowOp<'a> { Insert(RowRef<'a>), Delete(RowRef<'a>), - /// (old_value, new_value) + /// (`old_value`, `new_value`) Update((RowRef<'a>, RowRef<'a>)), } static LOG_SUPPERSSER: LazyLock = LazyLock::new(LogSuppresser::default); @@ -333,7 +333,6 @@ pub fn merge_chunk_row(stream_chunk: StreamChunk, pk_indices: &[usize]) -> Strea #[cfg(test)] mod tests { - use risingwave_common::array::StreamChunk; use risingwave_common::test_prelude::StreamChunkTestExt; use super::*; diff --git a/src/stream/src/common/log_store_impl/kv_log_store/serde.rs b/src/stream/src/common/log_store_impl/kv_log_store/serde.rs index 67167f466a50b..9eb7faf237ead 100644 --- a/src/stream/src/common/log_store_impl/kv_log_store/serde.rs +++ b/src/stream/src/common/log_store_impl/kv_log_store/serde.rs @@ -544,7 +544,7 @@ impl LogStoreRowOpStream { } } -pub(crate) type LogStoreItemMergeStream = +pub(crate) type LogStoreItemMergeStream = impl Stream>; pub(crate) fn merge_log_store_item_stream( iters: Vec, diff --git a/src/stream/src/common/table/state_table.rs b/src/stream/src/common/table/state_table.rs index 9d70543f63e9d..5be9dd96feb02 100644 --- a/src/stream/src/common/table/state_table.rs +++ b/src/stream/src/common/table/state_table.rs @@ -13,7 +13,6 @@ // limitations under the License. use std::collections::HashMap; -use std::default::Default; use std::ops::Bound; use std::ops::Bound::*; use std::sync::Arc; diff --git a/src/stream/src/executor/chain.rs b/src/stream/src/executor/chain.rs index ebcbe1e4e49bb..96b9422a97b2c 100644 --- a/src/stream/src/executor/chain.rs +++ b/src/stream/src/executor/chain.rs @@ -103,7 +103,6 @@ impl Execute for ChainExecutor { #[cfg(test)] mod test { - use std::default::Default; use futures::StreamExt; use risingwave_common::array::stream_chunk::StreamChunkTestExt; diff --git a/src/stream/src/executor/dedup/append_only_dedup.rs b/src/stream/src/executor/dedup/append_only_dedup.rs index f73e196815400..f98847cf1de4b 100644 --- a/src/stream/src/executor/dedup/append_only_dedup.rs +++ b/src/stream/src/executor/dedup/append_only_dedup.rs @@ -182,19 +182,15 @@ impl Execute for AppendOnlyDedupExecutor { #[cfg(test)] mod tests { use std::sync::atomic::AtomicU64; - use std::sync::Arc; - use risingwave_common::catalog::{ColumnDesc, ColumnId, Field, Schema, TableId}; + use risingwave_common::catalog::{ColumnDesc, ColumnId, Field, TableId}; use risingwave_common::test_prelude::StreamChunkTestExt; - use risingwave_common::types::DataType; use risingwave_common::util::epoch::test_epoch; use risingwave_common::util::sort_util::OrderType; use risingwave_storage::memory::MemoryStateStore; use super::*; - use crate::common::table::state_table::StateTable; use crate::executor::test_utils::MockSource; - use crate::executor::ActorContext; #[tokio::test] async fn test_dedup_executor() { diff --git a/src/stream/src/executor/dispatch.rs b/src/stream/src/executor/dispatch.rs index 6c644466f9683..9e6503c2d9a28 100644 --- a/src/stream/src/executor/dispatch.rs +++ b/src/stream/src/executor/dispatch.rs @@ -1029,26 +1029,21 @@ impl Dispatcher for SimpleDispatcher { #[cfg(test)] mod tests { use std::hash::{BuildHasher, Hasher}; - use std::sync::{Arc, Mutex}; + use std::sync::Mutex; use async_trait::async_trait; - use futures::{pin_mut, StreamExt}; - use itertools::Itertools; + use futures::pin_mut; use risingwave_common::array::stream_chunk::StreamChunkTestExt; - use risingwave_common::array::{Array, ArrayBuilder, I32ArrayBuilder, Op}; - use risingwave_common::catalog::Schema; + use risingwave_common::array::{Array, ArrayBuilder, I32ArrayBuilder}; use risingwave_common::config; - use risingwave_common::hash::VirtualNode; use risingwave_common::util::epoch::test_epoch; use risingwave_common::util::hash_util::Crc32FastBuilder; - use risingwave_common::util::iter_util::ZipEqFast; use risingwave_pb::stream_plan::DispatcherType; use super::*; use crate::executor::exchange::output::Output; use crate::executor::exchange::permit::channel_for_test; use crate::executor::receiver::ReceiverExecutor; - use crate::executor::Execute; use crate::task::test_utils::helper_make_local_actor; #[derive(Debug)] diff --git a/src/stream/src/executor/dml.rs b/src/stream/src/executor/dml.rs index b8839d76000c1..adcb3f01ab8bd 100644 --- a/src/stream/src/executor/dml.rs +++ b/src/stream/src/executor/dml.rs @@ -273,13 +273,9 @@ impl Execute for DmlExecutor { #[cfg(test)] mod tests { - use std::sync::Arc; - use risingwave_common::array::StreamChunk; - use risingwave_common::catalog::{ColumnId, Field, Schema, INITIAL_TABLE_VERSION_ID}; + use risingwave_common::catalog::{ColumnId, Field, INITIAL_TABLE_VERSION_ID}; use risingwave_common::test_prelude::StreamChunkTestExt; - use risingwave_common::transaction::transaction_id::TxnId; - use risingwave_common::types::DataType; use risingwave_common::util::epoch::test_epoch; use risingwave_dml::dml_manager::DmlManager; diff --git a/src/stream/src/executor/dynamic_filter.rs b/src/stream/src/executor/dynamic_filter.rs index ddbe8352b2e8a..e9c631202e8bb 100644 --- a/src/stream/src/executor/dynamic_filter.rs +++ b/src/stream/src/executor/dynamic_filter.rs @@ -13,7 +13,6 @@ // limitations under the License. use std::ops::Bound::{self, *}; -use std::sync::Arc; use futures::stream; use risingwave_common::array::{Array, ArrayImpl, Op}; @@ -21,7 +20,7 @@ use risingwave_common::bail; use risingwave_common::buffer::{Bitmap, BitmapBuilder}; use risingwave_common::hash::VnodeBitmapExt; use risingwave_common::row::{self, once, OwnedRow as RowData}; -use risingwave_common::types::{DataType, Datum, DefaultOrd, ScalarImpl, ToDatumRef, ToOwnedDatum}; +use risingwave_common::types::{DefaultOrd, ToDatumRef, ToOwnedDatum}; use risingwave_common::util::iter_util::ZipEqDebug; use risingwave_expr::expr::{ build_func_non_strict, InputRefExpression, LiteralExpression, NonStrictExpression, @@ -489,9 +488,8 @@ impl Execute #[cfg(test)] mod tests { - use risingwave_common::array::stream_chunk::StreamChunkTestExt; use risingwave_common::array::*; - use risingwave_common::catalog::{ColumnDesc, ColumnId, Field, Schema, TableId}; + use risingwave_common::catalog::{ColumnDesc, ColumnId, Field, TableId}; use risingwave_common::util::epoch::test_epoch; use risingwave_common::util::sort_util::OrderType; use risingwave_hummock_sdk::HummockReadEpoch; @@ -500,7 +498,6 @@ mod tests { use super::*; use crate::executor::test_utils::{MessageSender, MockSource, StreamExecutorTestExt}; - use crate::executor::{ActorContext, StreamExecutorResult}; async fn create_in_memory_state_table( mem_state: MemoryStateStore, diff --git a/src/stream/src/executor/error.rs b/src/stream/src/executor/error.rs index b1f411b2a4ec7..41b8198b646a3 100644 --- a/src/stream/src/executor/error.rs +++ b/src/stream/src/executor/error.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::AsRef; - use risingwave_common::array::ArrayError; use risingwave_common::error::{BoxedError, NotImplemented}; use risingwave_common::util::value_encoding::error::ValueEncodingError; diff --git a/src/stream/src/executor/exchange/input.rs b/src/stream/src/executor/exchange/input.rs index 11796441326aa..0fc4845476db0 100644 --- a/src/stream/src/executor/exchange/input.rs +++ b/src/stream/src/executor/exchange/input.rs @@ -16,7 +16,7 @@ use std::pin::Pin; use std::task::{Context, Poll}; use anyhow::Context as _; -use futures::{pin_mut, Stream}; +use futures::pin_mut; use futures_async_stream::try_stream; use pin_project::pin_project; use risingwave_common::util::addr::{is_local_address, HostAddr}; @@ -25,9 +25,6 @@ use risingwave_rpc_client::ComputeClientPool; use super::error::ExchangeChannelClosed; use super::permit::Receiver; -use crate::error::StreamResult; -use crate::executor::error::StreamExecutorError; -use crate::executor::monitor::StreamingMetrics; use crate::executor::prelude::*; use crate::task::{ FragmentId, LocalBarrierManager, SharedContext, UpDownActorIds, UpDownFragmentIds, diff --git a/src/stream/src/executor/filter.rs b/src/stream/src/executor/filter.rs index 4d1ecb098bd8f..b183719a9a677 100644 --- a/src/stream/src/executor/filter.rs +++ b/src/stream/src/executor/filter.rs @@ -157,11 +157,8 @@ impl FilterExecutor { #[cfg(test)] mod tests { - use futures::StreamExt; use risingwave_common::array::stream_chunk::StreamChunkTestExt; - use risingwave_common::array::StreamChunk; - use risingwave_common::catalog::{Field, Schema}; - use risingwave_common::types::DataType; + use risingwave_common::catalog::Field; use super::super::test_utils::expr::build_from_pretty; use super::super::test_utils::MockSource; diff --git a/src/stream/src/executor/hash_join.rs b/src/stream/src/executor/hash_join.rs index ea0253c9cbbc1..60e2e532eb1fa 100644 --- a/src/stream/src/executor/hash_join.rs +++ b/src/stream/src/executor/hash_join.rs @@ -17,7 +17,7 @@ use std::time::Duration; use itertools::Itertools; use multimap::MultiMap; -use risingwave_common::array::{Op, RowRef}; +use risingwave_common::array::Op; use risingwave_common::hash::{HashKey, NullBitmap}; use risingwave_common::types::{DefaultOrd, ToOwnedDatum}; use risingwave_common::util::epoch::EpochPair; @@ -30,7 +30,7 @@ use self::builder::JoinChunkBuilder; use super::barrier_align::*; use super::join::hash_join::*; use super::join::row::JoinRow; -use super::join::{JoinTypePrimitive, SideTypePrimitive, *}; +use super::join::*; use super::watermark::*; use crate::executor::join::builder::JoinStreamChunkBuilder; use crate::executor::prelude::*; @@ -1051,20 +1051,16 @@ impl HashJoinExecutor; diff --git a/src/stream/src/executor/join/hash_join.rs b/src/stream/src/executor/join/hash_join.rs index 88b3ede24b619..8805ea3cc3120 100644 --- a/src/stream/src/executor/join/hash_join.rs +++ b/src/stream/src/executor/join/hash_join.rs @@ -734,7 +734,6 @@ impl JoinEntryState { mod tests { use itertools::Itertools; use risingwave_common::array::*; - use risingwave_common::types::{DataType, ScalarImpl}; use risingwave_common::util::iter_util::ZipEqDebug; use super::*; diff --git a/src/stream/src/executor/lookup.rs b/src/stream/src/executor/lookup.rs index 8d62d27e37f06..6dc4183fe27da 100644 --- a/src/stream/src/executor/lookup.rs +++ b/src/stream/src/executor/lookup.rs @@ -13,7 +13,6 @@ // limitations under the License. use async_trait::async_trait; -use futures::StreamExt; mod cache; mod sides; diff --git a/src/stream/src/executor/lookup_union.rs b/src/stream/src/executor/lookup_union.rs index 2189a821fab11..8c0e4103b5b2c 100644 --- a/src/stream/src/executor/lookup_union.rs +++ b/src/stream/src/executor/lookup_union.rs @@ -15,7 +15,7 @@ use async_trait::async_trait; use futures::channel::mpsc; use futures::future::{join_all, select, Either}; -use futures::{FutureExt, SinkExt, StreamExt}; +use futures::{FutureExt, SinkExt}; use itertools::Itertools; use crate::executor::prelude::*; @@ -120,10 +120,8 @@ impl LookupUnionExecutor { #[cfg(test)] mod tests { use futures::TryStreamExt; - use risingwave_common::array::StreamChunk; - use risingwave_common::catalog::{Field, Schema}; + use risingwave_common::catalog::Field; use risingwave_common::test_prelude::StreamChunkTestExt; - use risingwave_common::types::DataType; use risingwave_common::util::epoch::test_epoch; use super::*; diff --git a/src/stream/src/executor/merge.rs b/src/stream/src/executor/merge.rs index 7a5450716f9ac..6d3f81928a302 100644 --- a/src/stream/src/executor/merge.rs +++ b/src/stream/src/executor/merge.rs @@ -18,7 +18,6 @@ use std::task::{Context, Poll}; use anyhow::Context as _; use futures::stream::{FusedStream, FuturesUnordered, StreamFuture}; -use futures::StreamExt; use tokio::time::Instant; use super::exchange::input::BoxedInput; @@ -27,7 +26,7 @@ use super::*; use crate::executor::exchange::input::new_input; use crate::executor::prelude::*; use crate::executor::utils::ActorInputMetrics; -use crate::task::{FragmentId, SharedContext}; +use crate::task::SharedContext; /// `MergeExecutor` merges data from multiple channels. Dataflow from one channel /// will be stopped on barrier. @@ -413,16 +412,12 @@ impl SelectReceivers { #[cfg(test)] mod tests { - use std::collections::HashSet; use std::sync::atomic::{AtomicBool, Ordering}; - use std::sync::Arc; use std::time::Duration; use assert_matches::assert_matches; use futures::FutureExt; - use itertools::Itertools; - use risingwave_common::array::{Op, StreamChunk}; - use risingwave_common::types::ScalarImpl; + use risingwave_common::array::Op; use risingwave_common::util::epoch::test_epoch; use risingwave_pb::stream_plan::StreamMessage; use risingwave_pb::task_service::exchange_service_server::{ @@ -439,7 +434,6 @@ mod tests { use super::*; use crate::executor::exchange::input::RemoteInput; use crate::executor::exchange::permit::channel_for_test; - use crate::executor::{Barrier, Execute, Mutation}; use crate::task::test_utils::helper_make_local_actor; use crate::task::LocalBarrierManager; diff --git a/src/stream/src/executor/mview/materialize.rs b/src/stream/src/executor/mview/materialize.rs index 65c35e2094b73..9ad0dfbdfcea3 100644 --- a/src/stream/src/executor/mview/materialize.rs +++ b/src/stream/src/executor/mview/materialize.rs @@ -24,7 +24,7 @@ use itertools::Itertools; use risingwave_common::array::Op; use risingwave_common::buffer::Bitmap; use risingwave_common::catalog::{ColumnDesc, ColumnId, ConflictBehavior, TableId}; -use risingwave_common::row::{CompactedRow, OwnedRow, RowDeserializer}; +use risingwave_common::row::{CompactedRow, RowDeserializer}; use risingwave_common::types::DefaultOrd; use risingwave_common::util::chunk_coalesce::DataChunkBuilder; use risingwave_common::util::iter_util::{ZipEqDebug, ZipEqFast}; @@ -833,23 +833,17 @@ mod tests { use std::iter; use std::sync::atomic::AtomicU64; - use futures::stream::StreamExt; use rand::rngs::SmallRng; use rand::{Rng, RngCore, SeedableRng}; use risingwave_common::array::stream_chunk::{StreamChunkMut, StreamChunkTestExt}; - use risingwave_common::array::stream_chunk_builder::StreamChunkBuilder; - use risingwave_common::array::Op; - use risingwave_common::catalog::{ColumnDesc, ConflictBehavior, Field, Schema, TableId}; - use risingwave_common::row::OwnedRow; - use risingwave_common::types::DataType; + use risingwave_common::catalog::Field; use risingwave_common::util::epoch::test_epoch; - use risingwave_common::util::sort_util::{ColumnOrder, OrderType}; + use risingwave_common::util::sort_util::OrderType; use risingwave_hummock_sdk::HummockReadEpoch; use risingwave_storage::memory::MemoryStateStore; use risingwave_storage::table::batch_table::storage_table::StorageTable; use super::*; - use crate::executor::test_utils::prelude::StateTable; use crate::executor::test_utils::*; #[tokio::test] diff --git a/src/stream/src/executor/over_window/general.rs b/src/stream/src/executor/over_window/general.rs index 7cb29c39f7e37..c8ed97f8c59c1 100644 --- a/src/stream/src/executor/over_window/general.rs +++ b/src/stream/src/executor/over_window/general.rs @@ -30,7 +30,6 @@ use risingwave_expr::window_function::{ create_window_state, StateKey, WindowFuncCall, WindowStates, }; use risingwave_storage::row_serde::row_serde_util::serialize_pk_with_vnode; -use risingwave_storage::StateStore; use super::over_partition::{ new_empty_partition_cache, shrink_partition_cache, CacheKey, OverPartition, PartitionCache, @@ -38,8 +37,6 @@ use super::over_partition::{ }; use crate::cache::{new_unbounded, ManagedLruCache}; use crate::common::metrics::MetricsInfo; -use crate::common::table::state_table::StateTable; -use crate::executor::monitor::StreamingMetrics; use crate::executor::over_window::over_partition::AffectedRange; use crate::executor::prelude::*; diff --git a/src/stream/src/executor/over_window/over_partition.rs b/src/stream/src/executor/over_window/over_partition.rs index db431a17dafe4..baac154593f7a 100644 --- a/src/stream/src/executor/over_window/over_partition.rs +++ b/src/stream/src/executor/over_window/over_partition.rs @@ -32,6 +32,7 @@ use risingwave_expr::window_function::{ }; use risingwave_storage::store::PrefetchOptions; use risingwave_storage::StateStore; +use static_assertions::const_assert; use super::general::RowConverter; use crate::common::table::state_table::StateTable; @@ -88,27 +89,31 @@ pub(super) fn shrink_partition_cache( let (sk_start, sk_end) = recently_accessed_range.into_inner(); let (ck_start, ck_end) = (CacheKey::from(sk_start), CacheKey::from(sk_end)); + // find the cursor just before `ck_start` let mut cursor = range_cache.inner().upper_bound(Bound::Excluded(&ck_start)); for _ in 0..MAGIC_JITTER_PREVENTION { - if cursor.key().is_none() { + if cursor.prev().is_none() { + // already at the beginning break; } - cursor.move_prev(); } let start = cursor - .key() + .peek_prev() + .map(|(k, _)| k) .unwrap_or_else(|| range_cache.first_key_value().unwrap().0) .clone(); + // find the cursor just after `ck_end` let mut cursor = range_cache.inner().lower_bound(Bound::Excluded(&ck_end)); for _ in 0..MAGIC_JITTER_PREVENTION { - if cursor.key().is_none() { + if cursor.next().is_none() { + // already at the end break; } - cursor.move_next(); } let end = cursor - .key() + .peek_next() + .map(|(k, _)| k) .unwrap_or_else(|| range_cache.last_key_value().unwrap().0) .clone(); @@ -122,32 +127,39 @@ pub(super) fn shrink_partition_cache( let (sk_start, _sk_end) = recently_accessed_range.into_inner(); let ck_start = CacheKey::from(sk_start); - let mut capacity_remain = MAGIC_CACHE_SIZE; // precision is not important here, code simplicity is first + let mut capacity_remain = MAGIC_CACHE_SIZE; // precision is not important here, code simplicity is the first + const_assert!(MAGIC_JITTER_PREVENTION < MAGIC_CACHE_SIZE); - let mut cursor = range_cache.inner().upper_bound(Bound::Excluded(&ck_start)); + // find the cursor just before `ck_start` + let cursor_just_before_ck_start = + range_cache.inner().upper_bound(Bound::Excluded(&ck_start)); + + let mut cursor = cursor_just_before_ck_start.clone(); // go back for at most `MAGIC_JITTER_PREVENTION` entries for _ in 0..MAGIC_JITTER_PREVENTION { - if cursor.key().is_none() { + if cursor.prev().is_none() { + // already at the beginning break; } - cursor.move_prev(); capacity_remain -= 1; } let start = cursor - .key() + .peek_prev() + .map(|(k, _)| k) .unwrap_or_else(|| range_cache.first_key_value().unwrap().0) .clone(); - let mut cursor = range_cache.inner().lower_bound(Bound::Included(&ck_start)); + let mut cursor = cursor_just_before_ck_start; // go forward for at most `capacity_remain` entries for _ in 0..capacity_remain { - if cursor.key().is_none() { + if cursor.next().is_none() { + // already at the end break; } - cursor.move_next(); } let end = cursor - .key() + .peek_next() + .map(|(k, _)| k) .unwrap_or_else(|| range_cache.last_key_value().unwrap().0) .clone(); @@ -162,32 +174,39 @@ pub(super) fn shrink_partition_cache( let (_sk_start, sk_end) = recently_accessed_range.into_inner(); let ck_end = CacheKey::from(sk_end); - let mut capacity_remain = MAGIC_CACHE_SIZE; // precision is not important here, code simplicity is first + let mut capacity_remain = MAGIC_CACHE_SIZE; // precision is not important here, code simplicity is the first + const_assert!(MAGIC_JITTER_PREVENTION < MAGIC_CACHE_SIZE); + + // find the cursor just after `ck_end` + let cursor_just_after_ck_end = + range_cache.inner().lower_bound(Bound::Excluded(&ck_end)); - let mut cursor = range_cache.inner().lower_bound(Bound::Excluded(&ck_end)); + let mut cursor = cursor_just_after_ck_end.clone(); // go forward for at most `MAGIC_JITTER_PREVENTION` entries for _ in 0..MAGIC_JITTER_PREVENTION { - if cursor.key().is_none() { + if cursor.next().is_none() { + // already at the end break; } - cursor.move_next(); capacity_remain -= 1; } let end = cursor - .key() + .peek_next() + .map(|(k, _)| k) .unwrap_or_else(|| range_cache.last_key_value().unwrap().0) .clone(); - let mut cursor = range_cache.inner().upper_bound(Bound::Included(&ck_end)); + let mut cursor = cursor_just_after_ck_end; // go back for at most `capacity_remain` entries for _ in 0..capacity_remain { - if cursor.key().is_none() { + if cursor.prev().is_none() { + // already at the beginning break; } - cursor.move_prev(); } let start = cursor - .key() + .peek_prev() + .map(|(k, _)| k) .unwrap_or_else(|| range_cache.first_key_value().unwrap().0) .clone(); diff --git a/src/stream/src/executor/project.rs b/src/stream/src/executor/project.rs index e78238585c9fa..22ce33a1066d5 100644 --- a/src/stream/src/executor/project.rs +++ b/src/stream/src/executor/project.rs @@ -189,13 +189,11 @@ impl Inner { mod tests { use std::sync::atomic::{self, AtomicI64}; - use futures::StreamExt; use risingwave_common::array::stream_chunk::StreamChunkTestExt; - use risingwave_common::array::{DataChunk, StreamChunk}; - use risingwave_common::catalog::{Field, Schema}; - use risingwave_common::types::{DataType, Datum}; + use risingwave_common::array::DataChunk; + use risingwave_common::catalog::Field; use risingwave_common::util::epoch::test_epoch; - use risingwave_expr::expr::{self, Expression, ValueImpl}; + use risingwave_expr::expr::{self, ValueImpl}; use super::super::test_utils::MockSource; use super::super::*; diff --git a/src/stream/src/executor/receiver.rs b/src/stream/src/executor/receiver.rs index 3966b25febf5d..1493e3ce17cf9 100644 --- a/src/stream/src/executor/receiver.rs +++ b/src/stream/src/executor/receiver.rs @@ -191,15 +191,13 @@ impl Execute for ReceiverExecutor { #[cfg(test)] mod tests { use std::collections::HashMap; - use std::sync::Arc; use futures::{pin_mut, FutureExt}; - use risingwave_common::array::StreamChunk; use risingwave_common::util::epoch::test_epoch; use risingwave_pb::stream_plan::update_mutation::MergeUpdate; use super::*; - use crate::executor::{ActorContext, Barrier, Execute, Mutation, UpdateMutation}; + use crate::executor::UpdateMutation; use crate::task::test_utils::helper_make_local_actor; #[tokio::test] diff --git a/src/stream/src/executor/row_id_gen.rs b/src/stream/src/executor/row_id_gen.rs index c779092a307fb..2da75389fd9f7 100644 --- a/src/stream/src/executor/row_id_gen.rs +++ b/src/stream/src/executor/row_id_gen.rs @@ -123,16 +123,14 @@ impl Execute for RowIdGenExecutor { #[cfg(test)] mod tests { - use risingwave_common::array::{Array, PrimitiveArray}; - use risingwave_common::catalog::{Field, Schema}; + use risingwave_common::array::PrimitiveArray; + use risingwave_common::catalog::Field; use risingwave_common::hash::VirtualNode; use risingwave_common::test_prelude::StreamChunkTestExt; - use risingwave_common::types::DataType; use risingwave_common::util::epoch::test_epoch; use super::*; use crate::executor::test_utils::MockSource; - use crate::executor::{ActorContext, Execute}; #[tokio::test] async fn test_row_id_gen_executor() { diff --git a/src/stream/src/executor/simple_agg.rs b/src/stream/src/executor/simple_agg.rs index 9c35627857828..e30ceaf73a851 100644 --- a/src/stream/src/executor/simple_agg.rs +++ b/src/stream/src/executor/simple_agg.rs @@ -295,9 +295,7 @@ mod tests { use risingwave_common::catalog::Field; use risingwave_common::types::*; use risingwave_common::util::epoch::test_epoch; - use risingwave_expr::aggregate::AggCall; use risingwave_storage::memory::MemoryStateStore; - use risingwave_storage::StateStore; use super::*; use crate::executor::test_utils::agg_executor::new_boxed_simple_agg_executor; diff --git a/src/stream/src/executor/sink.rs b/src/stream/src/executor/sink.rs index 1bd8d5e5c96a4..e12590527e3a8 100644 --- a/src/stream/src/executor/sink.rs +++ b/src/stream/src/executor/sink.rs @@ -15,7 +15,6 @@ use std::mem; use anyhow::anyhow; -use await_tree::InstrumentAwait; use futures::stream::select; use futures::{FutureExt, TryFutureExt, TryStreamExt}; use itertools::Itertools; @@ -481,7 +480,6 @@ mod test { use super::*; use crate::common::log_store_impl::in_mem::BoundedInMemLogStoreFactory; use crate::executor::test_utils::*; - use crate::executor::ActorContext; #[tokio::test] async fn test_force_append_only_sink() { diff --git a/src/stream/src/executor/sort.rs b/src/stream/src/executor/sort.rs index 37d08c746bba8..c2a01c8915a96 100644 --- a/src/stream/src/executor/sort.rs +++ b/src/stream/src/executor/sort.rs @@ -143,16 +143,13 @@ impl SortExecutor { #[cfg(test)] mod tests { use risingwave_common::array::stream_chunk::StreamChunkTestExt; - use risingwave_common::array::StreamChunk; - use risingwave_common::catalog::{ColumnDesc, ColumnId, Field, Schema, TableId}; - use risingwave_common::types::DataType; + use risingwave_common::catalog::{ColumnDesc, ColumnId, Field, TableId}; use risingwave_common::util::epoch::test_epoch; use risingwave_common::util::sort_util::OrderType; use risingwave_storage::memory::MemoryStateStore; use super::*; use crate::executor::test_utils::{MessageSender, MockSource, StreamExecutorTestExt}; - use crate::executor::{ActorContext, BoxedMessageStream, Execute}; async fn create_executor( sort_column_index: usize, diff --git a/src/stream/src/executor/source/source_backfill_executor.rs b/src/stream/src/executor/source/source_backfill_executor.rs index 68dadf5806f30..0bc6e19f45fb5 100644 --- a/src/stream/src/executor/source/source_backfill_executor.rs +++ b/src/stream/src/executor/source/source_backfill_executor.rs @@ -733,11 +733,11 @@ impl SourceBackfillExecutorInner { if split_changed { stage .unfinished_splits - .retain(|split| target_state.get(split.id().as_ref()).is_some()); + .retain(|split| target_state.contains_key(split.id().as_ref())); let dropped_splits = stage .states - .extract_if(|split_id, _| target_state.get(split_id).is_none()) + .extract_if(|split_id, _| !target_state.contains_key(split_id)) .map(|(split_id, _)| split_id); if should_trim_state { @@ -826,7 +826,7 @@ impl SourceBackfillExecutorInner { ); let dropped_splits = - current_splits.extract_if(|split_id| target_splits.get(split_id).is_none()); + current_splits.extract_if(|split_id| !target_splits.contains(split_id)); if should_trim_state { // trim dropped splits' state diff --git a/src/stream/src/executor/source/source_executor.rs b/src/stream/src/executor/source/source_executor.rs index 5295549ed0455..a53f48827454f 100644 --- a/src/stream/src/executor/source/source_executor.rs +++ b/src/stream/src/executor/source/source_executor.rs @@ -257,11 +257,11 @@ impl SourceExecutor { ); core.updated_splits_in_epoch - .retain(|split_id, _| target_state.get(split_id).is_some()); + .retain(|split_id, _| target_state.contains_key(split_id)); let dropped_splits = core .latest_split_info - .extract_if(|split_id, _| target_state.get(split_id).is_none()) + .extract_if(|split_id, _| !target_state.contains_key(split_id)) .map(|(_, split)| split) .collect_vec(); @@ -766,15 +766,11 @@ impl WaitEpochWorker { #[cfg(test)] mod tests { use std::collections::HashSet; - use std::time::Duration; - use futures::StreamExt; use maplit::{convert_args, hashmap}; - use risingwave_common::array::StreamChunk; - use risingwave_common::catalog::{ColumnId, Field, Schema, TableId}; + use risingwave_common::catalog::{ColumnId, Field, TableId}; use risingwave_common::system_param::local_manager::LocalSystemParamsManager; use risingwave_common::test_prelude::StreamChunkTestExt; - use risingwave_common::types::DataType; use risingwave_common::util::epoch::test_epoch; use risingwave_connector::source::datagen::DatagenSplit; use risingwave_connector::source::reader::desc::test_utils::create_source_desc_builder; @@ -786,7 +782,6 @@ mod tests { use super::*; use crate::executor::source::{default_source_internal_table, SourceStateTableHandler}; - use crate::executor::ActorContext; const MOCK_SOURCE_NAME: &str = "mock_source"; diff --git a/src/stream/src/executor/source/state_table_handler.rs b/src/stream/src/executor/source/state_table_handler.rs index 7fc12000656cd..1d14de9a493c9 100644 --- a/src/stream/src/executor/source/state_table_handler.rs +++ b/src/stream/src/executor/source/state_table_handler.rs @@ -257,11 +257,9 @@ pub fn default_source_internal_table(id: u32) -> PbTable { #[cfg(test)] pub(crate) mod tests { - use std::sync::Arc; - use risingwave_common::row::OwnedRow; - use risingwave_common::types::{Datum, ScalarImpl}; - use risingwave_common::util::epoch::{test_epoch, EpochPair}; + use risingwave_common::types::Datum; + use risingwave_common::util::epoch::test_epoch; use risingwave_connector::source::kafka::KafkaSplit; use risingwave_storage::memory::MemoryStateStore; use serde_json::Value; diff --git a/src/stream/src/executor/stateless_simple_agg.rs b/src/stream/src/executor/stateless_simple_agg.rs index 1360f4166008e..dd1f39580c367 100644 --- a/src/stream/src/executor/stateless_simple_agg.rs +++ b/src/stream/src/executor/stateless_simple_agg.rs @@ -125,16 +125,13 @@ impl StatelessSimpleAggExecutor { #[cfg(test)] mod tests { use assert_matches::assert_matches; - use futures::StreamExt; use risingwave_common::array::stream_chunk::StreamChunkTestExt; - use risingwave_common::array::StreamChunk; use risingwave_common::catalog::schema_test_utils; use risingwave_common::util::epoch::test_epoch; use super::*; use crate::executor::test_utils::agg_executor::generate_agg_schema; use crate::executor::test_utils::MockSource; - use crate::executor::{Execute, StatelessSimpleAggExecutor}; #[tokio::test] async fn test_no_chunk() { diff --git a/src/stream/src/executor/top_n/group_top_n.rs b/src/stream/src/executor/top_n/group_top_n.rs index 3a8a618e3c836..d6b2af690d838 100644 --- a/src/stream/src/executor/top_n/group_top_n.rs +++ b/src/stream/src/executor/top_n/group_top_n.rs @@ -267,11 +267,9 @@ mod tests { use std::sync::atomic::AtomicU64; use assert_matches::assert_matches; - use futures::StreamExt; use risingwave_common::array::stream_chunk::StreamChunkTestExt; - use risingwave_common::catalog::{Field, Schema}; + use risingwave_common::catalog::Field; use risingwave_common::hash::SerializedKey; - use risingwave_common::types::DataType; use risingwave_common::util::epoch::test_epoch; use risingwave_common::util::sort_util::OrderType; use risingwave_storage::memory::MemoryStateStore; @@ -279,7 +277,6 @@ mod tests { use super::*; use crate::executor::test_utils::top_n_executor::create_in_memory_state_table; use crate::executor::test_utils::MockSource; - use crate::executor::{ActorContext, Barrier, Execute, Message}; fn create_schema() -> Schema { Schema { diff --git a/src/stream/src/executor/top_n/top_n_appendonly.rs b/src/stream/src/executor/top_n/top_n_appendonly.rs index c99b911b951ef..1b45c82c9c83a 100644 --- a/src/stream/src/executor/top_n/top_n_appendonly.rs +++ b/src/stream/src/executor/top_n/top_n_appendonly.rs @@ -19,7 +19,7 @@ use risingwave_common::util::sort_util::ColumnOrder; use super::top_n_cache::AppendOnlyTopNCacheTrait; use super::utils::*; -use super::{ManagedTopNState, TopNCache, NO_GROUP_KEY}; +use super::{ManagedTopNState, TopNCache}; use crate::executor::prelude::*; /// If the input is append-only, `AppendOnlyGroupTopNExecutor` does not need diff --git a/src/stream/src/executor/top_n/top_n_plain.rs b/src/stream/src/executor/top_n/top_n_plain.rs index 30aee860a8fc8..63b9ca94961f8 100644 --- a/src/stream/src/executor/top_n/top_n_plain.rs +++ b/src/stream/src/executor/top_n/top_n_plain.rs @@ -185,7 +185,6 @@ where #[cfg(test)] mod tests { use assert_matches::assert_matches; - use futures::StreamExt; use risingwave_common::array::stream_chunk::StreamChunkTestExt; use risingwave_common::catalog::{Field, Schema}; use risingwave_common::types::DataType; @@ -201,7 +200,7 @@ mod tests { use risingwave_common::util::epoch::test_epoch; use super::*; - use crate::executor::{ActorContext, Execute}; + fn create_stream_chunks() -> Vec { let chunk1 = StreamChunk::from_pretty( " I I @@ -685,8 +684,6 @@ mod tests { use super::*; use crate::executor::test_utils::top_n_executor::create_in_memory_state_table_from_state_store; - use crate::executor::{ActorContext, Execute}; - fn create_source_new() -> Executor { let mut chunks = vec![ StreamChunk::from_pretty( @@ -1002,7 +999,6 @@ mod tests { use super::*; use crate::executor::test_utils::top_n_executor::create_in_memory_state_table_from_state_store; - use crate::executor::{ActorContext, Execute}; fn create_source() -> Executor { let mut chunks = vec![ diff --git a/src/stream/src/executor/troublemaker.rs b/src/stream/src/executor/troublemaker.rs index 7b93392fef419..95b7ad70f7a1f 100644 --- a/src/stream/src/executor/troublemaker.rs +++ b/src/stream/src/executor/troublemaker.rs @@ -13,7 +13,6 @@ // limitations under the License. use rand::Rng; -use risingwave_common::array::stream_chunk_builder::StreamChunkBuilder; use risingwave_common::array::stream_record::{Record, RecordType}; use risingwave_common::array::Op; use risingwave_common::field_generator::{FieldGeneratorImpl, VarcharProperty}; diff --git a/src/stream/src/executor/union.rs b/src/stream/src/executor/union.rs index ac8f3581dda18..f72f5170ce868 100644 --- a/src/stream/src/executor/union.rs +++ b/src/stream/src/executor/union.rs @@ -145,12 +145,9 @@ async fn merge(inputs: Vec) { mod tests { use async_stream::try_stream; use risingwave_common::array::stream_chunk::StreamChunkTestExt; - use risingwave_common::array::StreamChunk; - use risingwave_common::types::{DataType, ScalarImpl}; use risingwave_common::util::epoch::test_epoch; use super::*; - use crate::executor::Watermark; #[tokio::test] async fn union() { diff --git a/src/stream/src/executor/watermark_filter.rs b/src/stream/src/executor/watermark_filter.rs index 813ccbef28920..2aca1251dd058 100644 --- a/src/stream/src/executor/watermark_filter.rs +++ b/src/stream/src/executor/watermark_filter.rs @@ -17,7 +17,7 @@ use std::ops::Deref; use futures::future::{try_join, try_join_all}; use risingwave_common::hash::VnodeBitmapExt; -use risingwave_common::types::{DefaultOrd, ScalarImpl}; +use risingwave_common::types::DefaultOrd; use risingwave_common::{bail, row}; use risingwave_expr::expr::{ build_func_non_strict, ExpressionBoxExt, InputRefExpression, LiteralExpression, @@ -349,8 +349,7 @@ impl WatermarkFilterExecutor { #[cfg(test)] mod tests { use itertools::Itertools; - use risingwave_common::array::StreamChunk; - use risingwave_common::catalog::{ColumnDesc, ColumnId, Field, Schema, TableDesc}; + use risingwave_common::catalog::{ColumnDesc, ColumnId, Field, TableDesc}; use risingwave_common::test_prelude::StreamChunkTestExt; use risingwave_common::types::Date; use risingwave_common::util::epoch::test_epoch; @@ -359,12 +358,10 @@ mod tests { use risingwave_pb::common::ColumnOrder; use risingwave_pb::plan_common::PbColumnCatalog; use risingwave_storage::memory::MemoryStateStore; - use risingwave_storage::table::TableDistribution; use super::*; use crate::executor::test_utils::expr::build_from_pretty; use crate::executor::test_utils::{MessageSender, MockSource}; - use crate::executor::{ActorContext, ExecutorInfo}; const WATERMARK_TYPE: DataType = DataType::Timestamp; diff --git a/src/stream/src/executor/wrapper/epoch_check.rs b/src/stream/src/executor/wrapper/epoch_check.rs index 0110d8a0d86e6..335c524700f01 100644 --- a/src/stream/src/executor/wrapper/epoch_check.rs +++ b/src/stream/src/executor/wrapper/epoch_check.rs @@ -75,7 +75,7 @@ pub async fn epoch_check(info: Arc, input: impl MessageStream) { #[cfg(test)] mod tests { use assert_matches::assert_matches; - use futures::{pin_mut, StreamExt}; + use futures::pin_mut; use risingwave_common::array::StreamChunk; use risingwave_common::util::epoch::test_epoch; diff --git a/src/stream/src/from_proto/batch_query.rs b/src/stream/src/from_proto/batch_query.rs index 5e86d7e6d5b30..a1659008724e7 100644 --- a/src/stream/src/from_proto/batch_query.rs +++ b/src/stream/src/from_proto/batch_query.rs @@ -16,7 +16,6 @@ use risingwave_common::catalog::ColumnId; use risingwave_pb::plan_common::StorageTableDesc; use risingwave_pb::stream_plan::BatchPlanNode; use risingwave_storage::table::batch_table::storage_table::StorageTable; -use risingwave_storage::StateStore; use super::*; use crate::executor::{BatchQueryExecutor, DummyExecutor}; diff --git a/src/stream/src/from_proto/group_top_n.rs b/src/stream/src/from_proto/group_top_n.rs index 51512cb9d94d3..fe5dfc1042cc8 100644 --- a/src/stream/src/from_proto/group_top_n.rs +++ b/src/stream/src/from_proto/group_top_n.rs @@ -22,7 +22,7 @@ use risingwave_pb::stream_plan::GroupTopNNode; use super::*; use crate::common::table::state_table::StateTable; -use crate::executor::{ActorContextRef, AppendOnlyGroupTopNExecutor, Executor, GroupTopNExecutor}; +use crate::executor::{ActorContextRef, AppendOnlyGroupTopNExecutor, GroupTopNExecutor}; use crate::task::AtomicU64Ref; pub struct GroupTopNExecutorBuilder; diff --git a/src/stream/src/from_proto/hash_join.rs b/src/stream/src/from_proto/hash_join.rs index ad69fd1ecd5ac..28a6aa72d4a6f 100644 --- a/src/stream/src/from_proto/hash_join.rs +++ b/src/stream/src/from_proto/hash_join.rs @@ -27,7 +27,7 @@ use super::*; use crate::common::table::state_table::StateTable; use crate::executor::hash_join::*; use crate::executor::monitor::StreamingMetrics; -use crate::executor::{ActorContextRef, Executor, JoinType}; +use crate::executor::{ActorContextRef, JoinType}; use crate::task::AtomicU64Ref; pub struct HashJoinExecutorBuilder; diff --git a/src/stream/src/from_proto/stream_cdc_scan.rs b/src/stream/src/from_proto/stream_cdc_scan.rs index a55afa6c2da78..43ddffda00607 100644 --- a/src/stream/src/from_proto/stream_cdc_scan.rs +++ b/src/stream/src/from_proto/stream_cdc_scan.rs @@ -23,7 +23,7 @@ use risingwave_pb::stream_plan::StreamCdcScanNode; use super::*; use crate::common::table::state_table::StateTable; -use crate::executor::{CdcBackfillExecutor, CdcScanOptions, Executor, ExternalStorageTable}; +use crate::executor::{CdcBackfillExecutor, CdcScanOptions, ExternalStorageTable}; pub struct StreamCdcScanExecutorBuilder; diff --git a/src/stream/src/lib.rs b/src/stream/src/lib.rs index ed516244e994c..a6215d6e47aa1 100644 --- a/src/stream/src/lib.rs +++ b/src/stream/src/lib.rs @@ -32,7 +32,6 @@ #![feature(lazy_cell)] #![feature(error_generic_member_access)] #![feature(btree_extract_if)] -#![feature(bound_map)] #![feature(iter_order_by)] #![feature(exact_size_is_empty)] #![feature(impl_trait_in_assoc_type)] diff --git a/src/stream/src/task/barrier_manager/tests.rs b/src/stream/src/task/barrier_manager/tests.rs index 99efb00269b8a..5fbedcdfd0dcc 100644 --- a/src/stream/src/task/barrier_manager/tests.rs +++ b/src/stream/src/task/barrier_manager/tests.rs @@ -20,10 +20,8 @@ use std::task::Poll; use assert_matches::assert_matches; use futures::future::join_all; use futures::FutureExt; -use itertools::Itertools; use risingwave_common::util::epoch::test_epoch; use risingwave_pb::stream_service::{streaming_control_stream_request, InjectBarrierRequest}; -use tokio::sync::mpsc::unbounded_channel; use tokio_stream::wrappers::UnboundedReceiverStream; use super::*; diff --git a/src/tests/compaction_test/src/lib.rs b/src/tests/compaction_test/src/lib.rs index 1e2207fc99a9b..e5fd10b10b176 100644 --- a/src/tests/compaction_test/src/lib.rs +++ b/src/tests/compaction_test/src/lib.rs @@ -22,7 +22,6 @@ #![warn(clippy::map_flatten)] #![warn(clippy::await_holding_lock)] #![deny(rustdoc::broken_intra_doc_links)] -#![feature(bound_map)] #![feature(register_tool)] #![register_tool(rw)] #![allow(rw::format_error)] // test code @@ -45,7 +44,7 @@ pub struct CompactionTestOpts { #[clap(long)] pub client_address: Option, - /// The state store string e.g. hummock+s3://test-bucket + /// The state store string e.g. `hummock+s3://test-bucket` #[clap(short, long)] pub state_store: String, diff --git a/src/tests/simulation/Cargo.toml b/src/tests/simulation/Cargo.toml index fc55e6356f4c5..31736ea848423 100644 --- a/src/tests/simulation/Cargo.toml +++ b/src/tests/simulation/Cargo.toml @@ -24,7 +24,7 @@ futures = { version = "0.3", default-features = false, features = ["alloc"] } glob = "0.3" itertools = { workspace = true } lru = { workspace = true } -madsim = "0.2.22" +madsim = "0.2.27" paste = "1" pin-project = "1.1" pretty_assertions = "1" diff --git a/src/tests/simulation/tests/integration_tests/batch/mod.rs b/src/tests/simulation/tests/integration_tests/batch/mod.rs index ef530efa9f46a..25c690cfdcbf8 100644 --- a/src/tests/simulation/tests/integration_tests/batch/mod.rs +++ b/src/tests/simulation/tests/integration_tests/batch/mod.rs @@ -54,7 +54,7 @@ fn cluster_config_no_compute_nodes() -> Configuration { file.write_all( "\ [meta] -max_heartbeat_interval_secs = 60 +max_heartbeat_interval_secs = 300 [system] barrier_interval_ms = 1000 @@ -63,6 +63,9 @@ checkpoint_frequency = 1 [server] telemetry_enabled = false metrics_level = \"Disabled\" + +[batch] +mask_worker_temporary_secs = 30 " .as_bytes(), ) @@ -163,7 +166,7 @@ async fn test_serving_cluster_availability() { tokio::time::sleep(Duration::from_secs(15)).await; query_and_assert(session.clone()).await; // wait for mask expire - tokio::time::sleep(Duration::from_secs(30)).await; + tokio::time::sleep(Duration::from_secs(60)).await; session.run(select).await.unwrap_err(); // wait for previous nodes expire tokio::time::sleep(Duration::from_secs(300)).await; diff --git a/src/tests/simulation/tests/integration_tests/scale/plan.rs b/src/tests/simulation/tests/integration_tests/scale/plan.rs index e1d8148632c62..d39e159fc61d9 100644 --- a/src/tests/simulation/tests/integration_tests/scale/plan.rs +++ b/src/tests/simulation/tests/integration_tests/scale/plan.rs @@ -13,7 +13,6 @@ // limitations under the License. use std::collections::HashMap; -use std::default::Default; use anyhow::Result; use itertools::Itertools; diff --git a/src/utils/delta_btree_map/src/lib.rs b/src/utils/delta_btree_map/src/lib.rs index c300955af567b..1f7e1a77190a0 100644 --- a/src/utils/delta_btree_map/src/lib.rs +++ b/src/utils/delta_btree_map/src/lib.rs @@ -76,16 +76,18 @@ impl<'a, K: Ord, V> DeltaBTreeMap<'a, K, V> { pub fn find(&self, key: &K) -> Option> { let ss_cursor = self.snapshot.lower_bound(Bound::Included(key)); let dt_cursor = self.delta.lower_bound(Bound::Included(key)); - let curr_key_value = if dt_cursor.key() == Some(key) { - match dt_cursor.key_value().unwrap() { + let ss_cursor_kv = ss_cursor.peek_next(); + let dt_cursor_kv = dt_cursor.peek_next(); + let curr_key_value = if dt_cursor_kv.map(|(k, _)| k) == Some(key) { + match dt_cursor_kv.unwrap() { (key, Change::Insert(value)) => (key, value), (_key, Change::Delete) => { // the key is deleted return None; } } - } else if ss_cursor.key() == Some(key) { - ss_cursor.key_value().unwrap() + } else if ss_cursor_kv.map(|(k, _)| k) == Some(key) { + ss_cursor_kv.unwrap() } else { // the key doesn't exist return None; @@ -102,16 +104,8 @@ impl<'a, K: Ord, V> DeltaBTreeMap<'a, K, V> { // the implementation is very similar to `CursorWithDelta::peek_next` let mut ss_cursor = self.snapshot.lower_bound(bound); let mut dt_cursor = self.delta.lower_bound(bound); - let next_ss_entry = || { - let tmp = ss_cursor.key_value(); - ss_cursor.move_next(); - tmp - }; - let next_dt_entry = || { - let tmp = dt_cursor.key_value(); - dt_cursor.move_next(); - tmp - }; + let next_ss_entry = || ss_cursor.next(); + let next_dt_entry = || dt_cursor.next(); let curr_key_value = CursorWithDelta::peek_impl(PeekDirection::Next, next_ss_entry, next_dt_entry); CursorWithDelta { @@ -126,16 +120,8 @@ impl<'a, K: Ord, V> DeltaBTreeMap<'a, K, V> { // the implementation is very similar to `CursorWithDelta::peek_prev` let mut ss_cursor = self.snapshot.upper_bound(bound); let mut dt_cursor = self.delta.upper_bound(bound); - let prev_ss_entry = || { - let tmp = ss_cursor.key_value(); - ss_cursor.move_prev(); - tmp - }; - let prev_dt_entry = || { - let tmp = dt_cursor.key_value(); - dt_cursor.move_prev(); - tmp - }; + let prev_ss_entry = || ss_cursor.prev(); + let prev_dt_entry = || dt_cursor.prev(); let curr_key_value = CursorWithDelta::peek_impl(PeekDirection::Prev, prev_ss_entry, prev_dt_entry); CursorWithDelta { @@ -244,22 +230,14 @@ impl<'a, K: Ord, V> CursorWithDelta<'a, K, V> { let mut ss_cursor = self.snapshot.lower_bound(Bound::Included(key)); let mut dt_cursor = self.delta.lower_bound(Bound::Included(key)); // either one of `ss_cursor.key()` and `dt_cursor.key()` == `Some(key)`, or both are - if ss_cursor.key() == Some(key) { - ss_cursor.move_next(); + if ss_cursor.peek_next().map(|(k, _)| k) == Some(key) { + ss_cursor.next(); } - if dt_cursor.key() == Some(key) { - dt_cursor.move_next(); + if dt_cursor.peek_next().map(|(k, _)| k) == Some(key) { + dt_cursor.next(); } - let next_ss_entry = || { - let tmp = ss_cursor.key_value(); - ss_cursor.move_next(); - tmp - }; - let next_dt_entry = || { - let tmp = dt_cursor.key_value(); - dt_cursor.move_next(); - tmp - }; + let next_ss_entry = || ss_cursor.next(); + let next_dt_entry = || dt_cursor.next(); Self::peek_impl(PeekDirection::Next, next_ss_entry, next_dt_entry) } else { // we are at the ghost position, now let's go back to the beginning @@ -275,22 +253,14 @@ impl<'a, K: Ord, V> CursorWithDelta<'a, K, V> { let mut ss_cursor = self.snapshot.upper_bound(Bound::Included(key)); let mut dt_cursor = self.delta.upper_bound(Bound::Included(key)); // either one of `ss_cursor.key()` and `dt_cursor.key()` == `Some(key)`, or both are - if ss_cursor.key() == Some(key) { - ss_cursor.move_prev(); + if ss_cursor.peek_prev().map(|(k, _)| k) == Some(key) { + ss_cursor.prev(); } - if dt_cursor.key() == Some(key) { - dt_cursor.move_prev(); + if dt_cursor.peek_prev().map(|(k, _)| k) == Some(key) { + dt_cursor.prev(); } - let next_ss_entry = || { - let tmp = ss_cursor.key_value(); - ss_cursor.move_prev(); - tmp - }; - let next_dt_entry = || { - let tmp = dt_cursor.key_value(); - dt_cursor.move_prev(); - tmp - }; + let next_ss_entry = || ss_cursor.prev(); + let next_dt_entry = || dt_cursor.prev(); Self::peek_impl(PeekDirection::Prev, next_ss_entry, next_dt_entry) } else { // we are at the ghost position, now let's go back to the end @@ -317,8 +287,6 @@ impl<'a, K: Ord, V> CursorWithDelta<'a, K, V> { #[cfg(test)] mod tests { - use std::collections::BTreeMap; - use super::*; #[test] diff --git a/src/utils/pgwire/src/pg_message.rs b/src/utils/pgwire/src/pg_message.rs index 4898faf89b5d9..00c9a09b2eda6 100644 --- a/src/utils/pgwire/src/pg_message.rs +++ b/src/utils/pgwire/src/pg_message.rs @@ -697,7 +697,7 @@ macro_rules! from_usize { impl FromUsize for $t { #[inline] fn from_usize(x: usize) -> Result<$t> { - if x > <$t>::max_value() as usize { + if x > <$t>::MAX as usize { Err(Error::new(ErrorKind::InvalidInput, "value too large to transmit").into()) } else { Ok(x as $t) diff --git a/src/utils/pgwire/src/pg_protocol.rs b/src/utils/pgwire/src/pg_protocol.rs index 38eba6e92d5b6..5e9e7a056f261 100644 --- a/src/utils/pgwire/src/pg_protocol.rs +++ b/src/utils/pgwire/src/pg_protocol.rs @@ -767,7 +767,7 @@ where self.unnamed_portal.replace(portal); } else { assert!( - self.result_cache.get(&portal_name).is_none(), + !self.result_cache.contains_key(&portal_name), "Named portal never can be overridden." ); self.portal_store.insert(portal_name.clone(), portal); diff --git a/src/utils/pgwire/src/pg_server.rs b/src/utils/pgwire/src/pg_server.rs index 0538217de9acd..7305e35445aeb 100644 --- a/src/utils/pgwire/src/pg_server.rs +++ b/src/utils/pgwire/src/pg_server.rs @@ -15,7 +15,6 @@ use std::collections::HashMap; use std::future::Future; use std::io; -use std::result::Result; use std::str::FromStr; use std::sync::Arc; use std::time::Instant;