Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to improve reading speed? #123

Open
shenlei149 opened this issue Jan 8, 2025 · 0 comments
Open

How to improve reading speed? #123

shenlei149 opened this issue Jan 8, 2025 · 0 comments

Comments

@shenlei149
Copy link

We have a lot of sample data for training, and we want to use nimble to replace parquet to 1) reduce file size and 2) reduce reading cost.

If we read some columns, for instance 10% or 20% columns, nimble is much faster than parquet. But if reading all columns, VeloxReader::next cost is the same as parquet reader, but we have to convert to arrow to integrate other processing system, so the total cost is more than cost of reading parquet file.

Here is example code. Is the way I use nimble right? If not, what's the best practice?

nimble::VeloxReader veloxReader(
    *leafPool.get(),
    readFile.get(),
    read_all ? nullptr
             : std::make_shared<velox::dwio::common::ColumnSelector>(
                   std::make_shared<velox::RowType>(
                       std::move(names), std::move(types))));

ArrowArray array;
ArrowSchema schema;

velox::VectorPtr data;
auto& table_reader = veloxReader.tabletReader();
auto nstripes = table_reader.stripeCount();
for (size_t i = 0; i < nstripes; i++) {
  auto nrows = table_reader.stripeRowCount(i);

  veloxReader.next(nrows, data);

  velox::exportToArrow(data, schema);
  velox::exportToArrow(data, array, leafPool.get());

  auto arrow_array = arrow::ImportArray(&array, &schema);
  auto ok = arrow_array.status();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant