Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor: remove redundant prefix #2983

Merged
merged 2 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arrow-buffer/src/alloc/alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// NOTE: Below code is written for spatial/temporal prefetcher optimizations. Memory allocation
// should align well with usage pattern of cache access and block sizes on layers of storage levels from
// registers to non-volatile memory. These alignments are all cache aware alignments incorporated
// from [cuneiform](https://crates.io/crates/cuneiform) crate. This approach mimicks Intel TBB's
// from [cuneiform](https://crates.io/crates/cuneiform) crate. This approach mimics Intel TBB's
// cache_aligned_allocator which exploits cache locality and minimizes prefetch signals
// resulting in less round trip time between the layers of storage.
// For further info: https://software.intel.com/en-us/node/506094
Expand Down
4 changes: 2 additions & 2 deletions arrow-data/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ impl ArrayData {
) -> Result<&[T], ArrowError> {
let buffer = &self.buffers[idx];

let required_len = (len + self.offset) * std::mem::size_of::<T>();
let required_len = (len + self.offset) * mem::size_of::<T>();

if buffer.len() < required_len {
return Err(ArrowError::InvalidArgumentError(format!(
Expand Down Expand Up @@ -1170,7 +1170,7 @@ impl ArrayData {

// This should have been checked as part of `validate()` prior
// to calling `validate_full()` but double check to be sure
assert!(buffer.len() / std::mem::size_of::<T>() >= required_len);
assert!(buffer.len() / mem::size_of::<T>() >= required_len);

// Justification: buffer size was validated above
let indexes: &[T] =
Expand Down
2 changes: 1 addition & 1 deletion arrow-flight/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let proto_path = Path::new("../format/FlightSql.proto");

tonic_build::configure()
// protoc in unbuntu builder needs this option
// protoc in ubuntu builder needs this option
.protoc_arg("--experimental_allow_proto3_optional")
.out_dir("src/sql")
.compile(&[proto_path], &[proto_dir])?;
Expand Down
2 changes: 1 addition & 1 deletion arrow-flight/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ fn schema_to_ipc_format(schema_ipc: SchemaAsIpc) -> ArrowResult<IpcMessage> {
let encoded_data = flight_schema_as_encoded_data(pair.0, pair.1);

let mut schema = vec![];
arrow::ipc::writer::write_message(&mut schema, encoded_data, pair.1)?;
writer::write_message(&mut schema, encoded_data, pair.1)?;
Ok(IpcMessage(schema))
}

Expand Down
2 changes: 1 addition & 1 deletion arrow-flight/src/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl ProstAnyExt for prost_types::Any {
if !self.is::<M>() {
return Ok(None);
}
let m = prost::Message::decode(&*self.value).map_err(|err| {
let m = Message::decode(&*self.value).map_err(|err| {
ArrowError::ParseError(format!("Unable to decode Any value: {}", err))
})?;
Ok(Some(m))
Expand Down
22 changes: 10 additions & 12 deletions arrow-flight/src/sql/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ static CLOSE_PREPARED_STATEMENT: &str = "ClosePreparedStatement";

/// Implements FlightSqlService to handle the flight sql protocol
#[tonic::async_trait]
pub trait FlightSqlService:
std::marker::Sync + std::marker::Send + std::marker::Sized + 'static
{
pub trait FlightSqlService: Sync + Send + Sized + 'static {
/// When impl FlightSqlService, you can always set FlightService to Self
type FlightService: FlightService;

Expand Down Expand Up @@ -276,7 +274,7 @@ pub trait FlightSqlService:
#[tonic::async_trait]
impl<T: 'static> FlightService for T
where
T: FlightSqlService + std::marker::Send,
T: FlightSqlService + Send,
{
type HandshakeStream =
Pin<Box<dyn Stream<Item = Result<HandshakeResponse, Status>> + Send + 'static>>;
Expand Down Expand Up @@ -413,7 +411,7 @@ where
&self,
request: Request<Ticket>,
) -> Result<Response<Self::DoGetStream>, Status> {
let msg: prost_types::Any = prost::Message::decode(&*request.get_ref().ticket)
let msg: prost_types::Any = Message::decode(&*request.get_ref().ticket)
.map_err(decode_error_to_status)?;

fn unpack<T: ProstMessageExt>(msg: prost_types::Any) -> Result<T, Status> {
Expand Down Expand Up @@ -465,7 +463,7 @@ where
) -> Result<Response<Self::DoPutStream>, Status> {
let cmd = request.get_mut().message().await?.unwrap();
let message: prost_types::Any =
prost::Message::decode(&*cmd.flight_descriptor.unwrap().cmd)
Message::decode(&*cmd.flight_descriptor.unwrap().cmd)
.map_err(decode_error_to_status)?;
if message.is::<CommandStatementUpdate>() {
let token = message
Expand All @@ -474,7 +472,7 @@ where
.expect("unreachable");
let record_count = self.do_put_statement_update(token, request).await?;
let result = DoPutUpdateResult { record_count };
let output = futures::stream::iter(vec![Ok(super::super::gen::PutResult {
let output = futures::stream::iter(vec![Ok(PutResult {
app_metadata: result.encode_to_vec(),
})]);
return Ok(Response::new(Box::pin(output)));
Expand All @@ -495,7 +493,7 @@ where
.do_put_prepared_statement_update(handle, request)
.await?;
let result = DoPutUpdateResult { record_count };
let output = futures::stream::iter(vec![Ok(super::super::gen::PutResult {
let output = futures::stream::iter(vec![Ok(PutResult {
app_metadata: result.encode_to_vec(),
})]);
return Ok(Response::new(Box::pin(output)));
Expand Down Expand Up @@ -587,10 +585,10 @@ where
}
}

fn decode_error_to_status(err: prost::DecodeError) -> tonic::Status {
tonic::Status::invalid_argument(format!("{:?}", err))
fn decode_error_to_status(err: prost::DecodeError) -> Status {
Status::invalid_argument(format!("{:?}", err))
}

fn arrow_error_to_status(err: arrow::error::ArrowError) -> tonic::Status {
tonic::Status::internal(format!("{:?}", err))
fn arrow_error_to_status(err: arrow::error::ArrowError) -> Status {
Status::internal(format!("{:?}", err))
}
6 changes: 3 additions & 3 deletions arrow-schema/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ impl ArrowError {
}
}

impl From<::std::io::Error> for ArrowError {
impl From<std::io::Error> for ArrowError {
fn from(error: std::io::Error) -> Self {
ArrowError::IoError(error.to_string())
}
}

impl From<::std::string::FromUtf8Error> for ArrowError {
impl From<std::string::FromUtf8Error> for ArrowError {
fn from(error: std::string::FromUtf8Error) -> Self {
ArrowError::ParseError(error.to_string())
}
}

impl<W: Write> From<::std::io::IntoInnerError<W>> for ArrowError {
impl<W: Write> From<std::io::IntoInnerError<W>> for ArrowError {
fn from(error: std::io::IntoInnerError<W>) -> Self {
ArrowError::IoError(error.to_string())
}
Expand Down