You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/12/22 12:16:45 UTC
[GitHub] [arrow-datafusion] tustvold opened a new pull request, #4712: Don't share ConfigOptions (#3886)
tustvold opened a new pull request, #4712:
URL: https://github.com/apache/arrow-datafusion/pull/4712
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #3886
Relates to #4349
Relates to #4617
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
Having shared mutable state makes reasoning about mutation difficult (#4617), the locking is verbose and potentially error prone (#3886),
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #4712: Don't share ConfigOptions (#3886)
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #4712:
URL: https://github.com/apache/arrow-datafusion/pull/4712#discussion_r1055403962
##########
datafusion/proto/src/logical_plan/mod.rs:
##########
@@ -353,12 +353,9 @@ impl AsLogicalPlan for LogicalPlanNode {
self
))
})? {
- &FileFormatType::Parquet(protobuf::ParquetFormat {
Review Comment:
The plumbing for this override was actually incorrect, it would convert `false -> None`, the other overrides aren't present, and we plan to remove this override mechanism as part of #4349 so I just opted to remove it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #4712: Don't share ConfigOptions (#3886)
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #4712:
URL: https://github.com/apache/arrow-datafusion/pull/4712#discussion_r1055697092
##########
parquet-test-utils/src/lib.rs:
##########
@@ -58,6 +58,16 @@ pub struct ParquetScanOptions {
pub enable_page_index: bool,
}
+impl ParquetScanOptions {
+ /// Returns a [`SessionConfig`] with the given options
+ pub fn config(&self) -> SessionConfig {
+ SessionConfig::new()
Review Comment:
I debated simply removing `ParquetScanOptions` in favour of `SessionConfig` but figured this PR was large enough as it was
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #4712: Don't share ConfigOptions (#3886)
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #4712:
URL: https://github.com/apache/arrow-datafusion/pull/4712#discussion_r1055402357
##########
datafusion/proto/proto/datafusion.proto:
##########
@@ -90,7 +90,8 @@ message CsvFormat {
}
Review Comment:
I recommend viewing this with whitespace disabled

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4712: Don't share ConfigOptions (#3886)
Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #4712:
URL: https://github.com/apache/arrow-datafusion/pull/4712#discussion_r1055827216
##########
datafusion/core/src/datasource/file_format/parquet.rs:
##########
@@ -56,25 +55,25 @@ use crate::physical_plan::{Accumulator, ExecutionPlan, Statistics};
pub const DEFAULT_PARQUET_EXTENSION: &str = ".parquet";
/// The Apache Parquet `FileFormat` implementation
-#[derive(Debug)]
+///
+/// Note it is recommended these are instead configured on the [`ConfigOptions`]
+/// associated with the [`SessionState`] instead of overridden on a format-bases
Review Comment:
```suggestion
/// associated with the [`SessionState`] instead of overridden on a format-basis
```
##########
datafusion-examples/examples/flight_server.rs:
##########
@@ -39,37 +38,21 @@ pub struct FlightServiceImpl {}
#[tonic::async_trait]
impl FlightService for FlightServiceImpl {
- type HandshakeStream = Pin<
- Box<dyn Stream<Item = Result<HandshakeResponse, Status>> + Send + Sync + 'static>,
- >;
- type ListFlightsStream =
- Pin<Box<dyn Stream<Item = Result<FlightInfo, Status>> + Send + Sync + 'static>>;
- type DoGetStream =
- Pin<Box<dyn Stream<Item = Result<FlightData, Status>> + Send + Sync + 'static>>;
- type DoPutStream =
- Pin<Box<dyn Stream<Item = Result<PutResult, Status>> + Send + Sync + 'static>>;
- type DoActionStream = Pin<
- Box<
- dyn Stream<Item = Result<arrow_flight::Result, Status>>
- + Send
- + Sync
- + 'static,
- >,
- >;
- type ListActionsStream =
- Pin<Box<dyn Stream<Item = Result<ActionType, Status>> + Send + Sync + 'static>>;
- type DoExchangeStream =
- Pin<Box<dyn Stream<Item = Result<FlightData, Status>> + Send + Sync + 'static>>;
+ type HandshakeStream = BoxStream<'static, Result<HandshakeResponse, Status>>;
Review Comment:
I forgot this was here -- I have to give this example love to give this after my work to make arrow-flight easier to use
##########
datafusion/core/src/datasource/file_format/parquet.rs:
##########
@@ -56,25 +55,25 @@ use crate::physical_plan::{Accumulator, ExecutionPlan, Statistics};
pub const DEFAULT_PARQUET_EXTENSION: &str = ".parquet";
/// The Apache Parquet `FileFormat` implementation
-#[derive(Debug)]
+///
+/// Note it is recommended these are instead configured on the [`ConfigOptions`]
+/// associated with the [`SessionState`] instead of overridden on a format-bases
+///
+/// TODO: Deprecate and remove overrides (#4349)
Review Comment:
```suggestion
/// TODO: Deprecate and remove overrides
/// <https://github.com/apache/arrow-datafusion/issues/4349>
```
##########
datafusion/proto/proto/datafusion.proto:
##########
@@ -1132,6 +1133,9 @@ message ScanLimit {
}
message FileScanExecConf {
+ // Was repeated ConfigOption options = 10;
+ reserved 10;
Review Comment:
👍
##########
datafusion/core/src/execution/context.rs:
##########
@@ -1173,7 +1166,7 @@ pub struct SessionConfig {
/// due to `resolve_table_ref` which passes back references)
default_schema: String,
/// Configuration options
- pub config_options: Arc<RwLock<ConfigOptions>>,
+ config_options: ConfigOptions,
Review Comment:
❤️
##########
datafusion/proto/proto/datafusion.proto:
##########
@@ -445,79 +446,79 @@ message InListNode {
}
enum ScalarFunction {
- Abs=0;
- Acos=1;
- Asin=2;
- Atan=3;
- Ascii=4;
- Ceil=5;
- Cos=6;
- Digest=7;
- Exp=8;
- Floor=9;
- Ln=10;
- Log=11;
- Log10=12;
- Log2=13;
- Round=14;
- Signum=15;
- Sin=16;
- Sqrt=17;
- Tan=18;
- Trunc=19;
- Array=20;
- RegexpMatch=21;
- BitLength=22;
- Btrim=23;
- CharacterLength=24;
- Chr=25;
- Concat=26;
- ConcatWithSeparator=27;
- DatePart=28;
- DateTrunc=29;
- InitCap=30;
- Left=31;
- Lpad=32;
- Lower=33;
- Ltrim=34;
- MD5=35;
- NullIf=36;
- OctetLength=37;
- Random=38;
- RegexpReplace=39;
- Repeat=40;
- Replace=41;
- Reverse=42;
- Right=43;
- Rpad=44;
- Rtrim=45;
- SHA224=46;
- SHA256=47;
- SHA384=48;
- SHA512=49;
- SplitPart=50;
- StartsWith=51;
- Strpos=52;
- Substr=53;
- ToHex=54;
- ToTimestamp=55;
- ToTimestampMillis=56;
- ToTimestampMicros=57;
- ToTimestampSeconds=58;
- Now=59;
- Translate=60;
- Trim=61;
- Upper=62;
- Coalesce=63;
- Power=64;
- StructFun=65;
- FromUnixtime=66;
- Atan2=67;
- DateBin=68;
- ArrowTypeof=69;
- CurrentDate=70;
- CurrentTime=71;
- Uuid=72;
+ Abs = 0;
Review Comment:
whitespace!
##########
datafusion/proto/src/logical_plan/mod.rs:
##########
@@ -353,12 +353,9 @@ impl AsLogicalPlan for LogicalPlanNode {
self
))
})? {
- &FileFormatType::Parquet(protobuf::ParquetFormat {
Review Comment:
I agree serializing the same config options multiple times (once in the main session context and then once again as part of the file format) is undesirable for many reasons
##########
parquet-test-utils/src/lib.rs:
##########
@@ -58,6 +58,16 @@ pub struct ParquetScanOptions {
pub enable_page_index: bool,
}
+impl ParquetScanOptions {
+ /// Returns a [`SessionConfig`] with the given options
+ pub fn config(&self) -> SessionConfig {
+ SessionConfig::new()
Review Comment:
Thank you. I agree this PR is already large. I also think the ParquetScanOptions predated the config options.
I think removing the ParquetScanOptions as a follow on PR is a good idea 👍
##########
datafusion/core/src/datasource/file_format/parquet.rs:
##########
@@ -85,13 +84,9 @@ impl ParquetFormat {
}
/// Return true if pruning is enabled
- pub fn enable_pruning(&self) -> bool {
+ pub fn enable_pruning(&self, config_options: &ConfigOptions) -> bool {
Review Comment:
👍
##########
datafusion/core/src/execution/context.rs:
##########
@@ -1202,14 +1195,14 @@ impl SessionConfig {
/// Create an execution config with config options read from the environment
pub fn from_env() -> Self {
Self {
- config_options: ConfigOptions::from_env().into_shareable(),
+ config_options: ConfigOptions::from_env(),
..Default::default()
}
}
/// Set a configuration option
- pub fn set(self, key: &str, value: ScalarValue) -> Self {
- self.config_options.write().set(key, value);
+ pub fn set(mut self, key: &str, value: ScalarValue) -> Self {
Review Comment:
fyi @waynexia
##########
datafusion/core/src/physical_plan/file_format/parquet.rs:
##########
@@ -302,6 +287,8 @@ impl ExecutionPlan for ParquetExec {
})
})?;
+ let config_options = ctx.session_config().config_options();
Review Comment:
I think it is reasonable to look at the session configuration while executing 🤷
It certainly seems better than the current state of master where the config options (attached to session state) are read via interior mutability
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #4712: Don't share ConfigOptions (#3886)
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #4712:
URL: https://github.com/apache/arrow-datafusion/pull/4712#discussion_r1055401436
##########
datafusion/core/src/physical_plan/file_format/parquet.rs:
##########
@@ -302,6 +287,8 @@ impl ExecutionPlan for ParquetExec {
})
})?;
+ let config_options = ctx.session_config().config_options();
Review Comment:
We need to fetch this at execution time, in order that datafusion-proto can still deserialize `ParquetExec` without a `SessionState`. Longer term as we strip out the overrides this will make more sense anyway so :shrug:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] ursabot commented on pull request #4712: Don't share ConfigOptions (#3886)
Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #4712:
URL: https://github.com/apache/arrow-datafusion/pull/4712#issuecomment-1363836513
Benchmark runs are scheduled for baseline = afb1ae230d53db3cd6c26230040c277d9c2945f8 and contender = 07f49803a3d7a9e9b3c2c9a7714c1bb08db71385. 07f49803a3d7a9e9b3c2c9a7714c1bb08db71385 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/647ce69dee2f4936b395714e758c4ad3...18b23f5d186c49858dd0524c839d5e3e/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/b40c53f57a0448089c9022b41dccc5df...747b01bf1e0f4b8d86aabe3bee3e7c55/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/0e7aaeb37fa946efb2a1b2520c1c8a7c...de4dd88118354a7b8ea141cdeb487682/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/39887bc3e97544a2854a33f8cf854c03...e49393d108ec4ccc91b328b17821a415/)
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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] tustvold merged pull request #4712: Don't share ConfigOptions (#3886)
Posted by GitBox <gi...@apache.org>.
tustvold merged PR #4712:
URL: https://github.com/apache/arrow-datafusion/pull/4712
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org