Skip to content

Commit

Permalink
Split out arrow-ord (apache#2594)
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Dec 8, 2022
1 parent 96c7c9d commit d71f8eb
Show file tree
Hide file tree
Showing 20 changed files with 645 additions and 450 deletions.
34 changes: 21 additions & 13 deletions .github/workflows/arrow.yml
Expand Up @@ -25,18 +25,20 @@ on:
- master
pull_request:
paths:
- arrow/**
- .github/**
- arrow-array/**
- arrow-buffer/**
- arrow-cast/**
- arrow-csv/**
- arrow-data/**
- arrow-schema/**
- arrow-select/**
- arrow-integration-test/**
- arrow-ipc/**
- arrow-csv/**
- arrow-json/**
- .github/**
- arrow-ord/**
- arrow-schema/**
- arrow-select/**
- arrow-string/**
- arrow/**

jobs:

Expand All @@ -58,8 +60,8 @@ jobs:
run: cargo test -p arrow-data --all-features
- name: Test arrow-schema with all features
run: cargo test -p arrow-schema --all-features
- name: Test arrow-array with all features
run: cargo test -p arrow-array --all-features
- name: Test arrow-array with all features except SIMD
run: cargo test -p arrow-array
- name: Test arrow-select with all features
run: cargo test -p arrow-select --all-features
- name: Test arrow-cast with all features
Expand All @@ -72,6 +74,8 @@ jobs:
run: cargo test -p arrow-json --all-features
- name: Test arrow-string with all features
run: cargo test -p arrow-string --all-features
- name: Test arrow-ord with all features except SIMD
run: cargo test -p arrow-ord --features dyn_cmp_dict
- name: Test arrow-integration-test with all features
run: cargo test -p arrow-integration-test --all-features
- name: Test arrow with default features
Expand Down Expand Up @@ -129,10 +133,12 @@ jobs:
uses: ./.github/actions/setup-builder
with:
rust-version: nightly
- name: Run tests --features "simd"
run: cargo test -p arrow --features "simd"
- name: Check compilation --features "simd"
run: cargo check -p arrow --features simd
- name: Test arrow-array with SIMD
run: cargo test -p arrow-array --features simd
- name: Test arrow-ord with SIMD
run: cargo test -p arrow-ord --features simd
- name: Test arrow with SIMD
run: cargo test -p arrow --features simd
- name: Check compilation --features simd --all-targets
run: cargo check -p arrow --features simd --all-targets

Expand Down Expand Up @@ -174,8 +180,8 @@ jobs:
run: cargo clippy -p arrow-data --all-targets --all-features -- -D warnings
- name: Clippy arrow-schema with all features
run: cargo clippy -p arrow-schema --all-targets --all-features -- -D warnings
- name: Clippy arrow-array with all features
run: cargo clippy -p arrow-array --all-targets --all-features -- -D warnings
- name: Clippy arrow-array without SIMD
run: cargo clippy -p arrow-array --all-targets -- -D warnings
- name: Clippy arrow-select with all features
run: cargo clippy -p arrow-select --all-targets --all-features -- -D warnings
- name: Clippy arrow-cast with all features
Expand All @@ -188,5 +194,7 @@ jobs:
run: cargo clippy -p arrow-json --all-targets --all-features -- -D warnings
- name: Clippy arrow-string with all features
run: cargo clippy -p arrow-string --all-targets --all-features -- -D warnings
- name: Clippy arrow-ord without SIMD
run: cargo clippy -p arrow-ord --all-targets -- -D warnings
- name: Clippy arrow
run: cargo clippy -p arrow --features=prettyprint,csv,ipc,test_utils,ffi,ipc_compression,dyn_cmp_dict,dyn_arith_dict,chrono-tz --all-targets -- -D warnings
1 change: 1 addition & 0 deletions .github/workflows/arrow_flight.yml
Expand Up @@ -33,6 +33,7 @@ on:
- arrow-data/**
- arrow-flight/**
- arrow-ipc/**
- arrow-ord/**
- arrow-schema/**
- arrow-select/**
- arrow-string/**
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/integration.yml
Expand Up @@ -33,6 +33,7 @@ on:
- arrow-integration-test/**
- arrow-integration-testing/**
- arrow-ipc/**
- arrow-ord/**
- arrow-json/**
- arrow-pyarrow-integration-testing/**
- arrow-schema/**
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/parquet.yml
Expand Up @@ -36,7 +36,6 @@ on:
- arrow-ipc/**
- arrow-csv/**
- arrow-json/**
- arrow-string/**
- parquet/**
- .github/**

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -28,6 +28,7 @@ members = [
"arrow-integration-testing",
"arrow-ipc",
"arrow-json",
"arrow-ord",
"arrow-schema",
"arrow-select",
"arrow-string",
Expand Down
4 changes: 4 additions & 0 deletions arrow-array/Cargo.toml
Expand Up @@ -53,6 +53,10 @@ chrono-tz = { version = "0.8", optional = true }
num = { version = "0.4", default-features = false, features = ["std"] }
half = { version = "2.1", default-features = false, features = ["num-traits"] }
hashbrown = { version = "0.13", default-features = false }
packed_simd = { version = "0.3", default-features = false, optional = true, package = "packed_simd_2" }

[features]
simd = ["packed_simd"]

[dev-dependencies]
rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] }
Expand Down
3 changes: 3 additions & 0 deletions arrow-array/src/lib.rs
Expand Up @@ -170,6 +170,9 @@ pub use record_batch::{RecordBatch, RecordBatchOptions, RecordBatchReader};
mod arithmetic;
pub use arithmetic::ArrowNativeTypeOp;

mod numeric;
pub use numeric::*;

pub mod builder;
pub mod cast;
mod delta;
Expand Down
10 changes: 8 additions & 2 deletions arrow/src/datatypes/numeric.rs → arrow-array/src/numeric.rs
Expand Up @@ -15,7 +15,8 @@
// specific language governing permissions and limitations
// under the License.

use super::*;
use crate::types::*;
use crate::ArrowPrimitiveType;
#[cfg(feature = "simd")]
use packed_simd::*;
#[cfg(feature = "simd")]
Expand Down Expand Up @@ -106,9 +107,11 @@ where
/// Writes a SIMD result back to a slice
fn write(simd_result: Self::Simd, slice: &mut [Self::Native]);

/// Performs a SIMD unary operation
fn unary_op<F: Fn(Self::Simd) -> Self::Simd>(a: Self::Simd, op: F) -> Self::Simd;
}

/// A subtype of primitive type that represents numeric values.
#[cfg(not(feature = "simd"))]
pub trait ArrowNumericType: ArrowPrimitiveType {}

Expand Down Expand Up @@ -468,7 +471,7 @@ impl ArrowNumericType for Decimal256Type {}

#[cfg(feature = "simd")]
impl ArrowNumericType for Decimal256Type {
type Simd = i256;
type Simd = arrow_buffer::i256;
type SimdMask = bool;

fn lanes() -> usize {
Expand Down Expand Up @@ -555,11 +558,14 @@ impl ArrowNumericType for Decimal256Type {
}
}

/// A subtype of primitive type that represents numeric float values
#[cfg(feature = "simd")]
pub trait ArrowFloatNumericType: ArrowNumericType {
/// SIMD version of pow
fn pow(base: Self::Simd, raise: Self::Simd) -> Self::Simd;
}

/// A subtype of primitive type that represents numeric float values
#[cfg(not(feature = "simd"))]
pub trait ArrowFloatNumericType: ArrowNumericType {}

Expand Down
53 changes: 53 additions & 0 deletions arrow-ord/Cargo.toml
@@ -0,0 +1,53 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[package]
name = "arrow-ord"
version = "28.0.0"
description = "Ordering kernels for arrow arrays"
homepage = "https://github.com/apache/arrow-rs"
repository = "https://github.com/apache/arrow-rs"
authors = ["Apache Arrow <dev@arrow.apache.org>"]
license = "Apache-2.0"
keywords = ["arrow"]
include = [
"benches/*.rs",
"src/**/*.rs",
"Cargo.toml",
]
edition = "2021"
rust-version = "1.62"

[lib]
name = "arrow_ord"
path = "src/lib.rs"
bench = false

[dependencies]
arrow-array = { version = "28.0.0", path = "../arrow-array" }
arrow-buffer = { version = "28.0.0", path = "../arrow-buffer" }
arrow-data = { version = "28.0.0", path = "../arrow-data" }
arrow-schema = { version = "28.0.0", path = "../arrow-schema" }
arrow-select = { version = "28.0.0", path = "../arrow-select" }
num = { version = "0.4", default-features = false, features = ["std"] }

[dev-dependencies]
rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] }

[features]
dyn_cmp_dict = []
simd = ["arrow-array/simd"]

0 comments on commit d71f8eb

Please sign in to comment.