-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Safeguard round function decimal places overflow #6232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| } | ||
| )) as ArrayRef) | ||
| } | ||
| ColumnarValue::Array(decimal_places) => Ok(Arc::new(make_function_inputs2!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I basically gave up using the existing macro (make_function_inputs2), not sure is it worth changing it to be possibly return Result within the $FUNC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! This overflow issue can be solved during binding in the future(hopefully...), I think it's not necessary to change the existing macro 🤔
|
Maybe we can simply change the |
Postgres output: |
| } | ||
| )) as ArrayRef) | ||
| } | ||
| ColumnarValue::Array(decimal_places) => Ok(Arc::new(make_function_inputs2!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! This overflow issue can be solved during binding in the future(hopefully...), I think it's not necessary to change the existing macro 🤔
| } | ||
| } | ||
|
|
||
| fn round_downcast_decimal_places(decimal_place: i64) -> Result<i32> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed most small helpers inside execution are macros to guarantee inline for performance, should we make this function macro?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I made it as a macro instead!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could inline a function too. Not necessary to be macros actually as macros are more difficult to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, revert it back with inline attribute instead.
* Update object_store 0.6 and arrow * Remove pin * Fix pyarrow * Tomlfmt * Update flight_sql_service * Fix parquet_sql_multiple_files
* feat: multidimensional arrays * feat: array_append, array_prepend, array_concat, array_fill * feat: array_dims, array_length * feat: array_position, array_positions, array_remove, array_replace, array_to_string * feat: trim_array, cardinality * feat: docs * refactoring: code cleanup * fix: test_scalar_expr * fix: clippy * fix: array_concat capacity * fix: cargo fmt
* MemoryExec insert into refactor * Merge leftovers * Set target partition * Comment and formatting improvements * Comments on state. * ListingTable INSERT INTO support * Removing unnecessary code * Some comments are leftover. * Compression import error * Minor resolutions on cargo docs * Corrections after merge * Make FileWriterExt available * Single file support * Resolve linter errors * Minor changes, simplifications * Fix failing tests because of api change * Simplifications * Replace block nesting with drop * remove unnecessary code * Convert to new approach * simplify display * Update debug display * use handle err macro * Make handle err close all writer in case of error. * Final review, stylistic changes * Improve comments * Move insert into test to the explain.slt * convert macro to function * return error for abort in append mode. * Simplify condition of has header * Update comments * Remove file writer factory * use AbortableWrite struct instead of trait --------- Co-authored-by: metesynnada <100111937+metesynnada@users.noreply.github.com> Co-authored-by: Mehmet Ozan Kabak <ozankabak@gmail.com>
* Update hashbrown * Update hashbrown * Update hashbrown --------- Co-authored-by: Daniël Heres <daniel.heres@coralogix.com>
…pagation into `RecordBatchReceiverStream` (apache#6507) * Propagate panics Another try for fixing apache#3104. RepartitionExec might need a similar fix. * avoid allocation by pinning on the stack instead * Consolidate panic propagation into RecordBatchReceiverStream * Update docs / cleanup/ * Apply suggestions from code review Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com> * rename to be consistent and not deal with English pecularities * Add a test and comments * write test for drop cancel * Add test fpr not driving to completion * Do not drive all streams to error * terminate early on panic * tweak comments * tweak comments * use futures::stream --------- Co-authored-by: Nicolae Vartolomei <nv@nvartolomei.com> Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com>
* Move `physical_plan::file_format` to `datasource::plan` * fix doclinks
…he#6579) Updates the requirements on [substrait](https://github.com/substrait-io/substrait-rs) to permit the latest version. - [Release notes](https://github.com/substrait-io/substrait-rs/releases) - [Changelog](https://github.com/substrait-io/substrait-rs/blob/main/CHANGELOG.md) - [Commits](substrait-io/substrait-rs@v0.10.0...v0.11.0) --- updated-dependencies: - dependency-name: substrait dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* make page_filter public * make parquet public * fix CI
* Update `use crate::error` to `use datafusion_common` in physical_plan * More updates
* feat: distinct bitwise and boolean aggregate functions * feat: add distinct sqllogictests for other bitwise and boolean aggregate functions * feat: improve docs for csv_query_bit_xor_distinct
* Make the struct function return the correct data type. * add testcase
…pache#6592) * Add additional docstrings to Window function implementations * Update docs * updates * fix doc link * Change resorting --> re-sorting
* Cleanup tpch benchmark * Cleanup tpch benchmark --------- Co-authored-by: Daniël Heres <daniel.heres@coralogix.com>
* clippy * remove default() * style: remove redundant prefix in function.rs
… being used more than once (apache#6135) * Fix incorrect join key fields (indices) when same table is being used more than once * Addressed comments Update datafusion/substrait/src/logical_plan/producer.rs Co-authored-by: Ruihang Xia <waynestxia@gmail.com> Update datafusion/substrait/src/logical_plan/producer.rs Co-authored-by: Ruihang Xia <waynestxia@gmail.com> * Fixed bugs after rebase --------- Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
* Add datafusion-cli tests to the CI Job * Fix clippy error of datafusion-cli * update tests of datafusion-cli * fix tests error of datafusion-cli * Splits out "cargo test datafusion-cli (amd64)" into separate CI job, fix "no space left on device" error
* Refactor joins test to sqllogic * Port more tests * More tests * Remove unused method * Add more test * Add more test * Add more test * Add more test * Add more test * Add more test * Add more test * Add more test * Add more test * Add more test * Add more test * Add more test * Add more tests * Add more test * Add more test * Add more tests * Add more tests * Add more tests * Add more test * Add more test * Add more test * Add more test * Add more test * Add more test * Add more test * Add more test
This fixes inconsistency between rustdocs for Display of files and file groups by applying the same function formatting up to 5 elements. Also adds corresponding unit tests.
* feat: make_array support empty arguments * fix fmt error * fix error * array_append support empty array * array_prepend support empty make_array * array_concat support empty make_array * fix clippy * update * fix * rename `array_make` --> `make_array` --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
…ent at aggregate.slt
…pache#6646) Updates the requirements on [sqllogictest](https://github.com/risinglightdb/sqllogictest-rs) to permit the latest version. - [Release notes](https://github.com/risinglightdb/sqllogictest-rs/releases) - [Changelog](https://github.com/risinglightdb/sqllogictest-rs/blob/main/CHANGELOG.md) - [Commits](risinglightdb/sqllogictest-rs@v0.13.2...v0.14.0) --- updated-dependencies: - dependency-name: sqllogictest dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…he#6564) * Improve main api doc page * fix doc examples * fmt
apache#6601) * Prioritize UDF over scalar built-in function in case of function name collision * Remove prioritize_udf config flag (assume true by default) * Add test scalar_udf_override_built_in_scalar_function
0fdffa8 to
70014e6
Compare
| }) | ||
| }; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The input/output types are always i64/i32. This isn't necessary to be a macro, I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can have a inline function instead.
70014e6 to
fe128c4
Compare
|
@viirya (or @liukun4515 ) do you have time to review / approve this PR? I haven't been following closely and I think you are the experts in Decimal implementation in DataFusion |
|
I wonder if #6833 is similar functionality |
|
I am not sure what is going on with this PR -- it now looks like a huge change and it has been stale for quite a while. Marking it as draft while we figure out what to do with it |
|
I think the change is so out-of-dated from latest branch so the diffs are unclear what are actual change from this PR. It'd be better to sync up with latest branch. |
|
Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days. |
Which issue does this PR close?
Closes #6133.
Rationale for this change
Add runtime check rather than crash the system.
What changes are included in this PR?
Safeguard the panic from round function decimal places overflow.
In #6133 stated there could be a type check in binding phase, only add the runtime check in this PR though I do agree having error throwing out in the logical planning might be better.
Are these changes tested?
Yes
Are there any user-facing changes?
No