Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions datafusion-postgres-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ use datafusion::execution::options::{
};
use datafusion::prelude::{SessionConfig, SessionContext};
use datafusion_postgres::pg_catalog::setup_pg_catalog;
use datafusion_postgres::{serve, ServerOptions}; // Assuming the crate name is `datafusion_postgres`
use datafusion_postgres::{serve, ServerOptions};
use env_logger::Env;
use log::info;
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
Expand Down Expand Up @@ -129,7 +131,7 @@ async fn setup_session_context(
.register_csv(table_name, table_path, CsvReadOptions::default())
.await
.map_err(|e| format!("Failed to register CSV table '{table_name}': {e}"))?;
println!("Loaded {table_path} as table {table_name}");
info!("Loaded {table_path} as table {table_name}");
}

// Register JSON tables
Expand All @@ -138,7 +140,7 @@ async fn setup_session_context(
.register_json(table_name, table_path, NdJsonReadOptions::default())
.await
.map_err(|e| format!("Failed to register JSON table '{table_name}': {e}"))?;
println!("Loaded {table_path} as table {table_name}");
info!("Loaded {table_path} as table {table_name}");
}

// Register Arrow tables
Expand All @@ -151,7 +153,7 @@ async fn setup_session_context(
.register_arrow(table_name, table_path, ArrowReadOptions::default())
.await
.map_err(|e| format!("Failed to register Arrow table '{table_name}': {e}"))?;
println!("Loaded {table_path} as table {table_name}");
info!("Loaded {table_path} as table {table_name}");
}

// Register Parquet tables
Expand All @@ -164,7 +166,7 @@ async fn setup_session_context(
.register_parquet(table_name, table_path, ParquetReadOptions::default())
.await
.map_err(|e| format!("Failed to register Parquet table '{table_name}': {e}"))?;
println!("Loaded {table_path} as table {table_name}");
info!("Loaded {table_path} as table {table_name}");
}

// Register Avro tables
Expand All @@ -173,7 +175,7 @@ async fn setup_session_context(
.register_avro(table_name, table_path, AvroReadOptions::default())
.await
.map_err(|e| format!("Failed to register Avro table '{table_name}': {e}"))?;
println!("Loaded {table_path} as table {table_name}");
info!("Loaded {table_path} as table {table_name}");
}

// Register pg_catalog
Expand All @@ -184,7 +186,10 @@ async fn setup_session_context(

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::init();
env_logger::Builder::from_env(
Env::default().default_filter_or("datafusion_postgres=info,,datafusion_postgres_cli=info"),
)
.init();

let mut opts = Opt::from_args();
opts.include_directory_files()?;
Expand Down
2 changes: 1 addition & 1 deletion datafusion-postgres/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::auth::AuthManager;
use handlers::HandlerFactory;
pub use handlers::{DfSessionService, Parser};

#[derive(Getters, Setters, WithSetters)]
#[derive(Getters, Setters, WithSetters, Debug)]
#[getset(get = "pub", set = "pub", set_with = "pub")]
pub struct ServerOptions {
host: String,
Expand Down
Loading