Skip to content
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

IGNITE-24323 SQL Calcite: Add query blocking tasks executor (allows t… #11833

Closed
wants to merge 7 commits into from

Conversation

alex-plekhanov
Copy link
Contributor

…o execute SQL inside UDF)

Thank you for submitting the pull request to the Apache Ignite.

In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:

The Contribution Checklist

  • There is a single JIRA ticket related to the pull request.
  • The web-link to the pull request is attached to the JIRA ticket.
  • The JIRA ticket has the Patch Available state.
  • The pull request body describes changes that have been made.
    The description explains WHAT and WHY was made instead of HOW.
  • The pull request title is treated as the final commit message.
    The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • A reviewer has been mentioned through the JIRA comments
    (see the Maintainers list)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see TC.Bot: Check PR)

Notes

If you need any help, please email [email protected] or ask anу advice on http://asf.slack.com #ignite channel.

@alex-plekhanov alex-plekhanov force-pushed the ignite-24323 branch 5 times, most recently from d8c8b98 to 80e7f30 Compare January 28, 2025 11:39
eHnd = ctx.uncaughtExceptionHandler();

executor = new IgniteThreadPoolExecutor(
"calciteQry",
Copy link
Contributor

Choose a reason for hiding this comment

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

All other pools names starts with capital letter.
Let's call it CalciteQueryAwareExecutor and the default one CalciteExecutor.

Copy link
Contributor Author

@alex-plekhanov alex-plekhanov Jan 29, 2025

Choose a reason for hiding this comment

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

It's not a pool name, it's thread prefix. All other thread prefixes start with non-capital letters.

Comment on lines 150 to 158
for (Node pred = head, cur = pred.next; cur != null; pred = cur, cur = cur.next) {
if (!blockedQrys.contains(cur.item.queryKey())) { // Skip tasks for blocked queries.
QueryAwareTask res = cur.item;

unlink(cur, pred);

return res;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's rewite this with the while as it simplify the flow.

Suggested change
for (Node pred = head, cur = pred.next; cur != null; pred = cur, cur = cur.next) {
if (!blockedQrys.contains(cur.item.queryKey())) { // Skip tasks for blocked queries.
QueryAwareTask res = cur.item;
unlink(cur, pred);
return res;
}
}
Node pred = head;
Node cur = pred.next;
while (cur != null) {
if (!blockedQrys.contains(cur.item.queryKey())) { // Skip tasks for blocked queries.
QueryAwareTask res = cur.item;
unlink(cur, pred);
return res;
}
pred = cur;
cur = cur.next;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a matter of taste, I think there is no simplification with while


try {
for (Node pred = head, cur = pred.next; cur != null; pred = cur, cur = cur.next) {
if (task.equals(cur.item)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need equals here? Not ==?

@asfgit asfgit closed this in 405e62b Jan 30, 2025
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