Skip to content

Commit cd170a9

Browse files
committed
*: hackathon custom symbolizer
1 parent 8f3f708 commit cd170a9

File tree

5 files changed

+407
-6
lines changed

5 files changed

+407
-6
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion-cli/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ default = []
3535
backtrace = ["datafusion/backtrace"]
3636

3737
[dependencies]
38-
arrow = { workspace = true }
38+
arrow = { workspace = true, features = ["test_utils"] }
3939
async-trait = { workspace = true }
4040
aws-config = "1.5.18"
4141
aws-credential-types = "1.2.0"
@@ -52,6 +52,7 @@ datafusion = { workspace = true, features = [
5252
"unicode_expressions",
5353
"compression",
5454
] }
55+
datafusion-common = { workspace = true }
5556
dirs = "6.0.0"
5657
env_logger = { workspace = true }
5758
futures = { workspace = true }

datafusion-cli/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub const DATAFUSION_CLI_VERSION: &str = env!("CARGO_PKG_VERSION");
2626
pub mod catalog;
2727
pub mod cli_context;
2828
pub mod command;
29+
pub mod debuginfo;
2930
pub mod exec;
3031
pub mod functions;
3132
pub mod helper;
@@ -34,3 +35,4 @@ pub mod object_storage;
3435
pub mod pool_type;
3536
pub mod print_format;
3637
pub mod print_options;
38+
pub mod symbolize;

datafusion-cli/src/main.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ use datafusion::prelude::SessionContext;
2929
use datafusion_cli::catalog::DynamicObjectStoreCatalog;
3030
use datafusion_cli::functions::ParquetMetadataFunc;
3131
use datafusion_cli::{
32-
exec,
32+
debuginfo, exec,
3333
pool_type::PoolType,
3434
print_format::PrintFormat,
3535
print_options::{MaxRows, PrintOptions},
3636
DATAFUSION_CLI_VERSION,
3737
};
3838

3939
use clap::Parser;
40+
use datafusion::catalog::CatalogProviderList;
41+
use datafusion::execution::SessionStateBuilder;
42+
use datafusion_cli::symbolize::{SymbolizeOptimizerRule, SymbolizeQueryPlanner};
4043
use mimalloc::MiMalloc;
4144

4245
#[global_allocator]
@@ -170,14 +173,27 @@ async fn main_inner() -> Result<()> {
170173
let runtime_env = rt_builder.build_arc()?;
171174

172175
// enable dynamic file query
173-
let ctx = SessionContext::new_with_config_rt(session_config, runtime_env)
174-
.enable_url_table();
176+
let state = SessionStateBuilder::new()
177+
.with_config(session_config)
178+
.with_runtime_env(runtime_env)
179+
.with_default_features()
180+
.with_query_planner(Arc::new(SymbolizeQueryPlanner {}))
181+
.with_optimizer_rule(Arc::new(SymbolizeOptimizerRule {}))
182+
.build();
183+
let ctx = SessionContext::new_with_state(state).enable_url_table();
175184
ctx.refresh_catalogs().await?;
176185
// install dynamic catalog provider that can register required object stores
177-
ctx.register_catalog_list(Arc::new(DynamicObjectStoreCatalog::new(
186+
println!("catalog list {:?}", ctx.state().catalog_list());
187+
let dynamic_catalog = Arc::new(DynamicObjectStoreCatalog::new(
178188
ctx.state().catalog_list().clone(),
179189
ctx.state_weak_ref(),
180-
)));
190+
));
191+
dynamic_catalog.register_catalog(
192+
"debuginfo".to_string(),
193+
Arc::new(debuginfo::CatalogProvider {}),
194+
);
195+
println!("dynamic catalog list {:?}", dynamic_catalog.catalog_names());
196+
ctx.register_catalog_list(dynamic_catalog);
181197
// register `parquet_metadata` table function to get metadata from parquet files
182198
ctx.register_udtf("parquet_metadata", Arc::new(ParquetMetadataFunc {}));
183199

0 commit comments

Comments
 (0)