Skip to content

Commit 7c4222e

Browse files
committed
Split out arrow-ord (apache#2594)
1 parent 96c7c9d commit 7c4222e

File tree

20 files changed

+645
-449
lines changed

20 files changed

+645
-449
lines changed

.github/workflows/arrow.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,20 @@ on:
2525
- master
2626
pull_request:
2727
paths:
28-
- arrow/**
28+
- .github/**
2929
- arrow-array/**
3030
- arrow-buffer/**
3131
- arrow-cast/**
32+
- arrow-csv/**
3233
- arrow-data/**
33-
- arrow-schema/**
34-
- arrow-select/**
3534
- arrow-integration-test/**
3635
- arrow-ipc/**
37-
- arrow-csv/**
3836
- arrow-json/**
39-
- .github/**
37+
- arrow-ord/**
38+
- arrow-schema/**
39+
- arrow-select/**
40+
- arrow-string/**
41+
- arrow/**
4042

4143
jobs:
4244

@@ -58,8 +60,8 @@ jobs:
5860
run: cargo test -p arrow-data --all-features
5961
- name: Test arrow-schema with all features
6062
run: cargo test -p arrow-schema --all-features
61-
- name: Test arrow-array with all features
62-
run: cargo test -p arrow-array --all-features
63+
- name: Test arrow-array without SIMD
64+
run: cargo test -p arrow-array
6365
- name: Test arrow-select with all features
6466
run: cargo test -p arrow-select --all-features
6567
- name: Test arrow-cast with all features
@@ -72,6 +74,8 @@ jobs:
7274
run: cargo test -p arrow-json --all-features
7375
- name: Test arrow-string with all features
7476
run: cargo test -p arrow-string --all-features
77+
- name: Test arrow-ord without SIMD
78+
run: cargo test -p arrow-ord
7579
- name: Test arrow-integration-test with all features
7680
run: cargo test -p arrow-integration-test --all-features
7781
- name: Test arrow with default features
@@ -129,10 +133,12 @@ jobs:
129133
uses: ./.github/actions/setup-builder
130134
with:
131135
rust-version: nightly
132-
- name: Run tests --features "simd"
133-
run: cargo test -p arrow --features "simd"
134-
- name: Check compilation --features "simd"
135-
run: cargo check -p arrow --features simd
136+
- name: Test arrow-array with SIMD
137+
run: cargo test -p arrow-array --features simd
138+
- name: Test arrow-ord with SIMD
139+
run: cargo test -p arrow-ord --features simd
140+
- name: Test arrow with SIMD
141+
run: cargo test -p arrow --features simd
136142
- name: Check compilation --features simd --all-targets
137143
run: cargo check -p arrow --features simd --all-targets
138144

@@ -174,8 +180,8 @@ jobs:
174180
run: cargo clippy -p arrow-data --all-targets --all-features -- -D warnings
175181
- name: Clippy arrow-schema with all features
176182
run: cargo clippy -p arrow-schema --all-targets --all-features -- -D warnings
177-
- name: Clippy arrow-array with all features
178-
run: cargo clippy -p arrow-array --all-targets --all-features -- -D warnings
183+
- name: Clippy arrow-array without SIMD
184+
run: cargo clippy -p arrow-array --all-targets -- -D warnings
179185
- name: Clippy arrow-select with all features
180186
run: cargo clippy -p arrow-select --all-targets --all-features -- -D warnings
181187
- name: Clippy arrow-cast with all features
@@ -188,5 +194,7 @@ jobs:
188194
run: cargo clippy -p arrow-json --all-targets --all-features -- -D warnings
189195
- name: Clippy arrow-string with all features
190196
run: cargo clippy -p arrow-string --all-targets --all-features -- -D warnings
197+
- name: Clippy arrow-ord without SIMD
198+
run: cargo clippy -p arrow-ord --all-targets -- -D warnings
191199
- name: Clippy arrow
192200
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

.github/workflows/arrow_flight.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ on:
3333
- arrow-data/**
3434
- arrow-flight/**
3535
- arrow-ipc/**
36+
- arrow-ord/**
3637
- arrow-schema/**
3738
- arrow-select/**
3839
- arrow-string/**

.github/workflows/integration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ on:
3333
- arrow-integration-test/**
3434
- arrow-integration-testing/**
3535
- arrow-ipc/**
36+
- arrow-ord/**
3637
- arrow-json/**
3738
- arrow-pyarrow-integration-testing/**
3839
- arrow-schema/**

.github/workflows/parquet.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ on:
3636
- arrow-ipc/**
3737
- arrow-csv/**
3838
- arrow-json/**
39-
- arrow-string/**
4039
- parquet/**
4140
- .github/**
4241

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ members = [
2828
"arrow-integration-testing",
2929
"arrow-ipc",
3030
"arrow-json",
31+
"arrow-ord",
3132
"arrow-schema",
3233
"arrow-select",
3334
"arrow-string",

arrow-array/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ chrono-tz = { version = "0.8", optional = true }
5353
num = { version = "0.4", default-features = false, features = ["std"] }
5454
half = { version = "2.1", default-features = false, features = ["num-traits"] }
5555
hashbrown = { version = "0.13", default-features = false }
56+
packed_simd = { version = "0.3", default-features = false, optional = true, package = "packed_simd_2" }
57+
58+
[features]
59+
simd = ["packed_simd"]
5660

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

arrow-array/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ pub use record_batch::{RecordBatch, RecordBatchOptions, RecordBatchReader};
170170
mod arithmetic;
171171
pub use arithmetic::ArrowNativeTypeOp;
172172

173+
mod numeric;
174+
pub use numeric::*;
175+
173176
pub mod builder;
174177
pub mod cast;
175178
mod delta;

arrow/src/datatypes/numeric.rs renamed to arrow-array/src/numeric.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

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

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

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

@@ -468,7 +471,7 @@ impl ArrowNumericType for Decimal256Type {}
468471

469472
#[cfg(feature = "simd")]
470473
impl ArrowNumericType for Decimal256Type {
471-
type Simd = i256;
474+
type Simd = arrow_buffer::i256;
472475
type SimdMask = bool;
473476

474477
fn lanes() -> usize {
@@ -555,11 +558,14 @@ impl ArrowNumericType for Decimal256Type {
555558
}
556559
}
557560

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

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

arrow-ord/Cargo.toml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
[package]
19+
name = "arrow-ord"
20+
version = "28.0.0"
21+
description = "Ordering kernels for arrow arrays"
22+
homepage = "https://github.com/apache/arrow-rs"
23+
repository = "https://github.com/apache/arrow-rs"
24+
authors = ["Apache Arrow <[email protected]>"]
25+
license = "Apache-2.0"
26+
keywords = ["arrow"]
27+
include = [
28+
"benches/*.rs",
29+
"src/**/*.rs",
30+
"Cargo.toml",
31+
]
32+
edition = "2021"
33+
rust-version = "1.62"
34+
35+
[lib]
36+
name = "arrow_ord"
37+
path = "src/lib.rs"
38+
bench = false
39+
40+
[dependencies]
41+
arrow-array = { version = "28.0.0", path = "../arrow-array" }
42+
arrow-buffer = { version = "28.0.0", path = "../arrow-buffer" }
43+
arrow-data = { version = "28.0.0", path = "../arrow-data" }
44+
arrow-schema = { version = "28.0.0", path = "../arrow-schema" }
45+
arrow-select = { version = "28.0.0", path = "../arrow-select" }
46+
num = { version = "0.4", default-features = false, features = ["std"] }
47+
48+
[dev-dependencies]
49+
rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] }
50+
51+
[features]
52+
dyn_cmp_dict = []
53+
simd = ["arrow-array/simd"]

0 commit comments

Comments
 (0)