Skip to content

Fetch several Parquet row groups when appropriate #234

Open

Description

@severo

See #213 (comment)

When fetching a row group, we only fetch from the first row to the last one:

const rowStart = groupEnds[groupIndex - 1] ?? 0
const rowEnd = groupEnds[groupIndex]

But, when sorting along a column with small data, it can result in many small requests, triggering a rate limit.

This issue aims at fetching several consecutive Parquet row groups at once when appropriate, reducing the number of requests while receiving larger responses.

eg: instead of 2,000 requests with 7KB responses, we prefer 200 requests with 70KB responses (possible only if enough row groups are consecutive).

Activity

  1. platypii commented on Apr 25, 2025

    @platypii
    Contributor

    Yea this has been one of the biggest sources of slowdowns especially for sorting. I've been thinking about how to modify the AsyncBuffer abstraction to better handle many small range requests.

    I think we might want something that accepts multiple ranges, like:

    interface AsyncBuffer {
      byteLegnth: number
      slice(start: number, end: number): ArrayBuffer
      slices?: (ranges: { start: number, end: number }[]) => ArrayBuffer[]
    }

    That way the hyparquet library can request many small ranges in one request. IF the request are all to the same-origin, http range request allow for multiple ranges to be specified. IF the requests are cross-origin multi-range requests are not allowed. In the latter case we can either translate it to multiple independent http requests, OR if the total size is small, combine into a single larger range request. This would provide a nice place to insert heuristics like "if total range is less than 100kb, just fetch all ranges as one request" (or whatever).

  2. severo commented on Apr 26, 2025

    @severo
    ContributorAuthor

    Oh, I discover multi-range requests. But as it's not available cross-origin, it's pretty limited.

    Do you want me to work on this, or do you prefer to handle it?

  3. platypii commented on Apr 26, 2025

    @platypii
    Contributor

    I'll take a look at making the changes in hyparquet and the AsyncBuffer abstraction.

    That won't necessarily solve the problem you mention here though. If the CLI tableProvider still requests individual row groups, but each row group is small, then hyparquet can't really help. So in that sense, maybe we do want to make changes here too. If you want to take a look at modifying this to do something like fetch multiple consecutive rowgroups IF the total size would be less than <threshhold> then I'm in favor of you trying that, especially if it solves some of the HF issues.

  4. self-assigned this
    on Apr 28, 2025
  5. severo commented on May 22, 2025

    @severo
    ContributorAuthor

    If you want to take a look at modifying this to do something like fetch multiple consecutive rowgroups IF the total size would be less than then I'm in favor of you trying that, especially if it solves some of the HF issues.

    If I understand well, hyparquet will fetch group by group anyway, ie one request per group (https://github.com/hyparam/hyparquet/blob/1ca8b4701424b95b475b01a1576978c4b5eab895/src/read.js#L45), so it would have to be implemented in hyparquet, not in hyperparam-cli.

    Please tell me @platypii if I misunderstood something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions