Skip to content

Upgrade to arrow 20.0.0 - #3007

Closed
avantgardnerio wants to merge 3 commits into
apache:masterfrom
spaceandtimefdn:bg_upgrade_arrow
Closed

Upgrade to arrow 20.0.0#3007
avantgardnerio wants to merge 3 commits into
apache:masterfrom
spaceandtimefdn:bg_upgrade_arrow

Conversation

@avantgardnerio

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes#3006.

Rationale for this change

We'll have to do it sooner or later, but mostly I want the new authentication capabilities in the FlightSqlServer code.

What changes are included in this PR?

An attempt at upgrading to the latest arrow.

Are there any user-facing changes?

It doesn't (presently) compile, so I'm making a draft PR to seek input on CI failures.

@github-actionsgithub-actionsBot added core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules physical-expr Changes to the physical-expr crates sql SQL Planner labels Aug 1, 2022
@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

I fixed a lot of the obvious errors, but I wasn't sure what to do about

error[E0308]: mismatched types
--> datafusion/physical-expr/src/expressions/binary.rs:135:40
|
135 | .map(|left| left.map(|left| op(left, right)))
| -- ^^^^ expected `i128`, found struct `arrow::util::decimal::Decimal128`
| |
| arguments to this function are incorrect
|
note: callable defined here
--> datafusion/physical-expr/src/expressions/binary.rs:131:8
|
131 | F: Fn(i128, i128) -> bool,
| ^^^^^^^^^^^^^^^^^^^^^^

and

error[E0308]: mismatched types
--> datafusion/physical-expr/src/expressions/in_list.rs:225:68
|
225 | .map(|vop| match vop.map(|v| !$VALUES.contains(&v)) {
| -------- ^^ expected `i128`, found struct `arrow::util::decimal::Decimal128`
| |
| arguments to this function are incorrect
...
318 | collection_contains_check!(array, values, negated, contains_null)
| ----------------------------------------------------------------- in this macro invocation
|
= note: expected reference `&i128`
found reference `&arrow::util::decimal::Decimal128`
note: associated function defined here
--> /home/bgardner/snap/rustup/common/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/mod.rs:2172:12
|
2172 | pub fn contains(&self, x: &T) -> bool
| ^^^^^^^^
= note: this error originates in the macro `collection_contains_check` (in Nightly builds, run with -Z macro-backtrace for more info)

CC @andygrove and @alamb - if you guys have any advice, it would be appreciated.

@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

If I understand correctly, the other XXXArray types have iterators that return the primitive representations (i.e. u128), but Decimal now returns a struct with From and to() traits?

https://github.com/apache/arrow-rs/blob/master/arrow/src/util/decimal.rs#L132

@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

If I revert the change here: https://github.com/apache/arrow-rs/pull/2140/files to:

def_decimal_array!(
Decimal128Array,
"Decimal128Array",
Decimal128,
Decimal128Iter
);

vs

def_decimal_array!(Decimal128Array, "Decimal128Array");

It compiles and happily runs. I'm not sure if that's the correct fix though.

@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

CC @HaoYang670

@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

From i128 to Decimal128

But that ripples up to ScalarValues and throughout the codebase quickly.

@viirya

Copy link
Copy Markdown
Member

expected i128, found struct arrow::util::decimal::Decimal128

Have you tried calling as_i128()?

@stuartcarnie

Copy link
Copy Markdown
Contributor

👋🏻 hi @avantgardnerio I was able to successfully upgrade arrow-rs via this draft PR for which all DataFusion tests pass: #3010. Perhaps there are commits in this PR that are useful for your work here?

@alamb

alamb commented Aug 2, 2022

Copy link
Copy Markdown
Contributor

Thank you @avantgardnerio and @stuartcarnie -- this is so great. I have normally been doing this work during / as part of the release process (e.g. apache/arrow-rs#2172)

THANK YOU so much for getting a start on it earlier.

@alambalamb changed the title Upgrade arrowUpgrade to arrow 20.0.0Aug 2, 2022
@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

Perhaps there are commits in this PR that are useful for your work here?

100%. Thank you so much!

@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

THANK YOU so much for getting a start on it earlier.

Well, I wanted one of the arrow-rs features :). But really, thanks to @andygrove and @stuartcarnie for figuring out how to make it work. I'm still learning. I'll look over the work the others did and familiarize myself with the solution so I can maybe not get stuck next time.

@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

Have you tried calling as_i128()?

I did, but however I tried to do it rippled up through the codebase and affected lots of places. @andygrove was able to figure it out. Thank you both for your help!

@avantgardnerio
avantgardnerio marked this pull request as ready for review August 3, 2022 15:05
@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

@andygrove and @alamb looks like the checks are failing because lack of protoc? Any idea why this would have just started?

@carols10cents

Copy link
Copy Markdown
Contributor

Yes, prost is no longer bundling protoc. It looks like this repo will need changes similar to these? apache/arrow-rs#2280

@alamb

alamb commented Aug 3, 2022

Copy link
Copy Markdown
Contributor

@avantgardnerio I can help mess around with (aka help with) this PR as part of preparing the arrow release candidate, which I will likely do this Friday

@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

likely do this Friday

I'd love to get this one in first, but I'm sure there's a lot of people with a lot of interests and they all need to be considered: apache/arrow-rs#2309

I'm happy to help in any way I can with the release.

@avantgardnerio
avantgardnerioforce-pushed the bg_upgrade_arrow branch 3 times, most recently from 520c5fa to b015c83CompareAugust 6, 2022 01:14
@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

@tustvold I think I'm stuck on these failures:

---- physical_plan::file_format::parquet::tests::parquet_exec_with_error stdout ----
thread 'physical_plan::file_format::parquet::tests::parquet_exec_with_error' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidPath { path: "." }', datafusion/core/src/physical_plan/file_format/parquet.rs:1243:14
---- test_util::tests::test_data_dir stdout ----
thread 'test_util::tests::test_data_dir' panicked at 'assertion failed: `(left == right)`
left: `"/Users/runner/work/arrow-datafusion/arrow-datafusion/datafusion"`,
right: `"/Users/runner/work/arrow-datafusion/arrow-datafusion/datafusion/core/.."`', datafusion/core/src/test_util.rs:345:9

It appears they are because this branch is referencing ../objectstore instead of object_store = "0.3.0" on master. I'm a little reticent to switch is back as this seems more appropriate and there's build errors either way. When you get a moment, I'd appreciate input, thanks!

@alamb

alamb commented Aug 6, 2022

Copy link
Copy Markdown
Contributor

It appears they are because this branch is referencing ../objectstore instead of object_store = "0.3.0" on master. I'm a little reticent to switch is back as this seems more appropriate and there's build errors either way. When you get a moment, I'd appreciate input, thanks!

I'll try and give it a look on monday. Thanks @avantgardnerio

Comment threaddatafusion/common/Cargo.toml Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't believe we intend to release object_store as part of arrow 20, and so I would back out this change

@avantgardnerioavantgardnerioAug 8, 2022

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Here's an alternative version with object_store not upgraded, but I struggled with this too: #3083

Comment threaddatafusion/core/Cargo.toml Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto

@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

Thanks @alamb and @tustvold . I'll be out most of today, I'll try to devote time as I have it this weekend. I'm sure we can get it sorted by Monday.

fix decimal (#4)
Fix human error
Patch crates io to fix build (#5)
* fix decimal
* patch crate versions
Patch objectstore
Test in CI
Undo override?
Fix more errors
Fix last error?
Formatting
Clippy
Fixes
Fix refs
Able to get session context, but JDBC driver hung
Upgrade to arrow 20
Upgrade to RC2
Formatting
Fix some imports
Install protoc
Try platform agnostic path
Debug in CI :(
Debug in CI :(
Debug in CI :(
Not worth it, just separate builds
Variables
Fixes
Fix windows?
Fix windows?
Hackily fix windows
Down to 1 failure
Fix protoc
All? tests pass
Formatting
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Merging #3007 (a96911d) into master (85d5363) will decrease coverage by 0.01%.
The diff coverage is 92.30%.

❗ Current head a96911d differs from pull request most recent head 5270354. Consider uploading reports for the commit 5270354 to get more accurate results

@@ Coverage Diff @@## master #3007 +/- ##
==========================================
- Coverage 85.93% 85.91% -0.02% 
==========================================
Files 289 289 Lines 52101 52116 +15 ==========================================
+ Hits 44774 44778 +4 - Misses 7327 7338 +11 
Impacted FilesCoverage Δ
...usion/core/src/avro_to_arrow/arrow_array_reader.rs0.00% <0.00%> (ø)
datafusion/core/src/catalog/information_schema.rs94.42% <0.00%> (ø)
...ore/src/physical_plan/file_format/chunked_store.rs62.26% <0.00%> (-5.09%)⬇️
datafusion/core/src/physical_plan/hash_utils.rs40.43% <0.00%> (ø)
datafusion/core/src/physical_plan/repartition.rs93.26% <ø> (ø)
...tafusion/core/src/physical_plan/sort_merge_join.rs90.36% <0.00%> (ø)
datafusion/core/tests/path_partition.rs84.92% <0.00%> (-0.87%)⬇️
datafusion/core/tests/sql/aggregates.rs99.36% <ø> (ø)
datafusion/core/tests/sql/decimal.rs100.00% <ø> (ø)
datafusion/core/tests/sql/joins.rs99.33% <ø> (ø)
... and 40 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

I got all the tests passing except windows. I installed a VM and tried to fix that too, but I'm getting lots of interesting errors with paths like file:///?\C:\some\path/myfile.parquet and I have to admit I'm a bit lost on those. I can probably debug them, but I might need to set up a real Windows environment instead of a slow VM.

@tustvold

tustvold commented Aug 8, 2022

Copy link
Copy Markdown
Contributor

I got all the tests passing except windows. I installed a VM and tried to fix that too, but I'm getting lots of interesting errors with paths like file:///?\C:\some\path/myfile.parquet and I have to admit I'm a bit lost on those. I can probably debug them, but I might need to set up a real Windows environment instead of a slow VM.

The path handling changed upstream, in particular apache/arrow-rs#2269, I could definitely see this having downstream implications. There is an outstanding PR apache/arrow-rs#2371 that may help, but I would strongly advise against upgrading object_store as part of this PR. Once we have a RC for the next object_store version, I'll work on updating DataFusion to it including all the various windows path nonsense

@avantgardnerio

Copy link
Copy Markdown
ContributorAuthor

Closing in favor of #3083

@avantgardnerio
avantgardnerio deleted the bg_upgrade_arrow branch September 5, 2022 17:24
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coreCore DataFusion cratelogical-exprLogical plan and expressionsoptimizerOptimizer rulesphysical-exprChanges to the physical-expr cratessqlSQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The upcoming release of Arrow (20?) breaks datafusion

7 participants

@avantgardnerio@viirya@stuartcarnie@alamb@carols10cents@codecov-commenter@tustvold