Skip to content

Commit

Permalink
fix: All clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bakjos committed May 14, 2024
1 parent 3b4259d commit 8de5c73
Show file tree
Hide file tree
Showing 38 changed files with 32 additions and 124 deletions.
2 changes: 0 additions & 2 deletions src/common/src/array/arrow/arrow_udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,9 @@ 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() {
Expand Down
4 changes: 1 addition & 3 deletions src/connector/src/parser/avro/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@ mod test {
use crate::connector_common::AwsAuthProps;
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 {
Expand Down
4 changes: 1 addition & 3 deletions src/connector/src/parser/debezium/avro_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,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";
Expand Down
1 change: 0 additions & 1 deletion src/connector/src/source/kinesis/source/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ mod tests {

use super::*;
use crate::connector_common::KinesisCommon;
use crate::source::kinesis::split::KinesisSplit;
use crate::source::SourceContext;

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion src/connector/src/source/nexmark/source/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 0 additions & 1 deletion src/meta/src/controller/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3008,7 +3008,6 @@ impl CatalogControllerInner {
#[cfg(test)]
#[cfg(not(madsim))]
mod tests {
use risingwave_meta_model_v2::ViewId;

use super::*;

Expand Down
1 change: 1 addition & 0 deletions src/storage/hummock_test/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ impl<S: LocalStateStore> 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<SyncResult> {
self.seal_epoch(epoch, true);
Expand Down
1 change: 0 additions & 1 deletion src/storage/src/monitor/traced_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<S> {
Expand Down
1 change: 0 additions & 1 deletion src/stream/src/common/compact_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
1 change: 0 additions & 1 deletion src/stream/src/executor/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions src/stream/src/executor/dedup/append_only_dedup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,15 @@ impl<S: StateStore> Execute for AppendOnlyDedupExecutor<S> {
#[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() {
Expand Down
11 changes: 3 additions & 8 deletions src/stream/src/executor/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
6 changes: 1 addition & 5 deletions src/stream/src/executor/dml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 1 addition & 3 deletions src/stream/src/executor/dynamic_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,8 @@ impl<S: StateStore, const USE_WATERMARK_CACHE: bool> 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;
Expand All @@ -499,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,
Expand Down
5 changes: 1 addition & 4 deletions src/stream/src/executor/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions src/stream/src/executor/hash_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1051,20 +1051,16 @@ impl<K: HashKey, S: StateStore, const T: JoinTypePrimitive> HashJoinExecutor<K,
mod tests {
use std::sync::atomic::AtomicU64;

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::hash::{Key128, Key64};
use risingwave_common::types::ScalarImpl;
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::expr::build_from_pretty;
use crate::executor::test_utils::{MessageSender, MockSource, StreamExecutorTestExt};
use crate::executor::{ActorContext, Barrier, EpochPair};

async fn create_in_memory_state_table(
mem_state: MemoryStateStore,
Expand Down
6 changes: 1 addition & 5 deletions src/stream/src/executor/hop_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,13 @@ impl HopWindowExecutor {

#[cfg(test)]
mod tests {
use futures::StreamExt;
use risingwave_common::array::stream_chunk::StreamChunkTestExt;
use risingwave_common::catalog::{Field, Schema};
use risingwave_common::catalog::Field;
use risingwave_common::types::test_utils::IntervalTestExt;
use risingwave_common::types::{DataType, Interval};
use risingwave_expr::expr::test_utils::make_hop_window_expression;
use risingwave_expr::expr::NonStrictExpression;

use super::*;
use crate::executor::test_utils::MockSource;
use crate::executor::{ActorContext, Execute, StreamChunk};

const CHUNK_SIZE: usize = 256;

Expand Down
8 changes: 2 additions & 6 deletions src/stream/src/executor/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::sync::{Arc, Mutex};
use std::sync::Mutex;

use futures::StreamExt;
use futures_async_stream::try_stream;
use multimap::MultiMap;
use risingwave_common::array::*;
use risingwave_common::catalog::{Field, Schema};
use risingwave_common::catalog::Field;
use risingwave_common::config;
use risingwave_common::types::*;
use risingwave_common::util::epoch::{test_epoch, EpochExt};
Expand All @@ -29,15 +28,12 @@ use risingwave_storage::memory::MemoryStateStore;

use super::exchange::permit::channel_for_test;
use super::*;
use crate::executor::actor::ActorContext;
use crate::executor::dispatch::*;
use crate::executor::exchange::output::{BoxedOutput, LocalOutput};
use crate::executor::monitor::StreamingMetrics;
use crate::executor::receiver::ReceiverExecutor;
use crate::executor::test_utils::agg_executor::{
generate_agg_schema, new_boxed_simple_agg_executor,
};
use crate::executor::{Execute, MergeExecutor, ProjectExecutor, StatelessSimpleAggExecutor};
use crate::task::{LocalBarrierManager, SharedContext};

/// This test creates a merger-dispatcher pair, and run a sum. Each chunk
Expand Down
1 change: 0 additions & 1 deletion src/stream/src/executor/join/hash_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
4 changes: 1 addition & 3 deletions src/stream/src/executor/lookup_union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
7 changes: 1 addition & 6 deletions src/stream/src/executor/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,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::{
Expand All @@ -438,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;

Expand Down
10 changes: 2 additions & 8 deletions src/stream/src/executor/mview/materialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 3 additions & 5 deletions src/stream/src/executor/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
4 changes: 1 addition & 3 deletions src/stream/src/executor/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 2 additions & 4 deletions src/stream/src/executor/row_id_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 0 additions & 2 deletions src/stream/src/executor/simple_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 8de5c73

Please sign in to comment.