jhorstmann commented on a change in pull request #8409:
URL: https://github.com/apache/arrow/pull/8409#discussion_r502679298
##########
File path: rust/benchmarks/src/bin/tpch.rs
##########
@@ -73,31 +79,42 @@ async fn main() -> Result<()> {
let path = opt.path.to_str().unwrap();
- match opt.file_format.as_str() {
- // dbgen creates .tbl ('|' delimited) files
- "tbl" => {
- let path = format!("{}/lineitem.tbl", path);
- let schema = lineitem_schema();
- let options = CsvReadOptions::new()
- .schema(&schema)
- .delimiter(b'|')
- .file_extension(".tbl");
- ctx.register_csv("lineitem", &path, options)?
- }
- "csv" => {
- let path = format!("{}/lineitem", path);
- let schema = lineitem_schema();
- let options =
CsvReadOptions::new().schema(&schema).has_header(true);
- ctx.register_csv("lineitem", &path, options)?
- }
- "parquet" => {
- let path = format!("{}/lineitem", path);
- ctx.register_parquet("lineitem", &path)?
- }
- other => {
- println!("Invalid file format '{}'", other);
- process::exit(-1);
- }
+ let tableprovider: Box<dyn TableProvider + Send + Sync> =
+ match opt.file_format.as_str() {
+ // dbgen creates .tbl ('|' delimited) files
+ "tbl" => {
+ let path = format!("{}/lineitem.tbl", path);
+ let schema = lineitem_schema();
+ let options = CsvReadOptions::new()
+ .schema(&schema)
+ .delimiter(b'|')
+ .file_extension(".tbl");
+
+ Box::new(CsvFile::try_new(&path, options)?)
+ }
+ "csv" => {
+ let path = format!("{}/lineitem", path);
+ let schema = lineitem_schema();
+ let options =
CsvReadOptions::new().schema(&schema).has_header(true);
+
+ Box::new(CsvFile::try_new(&path, options)?)
+ }
+ "parquet" => {
+ let path = format!("{}/lineitem", path);
+ Box::new(ParquetTable::try_new(&path)?)
+ }
+ other => {
+ println!("Invalid file format '{}'", other);
+ process::exit(-1);
+ }
+ };
+
+ if opt.load {
+ let memtable = MemTable::load(tableprovider.as_ref()).await?;
Review comment:
That's a very good idea
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]