Skip to content

Commit

Permalink
chore: remove reduntant uses
Browse files Browse the repository at this point in the history
Signed-off-by: MrCroxx <[email protected]>
  • Loading branch information
MrCroxx committed Apr 11, 2024
1 parent 5263667 commit 2316d96
Show file tree
Hide file tree
Showing 120 changed files with 58 additions and 221 deletions.
1 change: 0 additions & 1 deletion src/compute/src/rpc/service/config_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 3 additions & 6 deletions src/connector/src/parser/avro/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

fn test_data_path(file_name: &str) -> String {
Expand Down
1 change: 0 additions & 1 deletion src/connector/src/parser/canal/simd_json_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ mod tests {

use super::*;
use crate::parser::SourceStreamChunkBuilder;
use crate::source::SourceColumnDesc;

#[tokio::test]
async fn test_data_types() {
Expand Down
5 changes: 1 addition & 4 deletions src/connector/src/parser/debezium/avro_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

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
2 changes: 0 additions & 2 deletions src/connector/src/parser/debezium/simd_json_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,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;
Expand Down
2 changes: 1 addition & 1 deletion src/connector/src/parser/protobuf/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/connector/src/parser/unified/avro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
4 changes: 2 additions & 2 deletions src/connector/src/sink/encoder/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ fn type_as_json_schema(rw_type: &DataType) -> Map<String, Value> {
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::*;
Expand Down
4 changes: 2 additions & 2 deletions src/connector/src/sink/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,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;

Expand Down
1 change: 0 additions & 1 deletion src/connector/src/sink/snowflake_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use std::collections::HashMap;
use std::time::{SystemTime, UNIX_EPOCH};

use aws_config;
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_s3::config::Credentials;
use aws_sdk_s3::primitives::ByteStream;
Expand Down
2 changes: 0 additions & 2 deletions src/connector/src/source/kafka/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ impl RdKafkaPropertiesConsumer {

#[cfg(test)]
mod test {
use std::collections::HashMap;

use maplit::hashmap;

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion src/connector/src/source/kinesis/enumerator/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 0 additions & 2 deletions src/connector/src/source/kinesis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ impl crate::source::UnknownFields for KinesisProperties {

#[cfg(test)]
mod test {
use std::collections::HashMap;

use maplit::hashmap;

use super::*;
Expand Down
2 changes: 0 additions & 2 deletions src/connector/src/source/kinesis/source/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -306,7 +305,6 @@ mod tests {

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

#[tokio::test]
async fn test_reject_redundant_seq_props() {
Expand Down
1 change: 0 additions & 1 deletion src/connector/src/source/nats/source/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
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::{SourceEnumeratorContext, SplitEnumerator};

#[tokio::test]
Expand Down
2 changes: 0 additions & 2 deletions src/ctl/src/cmd_impl/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
1 change: 0 additions & 1 deletion src/ctl/src/cmd_impl/meta/reschedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/ctl/src/cmd_impl/scale/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/dml/src/dml_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
5 changes: 1 addition & 4 deletions src/dml/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
3 changes: 0 additions & 3 deletions src/error/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 0 additions & 3 deletions src/expr/core/src/expr/and_or.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ fn or(l: Option<bool>, r: Option<bool>) -> Option<bool> {

#[cfg(test)]
mod tests {
use risingwave_common::array::DataChunk;
use risingwave_common::test_prelude::DataChunkTestExt;

use super::*;
use crate::expr::build_from_pretty;

Expand Down
1 change: 0 additions & 1 deletion src/expr/core/src/expr/expr_literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
1 change: 0 additions & 1 deletion src/expr/core/src/expr/expr_some_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/expr/core/src/expr/expr_udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

use std::collections::HashMap;
use std::convert::TryFrom;
use std::sync::atomic::{AtomicU8, Ordering};
use std::sync::{Arc, LazyLock, Weak};
use std::time::Duration;
Expand Down
2 changes: 1 addition & 1 deletion src/expr/core/src/table_function/user_defined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use arrow_udf_js::{CallMode as JsCallMode, Runtime as JsRuntime};
use arrow_udf_python::{CallMode as PythonCallMode, Runtime as PythonRuntime};
use cfg_or_panic::cfg_or_panic;
use futures_util::stream;
use risingwave_common::array::{ArrayError, DataChunk, I32Array};
use risingwave_common::array::{ArrayError, I32Array};
use risingwave_common::bail;
use thiserror_ext::AsReport;

Expand Down
1 change: 0 additions & 1 deletion src/expr/impl/benches/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions src/expr/impl/src/aggregate/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
5 changes: 1 addition & 4 deletions src/expr/impl/src/scalar/arithmetic_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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::*;

Expand Down
1 change: 0 additions & 1 deletion src/expr/impl/src/scalar/bitwise_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
1 change: 0 additions & 1 deletion src/expr/impl/src/scalar/case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/expr/impl/src/scalar/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,9 @@ fn struct_cast(input: StructRef<'_>, ctx: &Context) -> Result<StructValue> {
#[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::*;

Expand Down
1 change: 0 additions & 1 deletion src/expr/impl/src/scalar/proctime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ fn proctime() -> Result<Timestamptz> {

#[cfg(test)]
mod tests {
use risingwave_common::types::Timestamptz;
use risingwave_common::util::epoch::{Epoch, EpochPair};

use super::*;
Expand Down
3 changes: 0 additions & 3 deletions src/expr/impl/src/scalar/round.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>) {
Expand Down
2 changes: 1 addition & 1 deletion src/expr/impl/src/scalar/trigonometric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
3 changes: 1 addition & 2 deletions src/frontend/src/binder/expr/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/binder/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
Loading

0 comments on commit 2316d96

Please sign in to comment.