Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windowing query fails when wrapped in an outer select #16197

Open
jhbruhn opened this issue Mar 25, 2024 · 0 comments
Open

Windowing query fails when wrapped in an outer select #16197

jhbruhn opened this issue Mar 25, 2024 · 0 comments

Comments

@jhbruhn
Copy link

jhbruhn commented Mar 25, 2024

The following windowing query, which is supposed to calculate the derivative of an increasing counter, fails with this error:

Error: RUNTIME_FAILURE (OPERATOR)
Not enough capacity for even one row! Need[26] but have[0].
org.apache.druid.java.util.common.IAE
SELECT AVG("power_kw") AS "AVG(power_kw)"
FROM
  (SELECT (now_time) as "__time",
          (now_value - previous_value) / ((TIMESTAMP_TO_MILLIS("now_time") - TIMESTAMP_TO_MILLIS("previous_time")) / (60.0 * 60.0 * 1000.0)) as "power_kw"
   FROM
     (SELECT __time as "now_time",
             LAG("positive_active_energy_total_kwh") over w as previous_value,
                                                          LAG("__time") over w as previous_time,
                                                                             "positive_active_energy_total_kwh" as now_value
      FROM "offis.meter.electricity"
      GROUP BY __time,
               id,
               "positive_active_energy_total_kwh" WINDOW w AS (PARTITION BY id
                                                               ORDER BY (__time) DESC)
      ORDER BY "now_time" DESC)
   WHERE "now_value" IS NOT NULL) AS "virtual_table"

Affected Version

29.0.0

Description

The cluster consists of a simple k8s single node configuration as provided by the Druid K8s Operator. The data is a time series of an electricity meter, so the only table needed for this to work is one with a "__time" column and a positive_active_energy_total_kwh-double.

The inner two SELECTs work as a standalone query, but when wrapped in the outer SELECT (which is generated by Apache Superset), the query fails with the beforementioned error.

The log only contains the error-message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant