8000 ci: test against more compilers, setup clippy and fix clippy lints by cpcloud · Pull Request #9 · datafusion-contrib/datafusion-python · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jul 25, 2022. It is now read-only.

ci: test against more compilers, setup clippy and fix clippy lints #9

Merged
merged 3 commits into from
Jan 13, 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
55 changes: 34 additions & 21 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,66 @@ on:
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
test:
test-matrix:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.7"
- "3.10"
toolchain:
- stable
- beta
- nightly
Comment on lines +40 to +41
Copy link
Contributor

Choose a reason for hiding this comment

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

wonder if we need to run against nightly and beta

Copy link
Contributor

Choose a reason for hiding this comment

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

usually if you run against all of them there will be conflicting fmt changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The format check is only against stable

steps:
- uses: actions/checkout@v2

- name: Cache Cargo
uses: actions/cache@v2
with:
path: /home/runner/.cargo
key: cargo-maturin-cache-${{ hashFiles('Cargo.lock') }}

- name: Setup Rust Toolchain
uses: actions-rs/toolchain@v1
id: rust-toolchain
with:
toolchain: stable
profile: default
toolchain: ${{ matrix.toolchain }}
override: true

- name: Cargo Clippy
run: cargo clippy

- name: Cargo Check
run: cargo check --all --frozen --locked

- name: Setup Python Toolchain
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Cache Cargo
uses: actions/cache@v2
with:
path: ~/.cargo
key: cargo-cache-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('Cargo.lock') }}

- name: Check Formatting
uses: actions-rs/cargo@v1
if: ${{ matrix.python-version == '3.10' && matrix.toolchain == 'stable' }}
with:
command: fmt
args: -- --check

- name: Run Clippy
uses: actions-rs/cargo@v1
if: ${{ matrix.python-version == '3.10' && matrix.toolchain == 'stable' }}
with:
command: clippy
args: --all-targets --all-features -- -D clippy::all

- name: Create Virtualenv
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

- name: Run Linters
if: ${{ matrix.python-version == '3.10' }}
- name: Run Python Linters
if: ${{ matrix.python-version == '3.10' && matrix.toolchain == 'stable' }}
run: |
source venv/bin/activate
flake8 --exclude venv --ignore=E501
Expand All @@ -76,6 +92,3 @@ jobs:
source venv/bin/activate
maturin develop --cargo-extra-args='--locked'
RUST_BACKTRACE=1 pytest -v .
env:
CARGO_HOME: "/home/runner/.cargo"
CARGO_TARGET_DIR: "/home/runner/target"
3 changes: 2 additions & 1 deletion src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ impl PyExecutionContext {
Ok(())
}

#[allow(clippy::too_many_arguments)]
#[args(
schema = "None",
has_header = "true",
Expand All @@ -119,7 +120,7 @@ impl PyExecutionContext {
) -> PyResult<()> {
let path = path
.to_str()
.ok_or(PyValueError::new_err("Unable to convert path to a string"))?;
.ok_or_else(|| PyValueError::new_err("Unable to convert path to a string"))?;
let delimiter = delimiter.as_bytes();
if delimiter.len() != 1 {
return Err(PyValueError::new_err(
Expand Down
6 changes: 3 additions & 3 deletions src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ impl From<PyExpr> for Expr {
}
}

impl Into<PyExpr> for Expr {
fn into(self) -> PyExpr {
PyExpr { expr: self }
impl From<Expr> for PyExpr {
fn from(expr: Expr) -> PyExpr {
PyExpr { expr }
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ fn window(
expr: datafusion::logical_plan::Expr::WindowFunction {
fun,
args: args.into_iter().map(|x| x.expr).collect::<Vec<_>>(),
partition_by: partition_by.unwrap_or_default()
partition_by: partition_by
.unwrap_or_default()
.into_iter()
.map(|x| x.expr)
.collect::<Vec<_>>(),
order_by: order_by.unwrap_or_default()
order_by: order_by
.unwrap_or_default()
.into_iter()
.map(|x| x.expr)
.collect::<Vec<_>>(),
Expand Down
0