feat: add projected_array, projected_row, field comparator, partition… by lszskye · Pull Request #32 · apache/paimon-cpp · GitHub
Skip to content

feat: add projected_array, projected_row, field comparator, partition… - #32

Merged
leaves12138 merged 1 commit into
apache:mainfrom
lszskye:p3-7
Jun 1, 2026
Merged

feat: add projected_array, projected_row, field comparator, partition…#32
leaves12138 merged 1 commit into
apache:mainfrom
lszskye:p3-7

Conversation

@lszskye

@lszskye lszskye commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Purpose

Introduce core utility classes for row/array projection, field comparison, partition computation, and internal row helper functions.

Changes

ProjectedRow

  • An InternalRow implementation that provides a projected (column-selected and reordered) view of an underlying InternalRow

ProjectedArray

  • An InternalArray implementation that provides a projected view of an underlying InternalArray

FieldsComparator

  • Compares two InternalRow instances field-by-field based on configurable sort fields and ordering
  • Supports all Paimon data types
  • Implements Java-compatible floating-point ordering: -infinity < -0.0 < +0.0 < +infinity < NaN == NaN

BinaryRowPartitionComputer

  • Converts between partition string maps and BinaryRow representations
  • Supports all partition column types via PartitionConverter

InternalRowUtils

  • Utility functions for converting between InternalArray and std::vector<std::string> / std::vector<std::optional<std::string>>

Tests

  • BinaryRowPartitionComputerTest
  • FieldsComparatorTest
  • InternalRowUtilsTest
  • ProjectedRowTest
  • ProjectedArrayTest

@leaves12138 leaves12138 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one correctness blocker in FieldsComparator: the FLOAT and DOUBLE comparators use plain == and <, even though CompareFloatingPoint() is already defined for Java-compatible ordering. This makes comparisons with NaN non-antisymmetric (for example, both 1.0 <=> NaN and NaN <=> 1.0 return 1), and it also treats -0.0 and +0.0 as equal despite the intended ordering documented in CompareFloatingPoint. Please route both float and double comparisons through CompareFloatingPoint() and add tests for NaN / signed-zero cases. I did not find other blockers in this pass.

@leaves12138 leaves12138 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed with the clarified intended semantics. The previous blocker I raised was incorrect: FieldsComparator is intended to use PK comparator semantics where -0.0 and +0.0 compare equal and NaN is treated as equal to +infinity, while CompareFloatingPoint is for range index / SST key ordering. With that distinction, I do not find blockers in this pass.

@leaves12138
leaves12138 merged commit 481bb3b into apache:main Jun 1, 2026
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

Successfully merging this pull request may close these issues.

2 participants