Skip to content

Commit

Permalink
Structify ConfigOptions (apache#4517)
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Dec 29, 2022
1 parent 41c72cf commit 4498533
Show file tree
Hide file tree
Showing 18 changed files with 611 additions and 868 deletions.
3 changes: 2 additions & 1 deletion benchmarks/src/bin/h2o.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ async fn main() -> Result<()> {

async fn group_by(opt: &GroupBy) -> Result<()> {
let path = opt.path.to_str().unwrap();
let config = SessionConfig::from_env().with_batch_size(65535);
let mut config = SessionConfig::from_env()?;
config.config_options_mut().built_in.execution.batch_size = 65535;

let ctx = SessionContext::with_config(config);

Expand Down
4 changes: 2 additions & 2 deletions datafusion/core/src/bin/print_config_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// specific language governing permissions and limitations
// under the License.

use datafusion::config::BuiltInConfigs;
use datafusion::config::ConfigOptions;

fn main() {
let docs = BuiltInConfigs::generate_config_markdown();
let docs = ConfigOptions::generate_config_markdown();
println!("{}", docs);
}
14 changes: 7 additions & 7 deletions datafusion/core/src/catalog/information_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use arrow::{
record_batch::RecordBatch,
};

use crate::config::ConfigOptions;
use crate::config::{ConfigEntry, ConfigOptions};
use crate::datasource::streaming::{PartitionStream, StreamingTable};
use crate::datasource::TableProvider;
use crate::execution::context::TaskContext;
Expand Down Expand Up @@ -162,8 +162,8 @@ impl InformationSchemaConfig {
config_options: &ConfigOptions,
builder: &mut InformationSchemaDfSettingsBuilder,
) {
for (name, setting) in config_options.options() {
builder.add_setting(name, setting.to_string());
for entry in config_options.entries() {
builder.add_setting(entry);
}
}
}
Expand Down Expand Up @@ -611,7 +611,7 @@ impl InformationSchemaDfSettings {
fn new(config: InformationSchemaConfig) -> Self {
let schema = Arc::new(Schema::new(vec![
Field::new("name", DataType::Utf8, false),
Field::new("setting", DataType::Utf8, false),
Field::new("setting", DataType::Utf8, true),
]));

Self { schema, config }
Expand Down Expand Up @@ -656,9 +656,9 @@ struct InformationSchemaDfSettingsBuilder {
}

impl InformationSchemaDfSettingsBuilder {
fn add_setting(&mut self, name: impl AsRef<str>, setting: impl AsRef<str>) {
self.names.append_value(name.as_ref());
self.settings.append_value(setting.as_ref());
fn add_setting(&mut self, entry: ConfigEntry) {
self.names.append_value(entry.key);
self.settings.append_option(entry.value);
}

fn finish(&mut self) -> RecordBatch {
Expand Down
Loading

0 comments on commit 4498533

Please sign in to comment.