-
Notifications
You must be signed in to change notification settings - Fork 737
don't remove DESC sorting from plan for sys view #28937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,6 +93,13 @@ TExprBase KqpRemoveRedundantSortOverReadTable(TExprBase node, TExprContext& ctx, | |
| } | ||
|
|
||
| if (direction == ESortDirection::Reverse) { | ||
| // For sys views, we need to set reverse flag even if UseSource returns false | ||
| // because sys view actors can handle reverse direction | ||
| bool isSysView = tableDesc.Metadata->Kind == EKikimrTableKind::SysView; | ||
| if (isSysView) { | ||
| return node; | ||
| } | ||
|
|
||
| if (!UseSource(kqpCtx, tableDesc) && kqpCtx.IsScanQuery()) { | ||
| return node; | ||
| } | ||
|
|
@@ -206,6 +213,13 @@ TExprBase KqpRemoveRedundantSortOverReadTableFSM( | |
| } | ||
|
|
||
| if (isReversed) { | ||
| // For sys views, we need to set reverse flag even if UseSource returns false | ||
| // because sys view actors can handle reverse direction | ||
| bool isSysView = tableDesc.Metadata->Kind == EKikimrTableKind::SysView; | ||
| if (isSysView) { | ||
|
Comment on lines
+216
to
+219
|
||
| return node; | ||
| } | ||
|
|
||
| if (!UseSource(kqpCtx, tableDesc) && kqpCtx.IsScanQuery()) { | ||
| return node; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for checking if a table is a sys view is duplicated in both
KqpRemoveRedundantSortOverReadTable(lines 96-101) andKqpRemoveRedundantSortOverReadTableFSM(lines 216-219). Consider extracting this check into a helper function to reduce code duplication and improve maintainability.