Skip to content

Commit f7304fb

Browse files
committed
feat: Support parsing extra timezone formats
Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
1 parent 8277f9a commit f7304fb

6 files changed

Lines changed: 176 additions & 33 deletions

File tree

.github/workflows/comment_bot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Set up Python
3838
uses: actions/setup-python@v2
3939
with:
40-
python-version: 3.8
40+
python-version: 3.12
4141
- name: Install Archery and Crossbow dependencies
4242
run: pip install -e dev/archery[bot]
4343
- name: Handle Github comment event

.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Setup Python
3737
uses: actions/setup-python@v1
3838
with:
39-
python-version: 3.8
39+
python-version: 3.12
4040
- name: Audit licenses
4141
run: ./dev/release/run-rat.sh .
4242

.github/workflows/integration.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Setup Python
4242
uses: actions/setup-python@v2
4343
with:
44-
python-version: 3.8
44+
python-version: 3.12
4545
- name: Setup Archery
4646
run: pip install -e dev/archery[docker]
4747
- name: Execute Docker Build
@@ -64,12 +64,12 @@ jobs:
6464
rustup default ${{ matrix.rust }}
6565
rustup component add rustfmt clippy
6666
- name: Cache Cargo
67-
uses: actions/cache@v2
67+
uses: actions/cache@v4
6868
with:
6969
path: /home/runner/.cargo
7070
key: cargo-maturin-cache-
7171
- name: Cache Rust dependencies
72-
uses: actions/cache@v2
72+
uses: actions/cache@v4
7373
with:
7474
path: /home/runner/target
7575
# this key is not equal because maturin uses different compilation flags.

.github/workflows/rust.yml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ jobs:
4141
steps:
4242
- uses: actions/checkout@v2
4343
- name: Cache Cargo
44-
uses: actions/cache@v2
44+
uses: actions/cache@v4
4545
with:
4646
# these represent dependencies downloaded by cargo
4747
# and thus do not depend on the OS, arch nor rust version.
4848
path: /github/home/.cargo
4949
key: cargo-cache3-
5050
- name: Cache Rust dependencies
51-
uses: actions/cache@v2
51+
uses: actions/cache@v4
5252
with:
5353
# these represent compiled steps of both dependencies and arrow
5454
# and thus are specific for a particular OS, arch and rust version.
@@ -86,13 +86,13 @@ jobs:
8686
with:
8787
submodules: true
8888
- name: Cache Cargo
89-
uses: actions/cache@v2
89+
uses: actions/cache@v4
9090
with:
9191
path: /github/home/.cargo
9292
# this key equals the ones on `linux-build-lib` for re-use
9393
key: cargo-cache3-
9494
- name: Cache Rust dependencies
95-
uses: actions/cache@v2
95+
uses: actions/cache@v4
9696
with:
9797
path: /github/home/target
9898
# this key equals the ones on `linux-build-lib` for re-use
@@ -154,12 +154,12 @@ jobs:
154154
with:
155155
submodules: true
156156
- name: Cache Cargo
157-
uses: actions/cache@v2
157+
uses: actions/cache@v4
158158
with:
159159
path: /github/home/.cargo
160160
key: cargo-nightly-cache3-
161161
- name: Cache Rust dependencies
162-
uses: actions/cache@v2
162+
uses: actions/cache@v4
163163
with:
164164
path: /github/home/target
165165
key: ${{ runner.os }}-${{ matrix.arch }}-target-nightly-cache3-${{ matrix.rust }}
@@ -205,6 +205,7 @@ jobs:
205205
export PARQUET_TEST_DATA=$(pwd)/parquet-testing/data
206206
# do not produce debug symbols to keep memory usage down
207207
export RUSTFLAGS="-C debuginfo=0"
208+
export CMAKE_POLICY_VERSION_MINIMUM=3.5
208209
cargo test
209210
210211
clippy:
@@ -226,13 +227,13 @@ jobs:
226227
with:
227228
submodules: true
228229
- name: Cache Cargo
229-
uses: actions/cache@v2
230+
uses: actions/cache@v4
230231
with:
231232
path: /github/home/.cargo
232233
# this key equals the ones on `linux-build-lib` for re-use
233234
key: cargo-cache3-
234235
- name: Cache Rust dependencies
235-
uses: actions/cache@v2
236+
uses: actions/cache@v4
236237
with:
237238
path: /github/home/target
238239
# this key equals the ones on `linux-build-lib` for re-use
@@ -268,13 +269,13 @@ jobs:
268269
with:
269270
submodules: true
270271
- name: Cache Cargo
271-
uses: actions/cache@v2
272+
uses: actions/cache@v4
272273
with:
273274
path: /github/home/.cargo
274275
# this key equals the ones on `linux-build-lib` for re-use
275276
key: cargo-cache3-
276277
- name: Cache Rust dependencies
277-
uses: actions/cache@v2
278+
uses: actions/cache@v4
278279
with:
279280
path: /github/home/target
280281
# this key equals the ones on `linux-build-lib` for re-use
@@ -321,13 +322,13 @@ jobs:
321322
rustup default ${{ matrix.rust }}
322323
rustup component add rustfmt clippy
323324
- name: Cache Cargo
324-
uses: actions/cache@v2
325+
uses: actions/cache@v4
325326
with:
326327
path: /home/runner/.cargo
327328
# this key is not equal because the user is different than on a container (runner vs github)
328329
key: cargo-coverage-cache3-
329330
- name: Cache Rust dependencies
330-
uses: actions/cache@v2
331+
uses: actions/cache@v4
331332
with:
332333
path: /home/runner/target
333334
# this key is not equal because coverage uses different compilation flags.
@@ -369,12 +370,12 @@ jobs:
369370
with:
370371
submodules: true
371372
- name: Cache Cargo
372-
uses: actions/cache@v2
373+
uses: actions/cache@v4
373374
with:
374375
path: /github/home/.cargo
375376
key: cargo-wasm32-cache3-
376377
- name: Cache Rust dependencies
377-
uses: actions/cache@v2
378+
uses: actions/cache@v4
378379
with:
379380
path: /github/home/target
380381
key: ${{ runner.os }}-${{ matrix.arch }}-target-wasm32-cache3-${{ matrix.rust }}
@@ -414,14 +415,14 @@ jobs:
414415
- name: Install python dev
415416
run: |
416417
apt update
417-
apt install -y libpython3.11-dev
418+
apt install -y python3.12-dev
418419
- name: Cache Cargo
419-
uses: actions/cache@v2
420+
uses: actions/cache@v4
420421
with:
421422
path: /github/home/.cargo
422423
key: cargo-nightly-cache3-
423424
- name: Cache Rust dependencies
424-
uses: actions/cache@v2
425+
uses: actions/cache@v4
425426
with:
426427
path: /github/home/target
427428
key: ${{ runner.os }}-${{ matrix.arch }}-target-nightly-cache3-${{ matrix.rust }}
@@ -453,13 +454,13 @@ jobs:
453454
steps:
454455
- uses: actions/checkout@v2
455456
- name: Cache Cargo
456-
uses: actions/cache@v2
457+
uses: actions/cache@v4
457458
with:
458459
path: /github/home/.cargo
459460
# this key equals the ones on `linux-build-lib` for re-use
460461
key: cargo-cache3-
461462
- name: Cache Rust dependencies
462-
uses: actions/cache@v2
463+
uses: actions/cache@v4
463464
with:
464465
path: /github/home/target
465466
# this key equals the ones on `linux-build-lib` for re-use

arrow/src/compute/kernels/cast.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3043,7 +3043,8 @@ mod tests {
30433043
fn test_cast_utf8_to_i32() {
30443044
let a = StringArray::from(vec!["5", "6", "seven", "8", "9.1"]);
30453045
let array = Arc::new(a) as ArrayRef;
3046-
let b = cast(&array, &DataType::Int32).unwrap();
3046+
let b =
3047+
cast_with_options(&array, &DataType::Int32, &DEFAULT_CAST_OPTIONS).unwrap();
30473048
let c = b.as_any().downcast_ref::<Int32Array>().unwrap();
30483049
assert_eq!(5, c.value(0));
30493050
assert_eq!(6, c.value(1));
@@ -3073,7 +3074,9 @@ mod tests {
30733074
let strings = Arc::new(StringArray::from(vec![
30743075
"true", "false", "invalid", " Y ", "",
30753076
])) as ArrayRef;
3076-
let casted = cast(&strings, &DataType::Boolean).unwrap();
3077+
let casted =
3078+
cast_with_options(&strings, &DataType::Boolean, &DEFAULT_CAST_OPTIONS)
3079+
.unwrap();
30773080
let expected =
30783081
BooleanArray::from(vec![Some(true), Some(false), None, Some(true), None]);
30793082
assert_eq!(*as_boolean_array(&casted), expected);
@@ -3257,8 +3260,12 @@ mod tests {
32573260
None,
32583261
])) as ArrayRef;
32593262
for array in &[a1, a2] {
3260-
let b =
3261-
cast(array, &DataType::Timestamp(TimeUnit::Nanosecond, None)).unwrap();
3263+
let b = cast_with_options(
3264+
array,
3265+
&DataType::Timestamp(TimeUnit::Nanosecond, None),
3266+
&DEFAULT_CAST_OPTIONS,
3267+
)
3268+
.unwrap();
32623269
let c = b
32633270
.as_any()
32643271
.downcast_ref::<TimestampNanosecondArray>()
@@ -3284,7 +3291,8 @@ mod tests {
32843291
None,
32853292
])) as ArrayRef;
32863293
for array in &[a1, a2] {
3287-
let b = cast(array, &DataType::Date32).unwrap();
3294+
let b = cast_with_options(array, &DataType::Date32, &DEFAULT_CAST_OPTIONS)
3295+
.unwrap();
32883296
let c = b.as_any().downcast_ref::<Date32Array>().unwrap();
32893297
assert_eq!(17890, c.value(0));
32903298
assert_eq!(17891, c.value(1));
@@ -3306,7 +3314,8 @@ mod tests {
33063314
None,
33073315
])) as ArrayRef;
33083316
for array in &[a1, a2] {
3309-
let b = cast(array, &DataType::Date64).unwrap();
3317+
let b = cast_with_options(array, &DataType::Date64, &DEFAULT_CAST_OPTIONS)
3318+
.unwrap();
33103319
let c = b.as_any().downcast_ref::<Date64Array>().unwrap();
33113320
assert_eq!(1599566400000, c.value(0));
33123321
assert!(c.is_null(1));
@@ -5026,7 +5035,8 @@ mod tests {
50265035
"2000", // just a year is invalid
50275036
]);
50285037
let array = Arc::new(a) as ArrayRef;
5029-
let b = cast(&array, &DataType::Date32).unwrap();
5038+
let b =
5039+
cast_with_options(&array, &DataType::Date32, &DEFAULT_CAST_OPTIONS).unwrap();
50305040
let c = b.as_any().downcast_ref::<Date32Array>().unwrap();
50315041

50325042
// test valid inputs
@@ -5067,7 +5077,8 @@ mod tests {
50675077
"2000-01-01", // just a date is invalid
50685078
]);
50695079
let array = Arc::new(a) as ArrayRef;
5070-
let b = cast(&array, &DataType::Date64).unwrap();
5080+
let b =
5081+
cast_with_options(&array, &DataType::Date64, &DEFAULT_CAST_OPTIONS).unwrap();
50715082
let c = b.as_any().downcast_ref::<Date64Array>().unwrap();
50725083

50735084
// test valid inputs
@@ -5097,7 +5108,8 @@ mod tests {
50975108
for array in get_arrays_of_all_types() {
50985109
for to_type in &all_types {
50995110
println!("Test casting {:?} --> {:?}", array.data_type(), to_type);
5100-
let cast_result = cast(&array, to_type);
5111+
let cast_result =
5112+
cast_with_options(&array, to_type, &DEFAULT_CAST_OPTIONS);
51015113
let reported_cast_ability = can_cast_types(array.data_type(), to_type);
51025114

51035115
// check for mismatch

0 commit comments

Comments
 (0)