question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Presto 0.246 returns a division by zero stacktrace

See original GitHub issue

Hi everybody,

I have upgraded Prestodb from 0.226 to 0.246, and adjusted some config parameters to adapt to the new version. My testing environment is very simple, one query coordinator and one worker node. When I try to execute a query that uses the Hive catalog, I always see the following returned:

java.lang.ArithmeticException: / by zero
	at com.facebook.presto.sql.planner.NodePartitioningManager.createArbitraryBucketToNode(NodePartitioningManager.java:256)
	at com.facebook.presto.sql.planner.NodePartitioningManager.getBucketNodeMap(NodePartitioningManager.java:189)
	at com.facebook.presto.execution.scheduler.SectionExecutionFactory.createStageScheduler(SectionExecutionFactory.java:335)
	at com.facebook.presto.execution.scheduler.SectionExecutionFactory.createStreamingLinkedStageExecutions(SectionExecutionFactory.java:243)
	at com.facebook.presto.execution.scheduler.SectionExecutionFactory.createStreamingLinkedStageExecutions(SectionExecutionFactory.java:221)
	at com.facebook.presto.execution.scheduler.SectionExecutionFactory.createSectionExecutions(SectionExecutionFactory.java:167)
	at com.facebook.presto.execution.scheduler.LegacySqlQueryScheduler.createStageExecutions(LegacySqlQueryScheduler.java:343)
	at com.facebook.presto.execution.scheduler.LegacySqlQueryScheduler.<init>(LegacySqlQueryScheduler.java:233)
	at com.facebook.presto.execution.scheduler.LegacySqlQueryScheduler.createSqlQueryScheduler(LegacySqlQueryScheduler.java:164)
	at com.facebook.presto.execution.SqlQueryExecution.planDistribution(SqlQueryExecution.java:474)
	at com.facebook.presto.execution.SqlQueryExecution.start(SqlQueryExecution.java:347)
	at com.facebook.presto.$gen.Presto_0_246_b4fb470____20210205_091342_1.run(Unknown Source)
	at com.facebook.presto.execution.SqlQueryManager.createQuery(SqlQueryManager.java:254)
	at com.facebook.presto.dispatcher.LocalDispatchQuery.lambda$startExecution$5(LocalDispatchQuery.java:114)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

The code that yields the exception seems to be doing a division indeed, but I have no idea why by zero since the worker node is correctly recognized by the coordinator (I checked in the IU as well). Can you give me more info about why this error happens?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
elukeycommented, Feb 8, 2021

@rschlussel the catalog config file properties had a typo in its filename, you were absolutely right, everything works now, thanks a lot for the help 😃

It was very difficult to figure out what was the problem though, without you I wouldn’t have had a chance to figure it out. The java division by zero stacktrace is definitely weird to see (and makes you believe that a bug is happening in the code), so if it is easy to add a friendlier message it would really be nice!

0reactions
rschlusselcommented, Feb 8, 2021

I suspect what’s happening is that the worker doesn’t know about the hive catalog. Can you double check that the file is there and in the right directory and try restarting the worker (you always need to restart after config changes, since Presto won’t pick them up automatically)? Another thing to try would be to try adding another connector (e.g. add the tpch connector https://prestodb.io/docs/current/connector/tpch.html) and see if you can query that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to avoid the "divide by zero" error in SQL? - Stack Overflow
You can use the function NULLIF to avoid division by zero. NULLIF compares two expressions and returns null if they are equal or...
Read more >
Methods to avoid the SQL divide by zero error
This article explores the SQL divide by zero error and various methods for ... If both the arguments are equal, it returns a...
Read more >
How to Handle Divide by Zero In SQL - LearnSQL.com
You can use this function to handle a potential division by zero by wrapping the denominator in a call to NULLIF . In...
Read more >
Division by zero · Issue #7509 · ClickHouse ... - GitHub
Division by zero Describe the bug or unexpected behaviour error despite the fact that the denominator is converted to null in case of...
Read more >
DivideByZeroException Class (System) - Microsoft Learn
The exception that is thrown when there is an attempt to divide an integral or Decimal value by zero.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found