prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
15.76k stars 5.29k forks source link

Cryptic error message when I query Pinot and sum more than one metric #14277

Closed prm-dan closed 2 years ago

prm-dan commented 4 years ago

If I run the following query, it fails. The error code is at the bottom. If I remove any reference to cost, it works fine.

WITH stats AS (
  SELECT parent_id, id, SUM(clicks) AS sum_clicks, SUM(cost) AS sum_cost
  FROM pinot.default.events
  WHERE parent_id = 123
  GROUP BY parent_id, id
  ORDER BY sum(clicks)
)
SELECT stats.id, status, sum_clicks, sum_cost
FROM stats
INNER JOIN mysql.mydb.entities
ON (stats.parent_id = mysql.mydb.entities.parent_id AND stats.id = mysql.mydb.entities.id)
WHERE mysql.mydb.entities.parent_id = 123;

Query 20200322_051636_00065_p75wc failed: Unexpected response status: 500 for request to url http://192.168.0.29:8000/debug/routingTable/events, with headers {Accept=[application/json]}, full response

The console logs from the PrestoServer are pretty useless. No indication of an error.

2020-03-22T13:37:56.930-0700 INFO query-execution-145 com.facebook.presto.event.QueryMonitor TIMELINE: Query 20200322_051636_00065_p75wc :: Transaction:[cdb0b01d-d911-4b76-9ae9-6681599fbaa4] :: elapsed 116ms :: planning 56ms :: scheduling 60ms :: running 0ms :: finishing 60ms :: begin 2020-03-22T13:37:56.811-07:00 :: end 2020-03-22T13:37:56.927-07:00

prm-dan commented 4 years ago

If I remove either cost or clicks, it works fine. It still fails if I add cost sorting to the stats ORDER BY clause.

prm-dan commented 4 years ago

Debugging more, this seems to be an integration issue with Presto. It's just the stat query part that is failing. The query works when run against Pinot directly. The following query fails when I execute it against Pinot.

  SELECT parent_id, id, SUM(clicks) AS sum_clicks, SUM(cost) AS sum_cost
  FROM pinot.default.events
  WHERE parent_id = 123
  GROUP BY parent_id, id
  ORDER BY sum(clicks)
prm-dan commented 4 years ago

Ah, I'm told this is a connector issue and the Pinot team has a different one. https://apache-pinot.gitbook.io/apache-pinot-cookbook/integrations/presto

prm-dan commented 4 years ago

I added pinot.allow-multiple-aggregations=true to my pinot config and it worked.

It might be worth updating the docs and error message. https://prestodb.io/docs/current/connector/pinot.html

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had any activity in the last 2 years. If you feel that this issue is important, just comment and the stale tag will be removed; otherwise it will be closed in 7 days. This is an attempt to ensure that our open issues remain valuable and relevant so that we can keep track of what needs to be done and prioritize the right things.