Skip to content

Commit

Permalink
bump rust toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
leiysky committed Jan 23, 2024
1 parent 5dcd1d0 commit 6730b65
Show file tree
Hide file tree
Showing 108 changed files with 311 additions and 288 deletions.
10 changes: 5 additions & 5 deletions .github/actions/build_linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ runs:
artifacts="meta,metactl,query,sqllogictests"
for artifact in ${artifacts//,/ }; do
echo "==> building databend-$artifact ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
done
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin open-sharing
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin open-sharing
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-*
- name: Build Debug for specific artifacts
Expand All @@ -82,7 +82,7 @@ runs:
artifacts="${{ inputs.artifacts }}"
for artifact in ${artifacts//,/ }; do
echo "==> building databend-$artifact ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
done
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
Expand All @@ -93,7 +93,7 @@ runs:
artifacts="meta,metactl,query,sqllogictests"
for artifact in ${artifacts//,/ }; do
echo "==> building databend-$artifact ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
done
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
Expand All @@ -104,7 +104,7 @@ runs:
artifacts="${{ inputs.artifacts }}"
for artifact in ${artifacts//,/ }; do
echo "==> building databend-$artifact ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
done
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/build_linux_sanitizer/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ runs:
artifacts="meta,metactl,query"
for artifact in ${artifacts//,/ }; do
echo "==> building databend-$artifact with sanitizer ..."
cargo -Zbuild-std -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --manifest-path src/binaries/Cargo.toml --bin databend-$artifact
cargo -Zbuild-std -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --manifest-path src/binaries/Cargo.toml --bin databend-$artifact
done
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-*
Expand Down
10 changes: 5 additions & 5 deletions .github/actions/build_macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ runs:
- name: Build Debug for all artifacts
if: env.BUILD_PROFILE == 'debug' && inputs.artifacts == 'all'
shell: bash
run: cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }}
run: cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }}

- name: Build Debug for specific artifacts
if: env.BUILD_PROFILE == 'debug' && inputs.artifacts != 'all'
shell: bash
run: |
artifacts="${{ inputs.artifacts }}"
echo "==> building libs ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --lib
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --lib
for artifact in ${artifacts//,/ }; do
echo "==> building databend-$artifact ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --bin databend-$artifact
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --bin databend-$artifact
done
- name: Build Release
Expand All @@ -64,10 +64,10 @@ runs:
run: |
artifacts="${{ inputs.artifacts }}"
echo "==> building libs ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --release --lib
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --release --lib
for artifact in ${artifacts//,/ }; do
echo "==> building databend-$artifact ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --release --bin databend-$artifact
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --release --bin databend-$artifact
done
- name: Upload artifact
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ runs:

- name: Clippy
shell: bash
run: cargo -Zgitoxide=fetch,shallow-index,shallow-deps clippy --workspace --all-targets --all-features -- -D warnings
run: cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps clippy --workspace --all-targets --all-features -- -D warnings
2 changes: 1 addition & 1 deletion .github/actions/test_unit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ runs:

- shell: bash
run: |
cargo -Zgitoxide=fetch,shallow-index,shallow-deps nextest run --no-fail-fast --hide-progress-bar
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps nextest run --no-fail-fast --hide-progress-bar
env:
RUST_TEST_THREADS: "8"
RUST_LOG: ERROR
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2023-10-23"
channel = "nightly-2024-01-23"
components = ["rustfmt", "clippy", "rust-src", "miri", "rust-analyzer"]
1 change: 0 additions & 1 deletion src/common/arrow/src/arrow/array/boolean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ mod from;
mod iterator;
mod mutable;

pub use iterator::*;
pub use mutable::*;

/// A [`BooleanArray`] is Arrow's semantically equivalent of an immutable `Vec<Option<bool>>`.
Expand Down
43 changes: 22 additions & 21 deletions src/common/arrow/src/arrow/array/dictionary/value_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ impl<K: DictionaryKey, M: MutableArray> ValueMap<K, M> {
// safety: we only iterate within bounds
let value = unsafe { values.value_unchecked_at(index) };
let hash = ahash_hash(value.borrow());
match map.raw_entry_mut().from_hash(hash, |item| {
let entry = map.raw_entry_mut().from_hash(hash, |item| {
// safety: invariant of the struct, it's always in bounds since we maintain it
let stored_value = unsafe { values.value_unchecked_at(item.key.as_usize()) };
stored_value.borrow() == value.borrow()
}) {
});
match entry {
RawEntryMut::Occupied(_) => {
return Err(Error::InvalidArgumentError(
"duplicate value in dictionary values array".into(),
Expand Down Expand Up @@ -158,25 +159,25 @@ impl<K: DictionaryKey, M: MutableArray> ValueMap<K, M> {
M::Type: Eq + Hash,
{
let hash = ahash_hash(value.as_indexed());
Ok(
match self.map.raw_entry_mut().from_hash(hash, |item| {
// safety: we've already checked (the inverse) when we pushed it, so it should be ok?
let index = unsafe { item.key.as_usize() };
// safety: invariant of the struct, it's always in bounds since we maintain it
let stored_value = unsafe { self.values.value_unchecked_at(index) };
stored_value.borrow() == value.as_indexed()
}) {
RawEntryMut::Occupied(entry) => entry.key().key,
RawEntryMut::Vacant(entry) => {
let index = self.values.len();
let key = K::try_from(index).map_err(|_| Error::Overflow)?;
entry.insert_hashed_nocheck(hash, Hashed { hash, key }, ()); // NB: don't use .insert() here!
push(&mut self.values, value)?;
debug_assert_eq!(self.values.len(), index + 1);
key
}
},
)
let entry = self.map.raw_entry_mut().from_hash(hash, |item| {
// safety: we've already checked (the inverse) when we pushed it, so it should be ok?
let index = unsafe { item.key.as_usize() };
// safety: invariant of the struct, it's always in bounds since we maintain it
let stored_value = unsafe { self.values.value_unchecked_at(index) };
stored_value.borrow() == value.as_indexed()
});
let result = match entry {
RawEntryMut::Occupied(entry) => entry.key().key,
RawEntryMut::Vacant(entry) => {
let index = self.values.len();
let key = K::try_from(index).map_err(|_| Error::Overflow)?;
entry.insert_hashed_nocheck(hash, Hashed { hash, key }, ()); // NB: don't use .insert() here!
push(&mut self.values, value)?;
debug_assert_eq!(self.values.len(), index + 1);
key
}
};
Ok(result)
}

pub fn shrink_to_fit(&mut self) {
Expand Down
1 change: 0 additions & 1 deletion src/common/arrow/src/arrow/array/fixed_size_list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ mod data;
mod ffi;
pub(super) mod fmt;
mod iterator;
pub use iterator::*;
mod mutable;
pub use mutable::*;

Expand Down
1 change: 0 additions & 1 deletion src/common/arrow/src/arrow/array/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ mod data;
mod ffi;
pub(super) mod fmt;
mod iterator;
pub use iterator::*;

/// An array representing a (key, value), both of arbitrary logical types.
#[derive(Clone)]
Expand Down
1 change: 0 additions & 1 deletion src/common/arrow/src/arrow/array/primitive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ mod ffi;
pub(super) mod fmt;
mod from_natural;
mod iterator;
pub use iterator::*;
mod mutable;
pub use mutable::*;

Expand Down
1 change: 1 addition & 0 deletions src/common/arrow/src/arrow/buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use std::ops::Deref;

use crate::arrow::ffi::InternalArrowArray;

#[allow(dead_code)]
pub(crate) enum BytesAllocator {
InternalArrowArray(InternalArrowArray),

Expand Down
2 changes: 1 addition & 1 deletion src/common/arrow/src/arrow/compute/sort/row/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn encoded_len(a: Option<&[u8]>) -> usize {
pub fn encode<'a, I: Iterator<Item = Option<&'a [u8]>>>(out: &mut Rows, i: I, opts: SortOptions) {
for (offset, maybe_val) in out.offsets.iter_mut().skip(1).zip(i) {
match maybe_val {
Some(val) if val.is_empty() => {
Some([]) => {
out.buffer[*offset] = match opts.descending {
true => !EMPTY_SENTINEL,
false => EMPTY_SENTINEL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use super::super::Pages;
use super::utils::DecodedState;
use super::utils::MaybeNext;
use super::utils::PageState;
pub use super::utils::Zip;
use crate::arrow::array::Array;
use crate::arrow::bitmap::MutableBitmap;
use crate::arrow::error::Result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ impl<T, I, P, F> Iter<T, I, P, F>
where
I: Pages,
T: NativeType,

P: ParquetNativeType,
F: Copy + Fn(P) -> T,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ where
K: DictionaryKey,
I: Pages,
T: NativeType,

P: ParquetNativeType,
F: Copy + Fn(P) -> T,
{
Expand Down Expand Up @@ -153,7 +152,6 @@ where
K: DictionaryKey,
I: Pages,
T: NativeType,

P: ParquetNativeType,
F: Copy + Fn(P) -> T,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ impl<T, I, P, F> IntegerIter<T, I, P, F>
where
I: Pages,
T: NativeType,

P: ParquetNativeType,
F: Copy + Fn(P) -> T,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ pub struct NestedIter<T, I, P, F>
where
I: Pages,
T: NativeType,

P: ParquetNativeType,
F: Copy + Fn(P) -> T,
{
Expand All @@ -205,7 +204,6 @@ impl<T, I, P, F> NestedIter<T, I, P, F>
where
I: Pages,
T: NativeType,

P: ParquetNativeType,
F: Copy + Fn(P) -> T,
{
Expand Down Expand Up @@ -234,7 +232,6 @@ impl<T, I, P, F> Iterator for NestedIter<T, I, P, F>
where
I: Pages,
T: NativeType,

P: ParquetNativeType,
F: Copy + Fn(P) -> T,
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/arrow/src/arrow/types/simd/packed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ pub use std::simd::i8x8;
pub use std::simd::mask32x16 as m32x16;
pub use std::simd::mask64x8 as m64x8;
pub use std::simd::mask8x64 as m8x64;
pub use std::simd::prelude::SimdPartialEq;
pub use std::simd::u16x32;
pub use std::simd::u16x8;
pub use std::simd::u32x16;
pub use std::simd::u32x8;
pub use std::simd::u64x8;
pub use std::simd::u8x64;
pub use std::simd::u8x8;
pub use std::simd::SimdPartialEq;

/// Vector of 32 16-bit masks
#[allow(non_camel_case_types)]
Expand Down
1 change: 1 addition & 0 deletions src/common/arrow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

#![feature(iter_advance_by)]
#![allow(clippy::unconditional_recursion)]
#![cfg_attr(feature = "simd", feature(portable_simd))]
#![allow(clippy::redundant_closure_call)]
#![allow(clippy::non_canonical_partial_ord_impl)]
Expand Down
2 changes: 1 addition & 1 deletion src/common/arrow/tests/it/arrow/array/binary/mutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn from_iter() {

#[test]
fn from_trusted_len_iter() {
let data = vec![vec![0; 0], vec![1; 1], vec![2; 2]];
let data = [vec![0; 0], vec![1; 1], vec![2; 2]];
let a: MutableBinaryArray<i32> = data.iter().cloned().map(Some).collect();
assert_eq!(a.values().deref(), &[1u8, 2, 2]);
assert_eq!(a.offsets().as_slice(), &[0, 0, 1, 3]);
Expand Down
7 changes: 4 additions & 3 deletions src/common/base/src/runtime/runtime_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ use std::fmt::Formatter;
use std::future::Future;
use std::mem::take;
use std::pin::Pin;
use std::ptr::addr_of_mut;
use std::sync::atomic::AtomicI64;
use std::sync::atomic::Ordering;
use std::sync::Arc;
Expand All @@ -67,7 +68,7 @@ pub static GLOBAL_MEM_STAT: MemStat = MemStat::global();
// For implemented and needs to call drop, we cannot use the attribute tag thread local.
// https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=ea33533387d401e86423df1a764b5609
thread_local! {
static TRACKER: RefCell<ThreadTracker> = RefCell::new(ThreadTracker::empty());
static TRACKER: RefCell<ThreadTracker> = const { RefCell::new(ThreadTracker::empty()) };
}

#[thread_local]
Expand Down Expand Up @@ -231,7 +232,7 @@ impl ThreadTracker {
/// `size` is the positive number of allocated bytes.
#[inline]
pub fn alloc(size: i64) -> Result<(), AllocError> {
let state_buffer = unsafe { &mut STAT_BUFFER };
let state_buffer = unsafe { &mut *addr_of_mut!(STAT_BUFFER) };

// Rust will alloc or dealloc memory after the thread local is destroyed when we using thread_local macro.
// This is the boundary of thread exit. It may be dangerous to throw mistakes here.
Expand Down Expand Up @@ -265,7 +266,7 @@ impl ThreadTracker {
/// `size` is positive number of bytes of the memory to deallocate.
#[inline]
pub fn dealloc(size: i64) {
let state_buffer = unsafe { &mut STAT_BUFFER };
let state_buffer = unsafe { &mut *addr_of_mut!(STAT_BUFFER) };

// Rust will alloc or dealloc memory after the thread local is destroyed when we using thread_local macro.
if state_buffer.destroyed_thread_local_macro {
Expand Down
2 changes: 2 additions & 0 deletions src/common/hashtable/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![allow(internal_features)]
#![allow(clippy::ptr_arg)]
#![feature(core_intrinsics)]
#![feature(allocator_api)]
#![feature(arbitrary_self_types)]
Expand Down
25 changes: 14 additions & 11 deletions src/common/io/src/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use databend_common_exception::Result;
use roaring::RoaringTreemap;

pub fn parse_bitmap(buf: &[u8]) -> Result<RoaringTreemap> {
match std::str::from_utf8(buf)
std::str::from_utf8(buf)
.map_err(|e| e.to_string())
.and_then(|s| {
let s: String = s.chars().filter(|c| !c.is_whitespace()).collect();
Expand All @@ -26,14 +26,17 @@ pub fn parse_bitmap(buf: &[u8]) -> Result<RoaringTreemap> {
.map(|v| v.parse::<u64>().map_err(|e| e.to_string()))
.collect();
result
}) {
Ok(v) => {
let rb = RoaringTreemap::from_iter(v.iter());
Ok(rb)
}
Err(_) => Err(ErrorCode::BadBytes(format!(
"Invalid Bitmap value: {:?}",
String::from_utf8_lossy(buf)
))),
}
})
.map_or_else(
|_| {
Err(ErrorCode::BadBytes(format!(
"Invalid Bitmap value: {:?}",
String::from_utf8_lossy(buf)
)))
},
|v| {
let rb = RoaringTreemap::from_iter(v.iter());
Ok(rb)
},
)
}
Loading

0 comments on commit 6730b65

Please sign in to comment.