Skip to content

Conversation

@ghalliday
Copy link
Member

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

Copilot AI review requested due to automatic review settings November 28, 2025 15:07
@github-actions
Copy link

Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-35431

Jirabot Action Result:
Assigning user: [email protected]
Workflow Transition To: Merge Pending
Updated PR

Copilot finished reviewing on behalf of ghalliday November 28, 2025 15:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a performance optimization to avoid using accessor classes when generating comparison functions in the ECL compiler. Row accessor classes pre-calculate offsets for all fields in a record, but comparison functions often terminate early before accessing all fields, making this pre-calculation wasteful. The change adds a delayOffsetCalculation parameter to bindTableCursor methods that, when set to true, bypasses accessor class creation.

  • Adds delayOffsetCalculation parameter to bindTableCursor methods to control accessor class usage
  • Applies optimization to buildReturnOrder function which generates comparison methods
  • Updates inline wrapper functions to maintain backward compatibility with default false value

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
ecl/hqlcpp/hqlcpp.ipp Adds avoidAccessor parameter (default false) to bindTableCursor method declarations and updates inline wrapper functions to pass the parameter
ecl/hqlcpp/hqlhtcpp.cpp Implements delayOffsetCalculation parameter in bindTableCursor methods to conditionally disable accessor classes; applies optimization in buildReturnOrder for compare functions

bindTableCursor(ctx, dataset.queryDataset(), "left", no_left, selSeq);
bindTableCursor(ctx, dataset.queryDataset(), "right", no_right, selSeq);
// Avoid using accessor classes with compare functions - because it is highly likely that the
// function will terminate long before the latter fields are accessed - leaving to significantly
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Typo in comment: "leaving to" should be "leading to".

Suggested change
// function will terminate long before the latter fields are accessed - leaving to significantly
// function will terminate long before the latter fields are accessed - leading to significantly

Copilot uses AI. Check for mistakes.
Comment on lines 1104 to 1105
BoundRow * bindTableCursor(BuildCtx & ctx, IHqlExpression * dataset, const char * bound, bool isLinkCounted, node_operator no_side, IHqlExpression * selSeq, bool avoidAccessor = false);
BoundRow * bindTableCursor(BuildCtx & ctx, IHqlExpression * dataset, IHqlExpression * bound, node_operator no_side, IHqlExpression * selSeq, bool avoidAccessor = false);
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Parameter name inconsistency: The parameter is named avoidAccessor in the header but delayOffsetCalculation in the implementation (hqlhtcpp.cpp:7408, 7419). These names should match. The implementation name delayOffsetCalculation better describes what the parameter does (delays offset calculation by avoiding accessor classes), so consider updating the header to use delayOffsetCalculation instead of avoidAccessor.

Suggested change
BoundRow * bindTableCursor(BuildCtx & ctx, IHqlExpression * dataset, const char * bound, bool isLinkCounted, node_operator no_side, IHqlExpression * selSeq, bool avoidAccessor = false);
BoundRow * bindTableCursor(BuildCtx & ctx, IHqlExpression * dataset, IHqlExpression * bound, node_operator no_side, IHqlExpression * selSeq, bool avoidAccessor = false);
BoundRow * bindTableCursor(BuildCtx & ctx, IHqlExpression * dataset, const char * bound, bool isLinkCounted, node_operator no_side, IHqlExpression * selSeq, bool delayOffsetCalculation = false);
BoundRow * bindTableCursor(BuildCtx & ctx, IHqlExpression * dataset, IHqlExpression * bound, node_operator no_side, IHqlExpression * selSeq, bool delayOffsetCalculation = false);

Copilot uses AI. Check for mistakes.
{ return bindTableCursor(ctx, dataset, bound, false, no_none, NULL, false); }
inline BoundRow * bindTableCursor(BuildCtx & ctx, IHqlExpression * dataset, IHqlExpression * bound)
{ return bindTableCursor(ctx, dataset, bound, no_none, NULL); }
{ return bindTableCursor(ctx, dataset, bound, no_none, NULL, false); }
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Minor formatting inconsistency: There is an extra space after bound, (two spaces instead of one). Should be bound, no_none to match the formatting of the other inline functions.

Suggested change
{ return bindTableCursor(ctx, dataset, bound, no_none, NULL, false); }
{ return bindTableCursor(ctx, dataset, bound, no_none, NULL, false); }

Copilot uses AI. Check for mistakes.
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.

1 participant