Skip to content

Commit

Permalink
Update rustc to 2022-06-22 (#3801)
Browse files Browse the repository at this point in the history
* remove static serde

* clippy

* update rustc
  • Loading branch information
ritchie46 committed Jun 24, 2022
1 parent b445392 commit c57df45
Show file tree
Hide file tree
Showing 41 changed files with 195 additions and 86 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-05-20
rustup override set nightly-2022-06-22
export RUSTFLAGS='-C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma'

# first the default release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-04-01
toolchain: nightly-2022-06-22
override: true
components: rustfmt, clippy
- name: Set up Python
Expand All @@ -32,7 +32,7 @@ jobs:
source venv/bin/activate
pip install -r py-polars/build.requirements.txt
cd py-polars
rustup override set nightly-2022-05-20 && RUSTFLAGS="-C embed-bitcode" maturin develop --rustc-extra-args="-C codegen-units=8 -C lto=thin -C target-cpu=native" --release
rustup override set nightly-2022-06-22 && RUSTFLAGS="-C embed-bitcode" maturin develop --rustc-extra-args="-C codegen-units=8 -C lto=thin -C target-cpu=native" --release
cd tests/db-benchmark
Rscript -e 'install.packages("data.table", repos="https://Rdatatable.github.io/data.table")'
Rscript groupby-datagen.R 1e7 1e2 5 0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-04-01
toolchain: nightly-2022-06-22
override: true
- uses: Swatinem/rust-cache@v1
- name: Install dependencies
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-04-01
toolchain: nightly-2022-06-22
override: true
components: rustfmt, clippy, miri
- name: Cache Cargo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
cache-dependency-path: "py-polars/build.requirements.txt"
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-05-20
toolchain: nightly-2022-06-22
override: true
profile: minimal
components: llvm-tools-preview
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create-py-mac-universal2-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-05-20
toolchain: nightly-2022-06-22
override: true
components: rustfmt, clippy
- name: Setup universal2 targets for Rust
Expand All @@ -35,7 +35,7 @@ jobs:
rm py-polars/README.md
cp README.md py-polars/README.md
cd py-polars
rustup override set nightly-2022-05-20
rustup override set nightly-2022-06-22
- name: maturin publish
uses: messense/maturin-action@v1
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-py-release-manylinux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
env:
MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
with:
rust-toolchain: nightly-2022-05-20
rust-toolchain: nightly-2022-06-22
# don't use `2_17` it does not work: https://github.com/pola-rs/polars/runs/6107328960
manylinux: '2_24'
target: aarch64-unknown-linux-gnu
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create-py-release-windows-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-05-20
toolchain: nightly-2022-06-22
override: true
components: rustfmt, clippy
- name: Set up Python
Expand All @@ -37,7 +37,7 @@ jobs:
rm py-polars/README.md
cp README.md py-polars/README.md
cd py-polars
rustup override set nightly-2022-05-20
rustup override set nightly-2022-06-22
export RUSTFLAGS='-C target-feature=+fxsr,+sse,+sse2,+sse3'
maturin publish \
--no-sdist \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-05-20
toolchain: nightly-2022-06-22
override: true
components: rustfmt, clippy
- name: Set up Node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-05-20
toolchain: nightly-2022-06-22
override: true
components: rustfmt, clippy
- run: yarn --version
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-05-20
toolchain: nightly-2022-06-22
override: true
components: rustfmt, clippy
- name: Set up Python
Expand All @@ -30,7 +30,7 @@ jobs:
pip install -r py-polars/build.requirements.txt
- name: Run formatting checks
run: |
cd py-polars && black --check . && blackdoc --check . && isort --check . && rustup override set nightly-2022-05-20 && cargo fmt --all -- --check && cd ..
cd py-polars && black --check . && blackdoc --check . && isort --check . && rustup override set nightly-2022-06-22 && cargo fmt --all -- --check && cd ..
- name: Run linting
run: |
cd py-polars && flake8 && cd ..
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Run tests
run: |
export RUSTFLAGS="-C debuginfo=0"
cd py-polars && rustup override set nightly-2022-05-20 && make venv && make test-with-cov
cd py-polars && rustup override set nightly-2022-06-22 && make venv && make test-with-cov
cargo clippy
- name: Check doc examples
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-windows-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-05-20
toolchain: nightly-2022-06-22
override: true
components: rustfmt
- name: Set up Python
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-05-20
toolchain: nightly-2022-06-22
override: true
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v1
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fmt_toml:

coverage:
@bash -c "\
rustup override set nightly-2022-05-20; \
rustup override set nightly-2022-06-22; \
source <(cargo llvm-cov show-env --export-prefix); \
export CARGO_TARGET_DIR=\$$CARGO_LLVM_COV_TARGET_DIR; \
export CARGO_INCREMENTAL=1; \
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-arrow/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ impl IndexToUsize for i64 {
if self >= 0 && (self as usize) < index {
Some(self as usize)
} else {
let subtract = self.abs() as usize;
let subtract = self.unsigned_abs() as usize;
if subtract > index {
None
} else {
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-arrow/src/kernels/rolling/no_nulls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ where
))
}

#[derive(Clone, Copy, PartialEq, Debug)]
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum QuantileInterpolOptions {
Nearest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub struct StrHashGlobal {
pub(crate) hash: u64,
}

impl<'a> Hash for StrHashGlobal {
impl Hash for StrHashGlobal {
fn hash<H: Hasher>(&self, state: &mut H) {
state.write_u64(self.hash)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ unsafe fn create_drop<T: Sized>(mut ptr: *const u8, n_t_vals: usize) -> Box<dyn
})
}

#[allow(clippy::type_complexity)]
struct ExtensionSentinel {
drop_fn: Option<Box<dyn FnMut()>>,
// A function on the heap that take a `array: FixedSizeBinary` and a `name: &str`
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-core/src/chunked_array/ops/downcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl ListChunked {

#[cfg(feature = "object")]
#[doc(hidden)]
impl<'a, T> ObjectChunked<T>
impl<T> ObjectChunked<T>
where
T: PolarsObject,
{
Expand Down
4 changes: 2 additions & 2 deletions polars/polars-core/src/chunked_array/ops/rolling_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mod inner_mod {
let series_container =
ChunkedArray::<T>::from_slice("", &[T::Native::zero()]).into_series();
let array_ptr = series_container.array_ref(0);
let ptr = &*array_ptr.as_ref() as *const dyn Array as *mut dyn Array
let ptr = array_ptr.as_ref() as *const dyn Array as *mut dyn Array
as *mut PrimitiveArray<T::Native>;
let mut builder = PrimitiveChunkedBuilder::<T>::new(self.name(), self.len());

Expand Down Expand Up @@ -187,7 +187,7 @@ mod inner_mod {

let arr_container = ChunkedArray::<T>::from_slice("", &[T::Native::zero()]);
let array_ptr = &arr_container.chunks()[0];
let ptr = &*array_ptr.as_ref() as *const dyn Array as *mut dyn Array
let ptr = array_ptr.as_ref() as *const dyn Array as *mut dyn Array
as *mut PrimitiveArray<T::Native>;

let mut validity = MutableBitmap::with_capacity(ca.len());
Expand Down
118 changes: 118 additions & 0 deletions polars/polars-core/src/datatypes/_serde.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
//! Having `Object<&;static> in [`DataType`] make serde tag the `Deserialize` trait bound 'static
//! even though we skip serializing `Object`.
//!
//! We could use https://github.com/serde-rs/serde/issues/1712, but that gave problems caused by
//! https://github.com/rust-lang/rust/issues/96956, so we make a dummy type without static
use super::*;
pub use arrow::datatypes::DataType as ArrowDataType;
use serde::{Deserialize, Deserializer, Serialize, Serializer};

impl<'a> Deserialize<'a> for DataType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: Deserializer<'a>,
{
Ok(SerializableDataType::deserialize(deserializer)?.into())
}
}

impl Serialize for DataType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: Serializer,
{
let dt: SerializableDataType = self.into();
dt.serialize(serializer)
}
}

#[derive(Serialize, Deserialize)]
pub enum SerializableDataType {
Boolean,
UInt8,
UInt16,
UInt32,
UInt64,
Int8,
Int16,
Int32,
Int64,
Float32,
Float64,
/// String data
Utf8,
/// A 32-bit date representing the elapsed time since UNIX epoch (1970-01-01)
/// in days (32 bits).
Date,
/// A 64-bit date representing the elapsed time since UNIX epoch (1970-01-01)
/// in milliseconds (64 bits).
Datetime(TimeUnit, Option<TimeZone>),
// 64-bit integer representing difference between times in milliseconds or nanoseconds
Duration(TimeUnit),
/// A 64-bit time representing the elapsed time since midnight in nanoseconds
Time,
List(Box<SerializableDataType>),
Null,
#[cfg(feature = "dtype-struct")]
Struct(Vec<Field>),
// some logical types we cannot know statically, e.g. Datetime
Unknown,
}

impl From<&DataType> for SerializableDataType {
fn from(dt: &DataType) -> Self {
use DataType::*;
match dt {
Boolean => Self::Boolean,
UInt8 => Self::UInt8,
UInt16 => Self::UInt16,
UInt32 => Self::UInt32,
UInt64 => Self::UInt64,
Int8 => Self::Int8,
Int16 => Self::Int16,
Int32 => Self::Int32,
Int64 => Self::Int64,
Float32 => Self::Float32,
Float64 => Self::Float64,
Utf8 => Self::Utf8,
Date => Self::Date,
Datetime(tu, tz) => Self::Datetime(*tu, tz.clone()),
Duration(tu) => Self::Duration(*tu),
Time => Self::Time,
List(dt) => Self::List(Box::new(dt.as_ref().into())),
Null => Self::Null,
Unknown => Self::Unknown,
#[cfg(feature = "dtype-struct")]
Struct(flds) => Self::Struct(flds.clone()),
_ => todo!(),
}
}
}
impl From<SerializableDataType> for DataType {
fn from(dt: SerializableDataType) -> Self {
use SerializableDataType::*;
match dt {
Boolean => Self::Boolean,
UInt8 => Self::UInt8,
UInt16 => Self::UInt16,
UInt32 => Self::UInt32,
UInt64 => Self::UInt64,
Int8 => Self::Int8,
Int16 => Self::Int16,
Int32 => Self::Int32,
Int64 => Self::Int64,
Float32 => Self::Float32,
Float64 => Self::Float64,
Utf8 => Self::Utf8,
Date => Self::Date,
Datetime(tu, tz) => Self::Datetime(tu, tz),
Duration(tu) => Self::Duration(tu),
Time => Self::Time,
List(dt) => Self::List(Box::new((*dt).into())),
Null => Self::Null,
Unknown => Self::Unknown,
#[cfg(feature = "dtype-struct")]
Struct(flds) => Self::Struct(flds),
}
}
}

0 comments on commit c57df45

Please sign in to comment.