Skip to content

Conversation

@cecemei
Copy link
Contributor

@cecemei cecemei commented Jan 8, 2026

Description

  • Add numRows field to DataSegment, and use it as source of truth for numRows
  • Refactor DataSegment construction to use builder pattern for better maintainability
  • Update SegmentMetadataQueryRunnerFactory to use SegmentReference instead of just segment

Key Changes

  • DataSegment
  • DataSegmentWithLocationTest
  • LoadableDataSegmentTest

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@github-actions github-actions bot added Area - Batch Ingestion Area - Querying Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Jan 8, 2026
if (null != availableSegmentMetadata) {
numRows = availableSegmentMetadata.getNumRows();
}
numRows = availableSegmentMetadata == null ? null : availableSegmentMetadata.getNumRows();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
AvailableSegmentMetadata.getNumRows
should be avoided because it has been deprecated.
// In that case, we should use {@code numRows} from the segment polled from the coordinator.
numRows = val.getNumRows();
} else if (availableSegmentMetadata != null) {
numRows = availableSegmentMetadata.getNumRows();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
AvailableSegmentMetadata.getNumRows
should be avoided because it has been deprecated.
(long) segment.getShardSpec().getPartitionNum(),
val.getNumReplicas(),
val.getNumRows(),
segment.getNumRows() != null ? segment.getNumRows() : val.getNumRows(),

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
AvailableSegmentMetadata.getNumRows
should be avoided because it has been deprecated.
@cecemei cecemei marked this pull request as ready for review January 9, 2026 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 Area - Querying Area - Segment Format and Ser/De

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant