Skip to content

[C++][Parquet] Minor Optimization: Optimize some counting about int16_t levels in parquet #55399

Closed

Description

@mapleFU

Describe the enhancement requested

A countIf16 can be introduced here, since when adding levels, this avoids overflow and nice to optimized.

template <typename Pred>
inline int64_t CountIf16(const int16_t* p, int64_t n, Pred pred) {
  int64_t total = 0;
  while (n > 0) {
    const int64_t len = std::min<int64_t>(n, 0xFFFF);
    uint16_t c = 0;
    for (int64_t i = 0; i < len; ++i) c += pred(p[i]) ? 1 : 0;
    total += c;
    p += len;
    n -= len;
  }
  return total;
}

Component(s)

C++, Parquet

Activity

  1. added 2 commits that reference this issue on Nov 5, 2026
  2. added 2 commits that reference this issue on Nov 5, 2026
  3. added a commit that references this issue on Nov 23, 2026
  4. added this to the 27.0.0 milestone on Nov 23, 2026
  5. pitrou commented on Nov 23, 2026

    @pitrou
    Member

    Issue resolved by pull request 55408
    #55408

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions