Skip to content

Conversation

@comphead
Copy link
Contributor

Which issue does this PR close?

Closes #9724 .

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added optimizer Optimizer rules substrait Changes to the substrait crate labels Mar 21, 2024
use std::fs::OpenOptions;
use std::io::{Read, Write};

#[allow(clippy::suspicious_open_options)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@waynexia please check this

I suppressed the warning but clippy requires .truncate to be called before file creation

  --> datafusion/substrait/src/serializer.rs:32:39
   |
32 |     let mut file = OpenOptions::new().create(true).write(true).open(path)?;
   |                                       ^^^^^^^^^^^^- help: add: `.truncate(true)`
   |
   = help: if you intend to overwrite an existing file entirely, call `.truncate(true)`
   = help: if you instead know that you may want to keep some parts of the old file, call `.truncate(false)`
   = help: alternatively, use `.append(true)` to append to the file instead of overwriting it
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_open_options
   = note: `-D clippy::suspicious-open-options` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::suspicious_open_options)]`

Copy link
Contributor

Choose a reason for hiding this comment

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

Filed #9727 to track

@comphead comphead changed the title build: fix CI clippy build: modify code to comply with latest clippy requirement Mar 21, 2024
@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates core Core DataFusion crate labels Mar 21, 2024
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.

Thank you @comphead -- much appreciated 🙏


assert_eq!(std::mem::size_of::<ScalarValue>(), 48);
// The value can be changed depending on rust version
assert_eq!(std::mem::size_of::<ScalarValue>(), 64);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an interesting change -- basically it means that all ScalarValue based code will potentially consume significantly more memory (as now each ScalarValue takes 64 bytes rather than 48). Interestingly, this is the same behavior as aarch64 in previous rust versions (you can see this test is cfg'd off with

    #[cfg(not(target_arch = "aarch64"))]

I'll make a follow on PR to remove this cfg

Copy link
Contributor

Choose a reason for hiding this comment

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

use std::fs::OpenOptions;
use std::io::{Read, Write};

#[allow(clippy::suspicious_open_options)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Filed #9727 to track

@alamb
Copy link
Contributor

alamb commented Mar 21, 2024

Merging this in to get CI passing on main again. Let's handle additional changes in followups

@alamb alamb merged commit eda2ddf into apache:main Mar 21, 2024
wiedld pushed a commit to wiedld/arrow-datafusion that referenced this pull request Apr 1, 2024
)

* fix CI clippy

* fix scalar size test

* fix tests

* fix tests
wiedld pushed a commit to influxdata/arrow-datafusion that referenced this pull request Apr 1, 2024
)

* fix CI clippy

* fix scalar size test

* fix tests

* fix tests
wiedld pushed a commit to influxdata/arrow-datafusion that referenced this pull request Apr 1, 2024
)

* fix CI clippy

* fix scalar size test

* fix tests

* fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules physical-expr Changes to the physical-expr crates substrait Changes to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI fails with latest rustup updates.

2 participants