Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 8 additions & 8 deletions rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
convert::TryInto,
fmt,
future::Future,
iter,

Check warning on line 47 in rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs

View workflow job for this annotation

GitHub Actions / Build native Linux 22 x86_64-unknown-linux-gnu Python fallback

unused import: `iter`

Check warning on line 47 in rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs

View workflow job for this annotation

GitHub Actions / Build native linux (Python: 3.11)

unused import: `iter`
pin::Pin,
result,
sync::{Arc, LazyLock},
Expand Down Expand Up @@ -137,17 +137,17 @@
match expr {
Expr::GroupingSet(groupping_set) => match groupping_set {
GroupingSet::Rollup(exprs) => {
result.extend(
iter::repeat(Some(GroupingSetDesc::new(GroupingSetType::Rollup, id)))
.take(exprs.len()),
);
result.extend(std::iter::repeat_n(
Some(GroupingSetDesc::new(GroupingSetType::Rollup, id)),
exprs.len(),
));
id += 1;
}
GroupingSet::Cube(exprs) => {
result.extend(
iter::repeat(Some(GroupingSetDesc::new(GroupingSetType::Cube, id)))
.take(exprs.len()),
);
result.extend(std::iter::repeat_n(
Some(GroupingSetDesc::new(GroupingSetType::Cube, id)),
exprs.len(),
));
id += 1;
}
GroupingSet::GroupingSets(_) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2708,7 +2708,7 @@ impl MemberRules {
let Some(left_cube) = left_join_hints
.iter()
.filter(|hint| !hint.is_empty())
.last()
.next_back()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.and_then(|hint| hint.last())
.or_else(|| left_alias_to_cube.first().map(|(_, cube)| cube))
.cloned()
Expand Down
5 changes: 1 addition & 4 deletions rust/cubesql/pg-srv/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ pub async fn read_contents<Reader: AsyncReadExt + Unpin>(
// protocol defines length for all types of messages
let length = reader.read_u32().await?;
if length < 4 {
return Err(Error::new(
ErrorKind::Other,
"Unexpectedly small (<0) message size",
));
return Err(Error::other("Unexpectedly small (<0) message size"));
}

trace!(
Expand Down
11 changes: 4 additions & 7 deletions rust/cubesql/pg-srv/src/values/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use bytes::{BufMut, BytesMut};
use chrono::NaiveDate;
use std::backtrace::Backtrace;
use std::io::{Error, ErrorKind};

Check warning on line 8 in rust/cubesql/pg-srv/src/values/date.rs

View workflow job for this annotation

GitHub Actions / Build native Linux 22 x86_64-unknown-linux-gnu Python fallback

unused import: `ErrorKind`

Check warning on line 8 in rust/cubesql/pg-srv/src/values/date.rs

View workflow job for this annotation

GitHub Actions / Build native linux (Python: 3.11)

unused import: `ErrorKind`

pub type DateValue = NaiveDate;

Expand All @@ -21,13 +21,10 @@
.signed_duration_since(pg_base_date_epoch().date())
.num_days();
if n > (i32::MAX as i64) {
return Err(Error::new(
ErrorKind::Other,
format!(
"value too large to store in the binary format (i32), actual: {}",
n
),
)
return Err(Error::other(format!(
"value too large to store in the binary format (i32), actual: {}",
n
))
.into());
}

Expand Down
5 changes: 2 additions & 3 deletions rust/cubesql/pg-srv/src/values/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl TimestampValue {
.as_ref()
.unwrap()
.parse::<Tz>()
.map_err(|err| io::Error::new(io::ErrorKind::Other, err.to_string()))?;
.map_err(|err| io::Error::other(err.to_string()))?;
let ndt = self.to_naive_datetime();
Ok(tz.from_utc_datetime(&ndt))
}
Expand Down Expand Up @@ -134,8 +134,7 @@ impl ToProtocolValue for TimestampValue {
let n = ndt
.signed_duration_since(pg_base_date_epoch())
.num_microseconds()
.ok_or(Error::new(
io::ErrorKind::Other,
.ok_or(Error::other(
"Unable to extract number of seconds from timestamp",
))?;

Expand Down
Loading