prestodb / presto

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

Presto returning 0 results when the query contains more than 100 tables #21359

Open Din7890 opened 1 year ago

Din7890 commented 1 year ago

Presto returning 0 results when the query contains more than 100 tables. Here is the sample query

select table_name, column_name from xxxuser.information_schema.columns where xxxuser.information_schema.columns.table_schema = xxx_user' order by xxxuser.information_schema.columns.table_name; The above query returns non zero results if the number of tables are 100 or less.

Your Environment

Expected Behavior

The query should return the tables and columns from the schema specified in the query.

Current Behavior

The query returns correct results if the number of tables are less or equal to 100. If it has more than 100 tables, it returns 0 rows, and it does not throw any errors in the logs

Possible Solution

Is there any configuration change in Presto, that limits the table scans to 100?

Steps to Reproduce

  1. Create 100 tables in oracle
  2. Run the above query in presto-cli ie command line and it returns the rows
  3. Create 101 tables in oracle
  4. Run the above query in presto-cli ie commond line and it returns 0 rows

Screenshots (if appropriate)

Context

kiersten-stokes commented 1 year ago

Interesting - I'm not able to test with Oracle, but I tried PostgreSQL as it has a similar JDBC backing and couldn't reproduce. I see that you say no error message is produced. Does the query have "FINISHED" status? What does the query plan look like when using the UI?

Din7890 commented 1 year ago

The query has a "FINISHED" status

kiersten-stokes commented 1 year ago

What is the output when you run EXPLAIN ANALYZE on your query?

Have you tried any other queries on information_schema? And if so, do they succeed?

Din7890 commented 1 year ago

Here is the explain plan with 100 tables --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> Fragment 1 [ROUND_ROBIN] > CPU: 38.32ms, Scheduled: 1.11s, Input: 100 rows (2.72kB); per task: avg.: 14.29 std.dev.: 34.99, Output: 100 rows (2.72kB) > Output layout: [table_name, column_name] > Output partitioning: SINGLE [] > Stage Execution Strategy: UNGROUPED_EXECUTION >

Din7890 commented 1 year ago

Here is the explain plan with 101 tables

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> Fragment 1 [ROUND_ROBIN] > CPU: 29.20ms, Scheduled: 764.43ms, Input: 0 rows (0B); per task: avg.: 0.00 std.dev.: 0.00, Output: 0 rows (0B) > Output layout: [table_name, column_name] > Output partitioning: SINGLE [] > Stage Execution Strategy: UNGROUPED_EXECUTION >

Din7890 commented 12 months ago

I have same issue with other schemas too where if the tables are more than 100 the query returns 0 results

kiersten-stokes commented 12 months ago

So different schemas but the same Oracle connector?

Din7890 commented 12 months ago

Yes that is correct