Skip to content

Commit 3c4413e

Browse files
committed
add test to verify switching off configuration
1 parent be8979c commit 3c4413e

File tree

2 files changed

+59
-11
lines changed

2 files changed

+59
-11
lines changed

ballista/client/tests/context_checks.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,36 @@ mod supported {
365365

366366
Ok(())
367367
}
368+
369+
// test checks if this view types have been disabled in the configuration
370+
//
371+
// `datafusion.execution.parquet.schema_force_view_types` have been disabled
372+
// temporary as they could break shuffle reader/writer.
373+
#[rstest]
374+
#[case::standalone(standalone_context())]
375+
#[case::remote(remote_context())]
376+
#[tokio::test]
377+
async fn should_disable_view_types(
378+
#[future(awt)]
379+
#[case]
380+
ctx: SessionContext,
381+
) -> datafusion::error::Result<()> {
382+
let result = ctx
383+
.sql("select name, value from information_schema.df_settings where name like 'datafusion.execution.parquet.schema_force_view_types' order by name limit 1")
384+
.await?
385+
.collect()
386+
.await?;
387+
//
388+
let expected = [
389+
"+------------------------------------------------------+-------+",
390+
"| name | value |",
391+
"+------------------------------------------------------+-------+",
392+
"| datafusion.execution.parquet.schema_force_view_types | false |",
393+
"+------------------------------------------------------+-------+",
394+
];
395+
396+
assert_batches_eq!(expected, &result);
397+
398+
Ok(())
399+
}
368400
}

ballista/core/src/extension.rs

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ pub trait SessionConfigHelperExt {
123123
fn update_from_key_value_pair(self, key_value_pairs: &[KeyValuePair]) -> Self;
124124
/// updates mut [SessionConfig] from proto
125125
fn update_from_key_value_pair_mut(&mut self, key_value_pairs: &[KeyValuePair]);
126+
/// changes some of default datafusion configuration
127+
/// in order to make it suitable for ballista
128+
fn ballista_restricted_configuration(self) -> Self;
126129
}
127130

128131
impl SessionStateExt for SessionState {
@@ -168,16 +171,7 @@ impl SessionStateExt for SessionState {
168171
.config()
169172
.clone()
170173
.with_option_extension(new_config.clone())
171-
// Ballista disables this option
172-
.with_round_robin_repartition(false)
173-
// There is issue with Utv8View(s) where Arrow IPC will generate
174-
// frames which would be too big to send using Arrow Flight.
175-
// We disable this option temporary
176-
// TODO: enable this option once we get to root of the problem
177-
.set_bool(
178-
"datafusion.execution.parquet.schema_force_view_types",
179-
false,
180-
);
174+
.ballista_restricted_configuration();
181175

182176
let builder = SessionStateBuilder::new_from_existing(self)
183177
.with_config(session_config)
@@ -205,7 +199,7 @@ impl SessionConfigExt for SessionConfig {
205199
.with_option_extension(BallistaConfig::default())
206200
.with_information_schema(true)
207201
.with_target_partitions(16)
208-
.with_round_robin_repartition(false)
202+
.ballista_restricted_configuration()
209203
}
210204
fn with_ballista_logical_extension_codec(
211205
self,
@@ -367,6 +361,28 @@ impl SessionConfigHelperExt for SessionConfig {
367361
}
368362
}
369363
}
364+
365+
fn ballista_restricted_configuration(self) -> Self {
366+
self
367+
// round robbin repartition does not work well with ballista.
368+
// this setting it will also be enforced by the scheduler
369+
// thus user will not be able to override it.
370+
.with_round_robin_repartition(false)
371+
// There is issue with Utv8View(s) where Arrow IPC will generate
372+
// frames which would be too big to send using Arrow Flight.
373+
//
374+
// This configuration option will be disabled temporary.
375+
//
376+
// This configuration is not enforced by the scheduler, thus
377+
// user could override this setting using `SET` operation.
378+
//
379+
// TODO: enable this option once we get to root of the problem
380+
// between `IpcWriter` and `ViewTypes`
381+
.set_bool(
382+
"datafusion.execution.parquet.schema_force_view_types",
383+
false,
384+
)
385+
}
370386
}
371387

372388
/// Wrapper for [SessionConfig] extension

0 commit comments

Comments
 (0)