IMPALA-15278: Fix incorrect cardinality with OFFSET

OFFSET is used to skip a number of rows before returning results. When
calculating cardinality of a node that has OFFSET, the cardinality
should substract this number before applying the LIMIT.

MERGING-EXCHANGE currently does the reverse which could results in 0
cardinality when OFFSET >= LIMIT. SortNode currently ignores the offset.
This fixes both issue by adding an overload of capCardinalityAtLimit()
that has a parameter for offset. It's used in ExchangeNode and SortNode.

Tests
 - Added FE test
 - Ran PlannerTest, TpcdsCpuCostPlannerTest and
   TpcdsTupleCachePlannerTest locally.

Change-Id: I3b628beabc5c7ec6c4fdda9dff6aaf7a4acae538
Reviewed-on: http://gerrit.cloudera.org:8080/24718
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
8 files changed
tree: 6de0b657c40ecec6023a496afb52ac3bc71540e0
  1. .agents/
  2. .devcontainer/
  3. .vscode-defaults/
  4. be/
  5. bin/
  6. cmake_modules/
  7. common/
  8. docker/
  9. docs/
  10. fe/
  11. helm/
  12. infra/
  13. java/
  14. lib/
  15. operator/
  16. package/
  17. security/
  18. shell/
  19. ssh_keys/
  20. testdata/
  21. tests/
  22. www/
  23. .asf.yaml
  24. .clang-format
  25. .clang-tidy
  26. .gitattributes
  27. .gitignore
  28. .isort.cfg
  29. AGENTS.md
  30. buildall.sh
  31. CMakeLists.txt
  32. EXPORT_CONTROL.md
  33. LICENSE.txt
  34. LOGS.md
  35. NOTICE.txt
  36. README-build.md
  37. README.md
  38. SECURITY.md
  39. setup.cfg
README.md

Welcome to Impala

Lightning-fast, distributed SQL queries for petabytes of data stored in open data and table formats.

Impala is a modern, massively-distributed, massively-parallel, C++ query engine that lets you analyze, transform and combine data from a variety of data sources:

More about Impala

The fastest way to try out Impala is a quickstart Docker container. You can try out running queries and processing data sets in Impala on a single machine without installing dependencies. It can automatically load test data sets into Apache Kudu and Apache Parquet formats and you can start playing around with Apache Impala SQL within minutes.

To learn more about Impala as a user or administrator, or to try Impala, please visit the Impala homepage. Detailed documentation for administrators and users is available at Apache Impala documentation.

If you are interested in contributing to Impala as a developer, or learning more about Impala's internals and architecture, visit the Impala wiki.

Supported Platforms

Impala only supports Linux at the moment. Impala supports x86_64 and arm64 (as of Impala 4.4). Impala Requirements contains more detailed information on the minimum CPU requirements.

Supported OS Distributions

Impala runs on Linux systems only. The supported distros are

  • Ubuntu 20.04/22.04/24.04
  • Rocky/RHEL 8/9/10

Other systems, e.g. SLES15/16, may also be supported but are not tested by the community.

Export Control Notice

This distribution uses cryptographic software and may be subject to export controls. Please refer to EXPORT_CONTROL.md for more information.

Build Instructions

See Impala's developer documentation to get started.

Detailed build notes has some detailed information on the project layout and build.