Skip to content

Commit

Permalink
chore(rust): update to rustc to nightly-2022-10-24 (#5312)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Oct 24, 2022
1 parent 0940b28 commit 55643f6
Show file tree
Hide file tree
Showing 33 changed files with 51 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/deploy_manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ls -la
rm py-polars/README.md
cp README.md py-polars/README.md
cd py-polars
rustup override set nightly-2022-10-06
rustup override set nightly-2022-10-24
export RUSTFLAGS='-C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma'

# first the default release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-10-06
toolchain: nightly-2022-10-24

- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-test-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-10-06
toolchain: nightly-2022-10-24

- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand All @@ -58,7 +58,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-10-06
toolchain: nightly-2022-10-24
components: rustfmt, clippy, miri

- name: Cache Rust
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-10-06
toolchain: nightly-2022-10-24

- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-py-release-mac-universal2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-10-06
toolchain: nightly-2022-10-24

- name: Set up Rust targets
run: rustup target add aarch64-apple-darwin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-py-release-manylinux-lts-cpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt
with:
rust-toolchain: nightly-2022-10-06
rust-toolchain: nightly-2022-10-24
maturin-version: '0.13.5'
command: publish
args: -m py-polars/Cargo.toml --skip-existing -o wheels -u ritchie46
6 changes: 3 additions & 3 deletions .github/workflows/create-py-release-manylinux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma
with:
rust-toolchain: nightly-2022-10-06
rust-toolchain: nightly-2022-10-24
maturin-version: '0.13.5'
command: publish
args: -m py-polars/Cargo.toml --skip-existing -o wheels -u ritchie46
Expand All @@ -53,7 +53,7 @@ jobs:
env:
MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
with:
rust-toolchain: nightly-2022-10-06
rust-toolchain: nightly-2022-10-24
target: aarch64-unknown-linux-gnu
maturin-version: '0.13.5'
command: publish
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma
with:
rust-toolchain: nightly-2022-10-06
rust-toolchain: nightly-2022-10-24
maturin-version: '0.13.5'
command: publish
args: -m py-polars/Cargo.toml --skip-existing -o wheels -u ritchie46
2 changes: 1 addition & 1 deletion .github/workflows/create-py-release-windows-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+sse4.1,+sse4.2
with:
rust-toolchain: nightly-2022-10-06
rust-toolchain: nightly-2022-10-24
maturin-version: '0.13.5'
command: publish
args: -m py-polars/Cargo.toml --no-sdist --skip-existing -o wheels -i python -u ritchie46
2 changes: 1 addition & 1 deletion .github/workflows/docs-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-10-06
toolchain: nightly-2022-10-24
components: rust-docs

- name: Cache Rust
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-10-06
toolchain: nightly-2022-10-24
components: rustfmt, clippy
- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-10-06
toolchain: nightly-2022-10-24

- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-10-06
toolchain: nightly-2022-10-24

- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand Down
6 changes: 3 additions & 3 deletions polars/polars-arrow/src/compute/take/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub unsafe fn take_no_null_primitive_iter_unchecked<T: NativeType, I: TrustedLen
let array_values = arr.values().as_slice();

let iter = indices.into_iter().map(|idx| {
debug_assert!((idx as usize) < array_values.len());
debug_assert!((idx) < array_values.len());
*array_values.get_unchecked(idx)
});

Expand Down Expand Up @@ -476,7 +476,7 @@ pub unsafe fn take_utf8_unchecked(
// Allocate 2.0 times the expected size.
// where expected size is the length of bytes multiplied by the factor (take_len / current_len)
let mut values_capacity = if arr.len() > 0 {
((arr.len() as f32 * 2.0) as usize) / arr.len() * indices.len() as usize
((arr.len() as f32 * 2.0) as usize) / arr.len() * indices.len()
} else {
0
};
Expand Down Expand Up @@ -589,7 +589,7 @@ pub unsafe fn take_binary_unchecked(
// Allocate 2.0 times the expected size.
// where expected size is the length of bytes multiplied by the factor (take_len / current_len)
let mut values_capacity = if arr.len() > 0 {
((arr.len() as f32 * 2.0) as usize) / arr.len() * indices.len() as usize
((arr.len() as f32 * 2.0) as usize) / arr.len() * indices.len()
} else {
0
};
Expand Down
4 changes: 2 additions & 2 deletions polars/polars-arrow/src/kernels/rolling/no_nulls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ where
})
.collect_trusted::<Vec<_>>();

let validity = create_validity(min_periods, len as usize, window_size, det_offsets_fn);
let validity = create_validity(min_periods, len, window_size, det_offsets_fn);
Box::new(PrimitiveArray::from_data(
T::PRIMITIVE.into(),
out.into(),
Expand Down Expand Up @@ -103,7 +103,7 @@ where
})
.collect_trusted::<Vec<T>>();

let validity = create_validity(min_periods, len as usize, window_size, det_offsets_fn);
let validity = create_validity(min_periods, len, window_size, det_offsets_fn);
Box::new(PrimitiveArray::from_data(
DataType::from(T::PRIMITIVE),
out.into(),
Expand Down
4 changes: 2 additions & 2 deletions polars/polars-arrow/src/kernels/rolling/no_nulls/quantile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ where
})
.collect_trusted::<Vec<T>>();

let validity = create_validity(min_periods, len as usize, window_size, det_offsets_fn);
let validity = create_validity(min_periods, len, window_size, det_offsets_fn);
Box::new(PrimitiveArray::from_data(
T::PRIMITIVE.into(),
out.into(),
Expand Down Expand Up @@ -284,7 +284,7 @@ where
})
.collect_trusted::<Vec<T>>();

let validity = create_validity(min_periods, len as usize, window_size, det_offsets_fn);
let validity = create_validity(min_periods, len, window_size, det_offsets_fn);
Box::new(PrimitiveArray::from_data(
T::PRIMITIVE.into(),
out.into(),
Expand Down
3 changes: 1 addition & 2 deletions polars/polars-arrow/src/kernels/rolling/nulls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ where
// Safety; we are in bounds
let mut agg_window = unsafe { Agg::new(values, validity, start, end) };

let mut validity = match create_validity(min_periods, len as usize, window_size, det_offsets_fn)
{
let mut validity = match create_validity(min_periods, len, window_size, det_offsets_fn) {
Some(v) => v,
None => {
let mut validity = MutableBitmap::with_capacity(len);
Expand Down
3 changes: 1 addition & 2 deletions polars/polars-arrow/src/kernels/rolling/nulls/quantile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ where
// we are in bounds
let mut sorted_window = unsafe { SortedBufNulls::new(values, bitmap, start, end) };

let mut validity = match create_validity(min_periods, len as usize, window_size, det_offsets_fn)
{
let mut validity = match create_validity(min_periods, len, window_size, det_offsets_fn) {
Some(v) => v,
None => {
let mut validity = MutableBitmap::with_capacity(len);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ unsafe fn create_drop<T: Sized>(mut ptr: *const u8, n_t_vals: usize) -> Box<dyn
let t_size = std::mem::size_of::<T>() as isize;
for _ in 0..n_t_vals {
let _ = std::ptr::read_unaligned(ptr as *const T);
ptr = ptr.offset(t_size as isize)
ptr = ptr.offset(t_size)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-core/src/chunked_array/ops/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ fn quantile_idx(
}
};

base_idx = std::cmp::min(std::cmp::max(base_idx, 0), (length - 1) as i64);
base_idx = base_idx.clamp(0, (length - 1) as i64);
let float_idx = ((length - null_count) as f64 - 1.0) * quantile + null_count as f64;
let top_idx = f64::ceil(float_idx) as i64;

Expand Down
2 changes: 1 addition & 1 deletion polars/polars-core/src/chunked_array/ops/shift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl ChunkShiftFill<ListType, Option<&Series>> for ListChunked {
// This has its own implementation because a ListChunked cannot have a full-null without
// knowing the inner type
let periods = clamp(periods, -(self.len() as i64), self.len() as i64);
let slice_offset = (-periods).max(0) as i64;
let slice_offset = (-periods).max(0);
let length = self.len() - abs(periods) as usize;
let mut slice = self.slice(slice_offset, length);

Expand Down
2 changes: 1 addition & 1 deletion polars/polars-core/src/chunked_array/ops/unique/rank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ pub(crate) fn rank(s: &Series, method: RankMethod, reverse: bool) -> Series {
let rng = &mut SmallRng::from_rng(&mut thread_rng).unwrap();

// Shuffle sort_idx positions which point to ties in the original series.
for i in 0..(ties_indices.len() - 1) as usize {
for i in 0..(ties_indices.len() - 1) {
let ties_index_start = ties_indices[i];
let ties_index_end = ties_indices[i + 1];
if ties_index_end - ties_index_start > 1 {
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-core/src/datatypes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ impl<'a> From<AnyValue<'a>> for Option<i64> {
match val {
Null => None,
Int32(v) => Some(v as i64),
Int64(v) => Some(v as i64),
Int64(v) => Some(v),
UInt32(v) => Some(v as i64),
_ => todo!(),
}
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-core/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ impl Display for DataFrame {

let field_to_str = |f: &Field| {
let name = make_str_val(f.name(), str_truncate);
let lower_bounds = std::cmp::max(5, std::cmp::min(12, name.len()));
let lower_bounds = name.len().clamp(5, 12);
let mut column_name = name;
if env_is_true(FMT_TABLE_HIDE_COLUMN_NAMES) {
column_name = "".to_string();
Expand Down
3 changes: 0 additions & 3 deletions polars/polars-core/src/frame/groupby/hashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ where
let out = POOL
.install(|| {
(0..n_partitions).into_par_iter().map(|thread_no| {
let thread_no = thread_no as u64;

let mut hash_tbl: PlHashMap<T, (IdxSize, Vec<IdxSize>)> =
PlHashMap::with_capacity(HASHMAP_INIT_SIZE);

Expand Down Expand Up @@ -301,7 +299,6 @@ pub(crate) fn groupby_threaded_multiple_keys_flat(
.install(|| {
(0..n_partitions).into_par_iter().map(|thread_no| {
let hashes = &hashes;
let thread_no = thread_no as u64;

let mut hash_tbl: HashMap<IdxHash, (IdxSize, Vec<IdxSize>), IdBuildHasher> =
HashMap::with_capacity_and_hasher(HASHMAP_INIT_SIZE, Default::default());
Expand Down
11 changes: 3 additions & 8 deletions polars/polars-core/src/series/ops/ewm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ impl Series {
}
DataType::Float64 => {
let xs = self.f64().unwrap();
let result = ewm_mean(
xs,
options.alpha as f64,
options.adjust,
options.min_periods,
);
let result = ewm_mean(xs, options.alpha, options.adjust, options.min_periods);
Series::try_from((self.name(), Box::new(result) as ArrayRef))
}
_ => self.cast(&DataType::Float64)?.ewm_mean(options),
Expand Down Expand Up @@ -59,7 +54,7 @@ impl Series {
let xs = self.f64().unwrap();
let result = ewm_std(
xs,
options.alpha as f64,
options.alpha,
options.adjust,
options.bias,
options.min_periods,
Expand Down Expand Up @@ -92,7 +87,7 @@ impl Series {
let xs = self.f64().unwrap();
let result = ewm_var(
xs,
options.alpha as f64,
options.alpha,
options.adjust,
options.bias,
options.min_periods,
Expand Down
16 changes: 4 additions & 12 deletions polars/polars-io/src/parquet/read_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn rg_to_dfs(
assert!(std::env::var("POLARS_PANIC_IF_PARQUET_PARSED").is_err())
}

let chunk_size = md.num_rows() as usize;
let chunk_size = md.num_rows();
let columns = if let ParallelStrategy::Columns = parallel {
POOL.install(|| {
projection
Expand All @@ -129,8 +129,7 @@ fn rg_to_dfs(
.collect::<PolarsResult<Vec<_>>>()?
};

*remaining_rows =
remaining_rows.saturating_sub(file_metadata.row_groups[rg].num_rows() as usize);
*remaining_rows = remaining_rows.saturating_sub(file_metadata.row_groups[rg].num_rows());

let mut df = DataFrame::new_no_checks(columns);
if let Some(rc) = &row_count {
Expand Down Expand Up @@ -195,18 +194,11 @@ fn rg_to_dfs_par(
assert!(std::env::var("POLARS_PANIC_IF_PARQUET_PARSED").is_err())
}

let chunk_size = md.num_rows() as usize;
let chunk_size = md.num_rows();
let columns = projection
.iter()
.map(|column_i| {
column_idx_to_series(
*column_i,
md,
local_limit as usize,
schema,
bytes,
chunk_size,
)
column_idx_to_series(*column_i, md, local_limit, schema, bytes, chunk_size)
})
.collect::<PolarsResult<Vec<_>>>()?;

Expand Down
4 changes: 1 addition & 3 deletions polars/polars-lazy/polars-plan/src/dsl/function_expr/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ pub(super) fn slice(args: &mut [Series]) -> PolarsResult<Series> {
.amortized_iter()
.zip(offset_ca)
.map(|(opt_s, opt_offset)| match (opt_s, opt_offset) {
(Some(s), Some(offset)) => {
Some(s.as_ref().slice(offset, length_slice as usize))
}
(Some(s), Some(offset)) => Some(s.as_ref().slice(offset, length_slice)),
_ => None,
})
.collect_trusted()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ pub(crate) fn elim_cmn_subplans(
cache_mapping.insert(node2, cache_id);
cache_id
}
} as usize;
};

// reassign old nodes to another location as we are going to replace
// them with a cache node
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-lazy/src/physical_plan/expressions/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn all_unit_length(ca: &ListChunked) -> bool {
assert_eq!(ca.chunks().len(), 1);
let list_arr = ca.downcast_iter().next().unwrap();
let offset = list_arr.offsets().as_slice();
(offset[offset.len() - 1] as usize) == list_arr.len() as usize
(offset[offset.len() - 1] as usize) == list_arr.len()
}

fn check_map_output_len(input_len: usize, output_len: usize, expr: &Expr) -> PolarsResult<()> {
Expand Down
Loading

0 comments on commit 55643f6

Please sign in to comment.