Subquery with time query does not work

I have the following query:

SELECT balance, user_id
FROM (
  SELECT LAST(balance) AS balance, user_id
  FROM interest
  WHERE time <= 1597276799999999999 AND time >= 1597104000000000000
  GROUP BY user_id, TIME(1h)
  FILL(previous)
)

This gives me

[...]
1597183200000000000 0.1     12beb1cd-f3e4-4fc6-8501-3e2c3206dc9b
1597186800000000000 0.1     12beb1cd-f3e4-4fc6-8501-3e2c3206dc9b
1597190400000000000 0.1     12beb1cd-f3e4-4fc6-8501-3e2c3206dc9b # Same as where in new query
1597194000000000000 0.1     12beb1cd-f3e4-4fc6-8501-3e2c3206dc9b
1597197600000000000 0.1     12beb1cd-f3e4-4fc6-8501-3e2c3206dc9b
1597201200000000000 0.1     12beb1cd-f3e4-4fc6-8501-3e2c3206dc9b
1597204800000000000 0.1     12beb1cd-f3e4-4fc6-8501-3e2c3206dc9b
[...]

Now I am adding another WHERE to my query

SELECT balance, user_id
FROM (
  SELECT LAST(balance) AS balance, user_id
  FROM interest
  WHERE time <= 1597276799999999999 AND time >= 1597104000000000000
  GROUP BY user_id, TIME(1h)
  FILL(previous)
)
WHERE time >= 1597190400000000000

But the result is empty. Shouldn’t the new WHERE apply to the subquery results?

Hello @SimonHausdorf,
Welcome!
Thank you for your question. This looks like a bug. Can you please file an issue?
Also, I highly recommend that you check out Flux. It has a steep learning curve, but it’s functionally impressive. I find it so much easier to use now.