pingcap / ossinsight

Analysis, Comparison, Trends, Rankings of Open Source Software, you can also get insight from more than 7 billion with natural language (powered by OpenAI). Follow us on Twitter: https://twitter.com/ossinsight
https://ossinsight.io/
Apache License 2.0
1.81k stars 339 forks source link

[Explorer] Execution failed for question 3b9eaf90-82ae-4296-af07-21195260c04c: which repository has the most number of issues and pull requests #1761

Open AbhinavAchha opened 5 months ago

AbhinavAchha commented 5 months ago

Hi, It's failed to execute the question 3b9eaf90-82ae-4296-af07-21195260c04c which repository has the most number of issues and pull requests (errorType = error-query-execute):

Error message

unexpected rpc resp is MPPStreamResponse

Generated SQL

SELECT
  `repo_name`,
  SUM(
    CASE
      WHEN `type` = 'IssuesEvent' THEN 1
      ELSE 0
    END
  ) + SUM(
    CASE
      WHEN `type` = 'PullRequestEvent' THEN 1
      ELSE 0
    END
  ) AS `total_issues_and_pull_requests`
FROM
  `github_events`
GROUP BY
  `repo_name`
ORDER BY
  `total_issues_and_pull_requests` DESC
LIMIT
  1
JaySon-Huang commented 5 months ago

The generated SQL cost too much memory to get the result. When I ask the same question, it generates another SQL and it can get the result successfully.

The pingcap teams will investigate whether the memory consumption of your post SQL can be optimized. Thanks for reporting it!

https://ossinsight.io/explore/?id=e28b7865-c396-4528-ac7c-7b39f577ffd8

SELECT
  `repo_name`,
  COUNT(*) AS `total_issues_and_pull_requests`
FROM
  `github_events`
WHERE
  `type` IN ('IssuesEvent', 'PullRequestEvent')
GROUP BY
  `repo_name`
ORDER BY
  `total_issues_and_pull_requests` DESC
LIMIT
  1

image