Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
Signed-off-by: chenxu <[email protected]>
  • Loading branch information
dmetasoul01 committed Nov 22, 2024
1 parent 26b1d20 commit 6ca4402
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions rust/lakesoul-metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
//
// SPDX-License-Identifier: Apache-2.0

use std::str::FromStr;
use std::io::ErrorKind;
use std::str::FromStr;

use postgres_types::{FromSql, ToSql};
use prost::Message;
pub use tokio::runtime::{Builder, Runtime};
pub use tokio_postgres::{Client, NoTls, Statement};
use tokio_postgres::{Error, GenericClient, Row};
use tokio_postgres::{Error, Row};

use crate::pooled_client::PgConnection;
pub use crate::pooled_client::PooledClient;
Expand Down Expand Up @@ -413,11 +413,7 @@ fn separate_uuid(concated_uuid: &str) -> Result<Vec<String>> {
Ok(uuid_list)
}

pub async fn execute_query(
client: &PooledClient,
query_type: i32,
joined_string: String,
) -> Result<Vec<u8>> {
pub async fn execute_query(client: &PooledClient, query_type: i32, joined_string: String) -> Result<Vec<u8>> {
if query_type >= DAO_TYPE_INSERT_ONE_OFFSET {
eprintln!("Invalid query_type_index: {:?}", query_type);
return Err(LakeSoulMetaDataError::from(ErrorKind::InvalidInput));
Expand Down Expand Up @@ -574,9 +570,7 @@ pub async fn execute_query(
and m.partition_desc = $2::text;
";
let partitions = params[1].to_owned();
let partitions = partitions
.split(PARTITION_DESC_DELIM)
.collect::<Vec<&str>>();
let partitions = partitions.split(PARTITION_DESC_DELIM).collect::<Vec<&str>>();
let statement = client.prepare_cached(&statement).await?;
let mut all_rows: Vec<Row> = vec![];
for part in partitions {
Expand Down Expand Up @@ -827,11 +821,7 @@ pub async fn execute_query(
Ok(wrapper.encode_to_vec())
}

pub async fn execute_insert(
client: &mut PooledClient,
insert_type: i32,
wrapper: entity::JniWrapper,
) -> Result<i32> {
pub async fn execute_insert(client: &mut PooledClient, insert_type: i32, wrapper: entity::JniWrapper) -> Result<i32> {
if !(DAO_TYPE_INSERT_ONE_OFFSET..DAO_TYPE_QUERY_SCALAR_OFFSET).contains(&insert_type) {
eprintln!("Invalid insert_type_index: {:?}", insert_type);
return Err(LakeSoulMetaDataError::from(ErrorKind::InvalidInput));
Expand Down Expand Up @@ -1111,11 +1101,7 @@ pub async fn execute_insert(
}
}

pub async fn execute_update(
client: &mut PooledClient,
update_type: i32,
joined_string: String,
) -> Result<i32> {
pub async fn execute_update(client: &mut PooledClient, update_type: i32, joined_string: String) -> Result<i32> {
if update_type < DAO_TYPE_UPDATE_OFFSET {
eprintln!("Invalid update_type_index: {:?}", update_type);
return Err(LakeSoulMetaDataError::from(ErrorKind::InvalidInput));
Expand Down

0 comments on commit 6ca4402

Please sign in to comment.