Skip to content

Conversation

@kmitchener
Copy link
Contributor

Which issue does this PR close?

Closes #3487 .

Rationale for this change

Prior to fix, would error (no longer panic after Arrow 23). After fix, works as expected.

select a < null from (values (1.1::decimal)) as t(a);
+------------------------------+
| t.a < Decimal128(None,38,10) |
+------------------------------+
|                              |
+------------------------------+
1 row in set. Query took 0.014 seconds.

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added core Core DataFusion crate physical-expr Changes to the physical-expr crates labels Sep 21, 2022
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @kmitchener

let result: Result<Arc<dyn Array>> = match right {
ScalarValue::Boolean(b) => compute_bool_op_dyn_scalar!($LEFT, b, $OP, $OP_TYPE),
ScalarValue::Decimal128(..) => compute_decimal_op_scalar!($LEFT, right, $OP, Decimal128Array),
ScalarValue::Decimal128(..) => compute_decimal_op_dyn_scalar!($LEFT, right, $OP, $OP_TYPE),
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️ you are starting to figure out the thicket that is binary.rs 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah :) and what a pleasure it is

ll,
$RIGHT.try_into()?,
)?))
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we assert here that $RIGHT is still a decimal ? As written the code could convert ScalarValue::Int8(Some(4)) into NULL, for example

But I don't know if such a ScalarValue could be passed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we need to. Those 2 decimal macros are used only in 1 place each and include "decimal" in the name -- it'd be a clear mistake to use it for any other datatype. This area could use some refactoring, but I wanted to get this in and the kernels moved to arrow-rs then maybe revisit this whole module (famous last words, right?).

Copy link
Contributor

Choose a reason for hiding this comment

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

famous last words maybe, but a reasonable plan nonetheless ;)

@alamb alamb merged commit b134fa4 into apache:master Sep 22, 2022
@alamb
Copy link
Contributor

alamb commented Sep 22, 2022

Thanks again @kmitchener

@ursabot
Copy link

ursabot commented Sep 22, 2022

Benchmark runs are scheduled for baseline = b54a56f and contender = b134fa4. b134fa4 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@kmitchener kmitchener deleted the 3487-fix-decimal-array-comparison-with-null-scalar branch September 27, 2022 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

comparison operations with a scalar null and decimal array panics

3 participants