nishantmonu51 opened a new issue #10560: URL: https://github.com/apache/druid/issues/10560
### Description Noticed this on the datasources tab in druid management console. Datasources tab was not showing any data since the underlying SQL was running into java.lang.ArithmeticException divide by zero. <img width="1483" alt="Screen Shot 2020-11-06 at 12 25 34 AM" src="https://user-images.githubusercontent.com/5023786/98284502-3a2e5500-1fc7-11eb-8d9a-c714f31922fd.png"> Here is the query generated by the view - ``` SELECT datasource, COUNT(*) FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1) AS num_segments, COUNT(*) FILTER (WHERE is_available = 1 AND ((is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1)) AS num_available_segments, COUNT(*) FILTER (WHERE is_published = 1 AND is_overshadowed = 0 AND is_available = 0) AS num_segments_to_load, COUNT(*) FILTER (WHERE is_available = 1 AND NOT ((is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1)) AS num_segments_to_drop, SUM("size") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1) AS total_data_size, SUM("size" * "num_replicas") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1) AS replicated_size, MIN("size") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1) AS min_segment_size, (SUM("size") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1) / COUNT(*) FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1)) AS avg_segment_size, MAX("size") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1) AS max_segment_size, SUM("num_rows") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1) AS total_rows, (SUM("size") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1) / SUM("num_rows") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR is_realtime = 1)) AS avg_row_size FROM sys.segments GROUP BY 1 ``` Below snapshot showing total_rows reported by druid as 0 that causes the calculation of avg_row_size to break <img width="1457" alt="Screen Shot 2020-11-06 at 12 38 13 AM" src="https://user-images.githubusercontent.com/5023786/98285311-64344700-1fc8-11eb-9aec-50d68b96f428.png"> multiple issues here which could be improved - 1. Improve the UI so that the generated SQL query do not run into divide by zero issue 2. Figure out why druid is returning num_rows as zero ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
