Is there a way to overwrite the last day of data u...
# troubleshooting
s
Is there a way to overwrite the last day of data using MSQ semantics? I tried this:
REPLACE INTO "test-ds" OVERWRITE WHERE __time >= CURRENT_TIMESTAMP - INTERVAL '1' DAY
but it gave the following error:
Copy code
Invalid OVERWRITE WHERE clause [`__time` >= CURRENT_TIMESTAMP - INTERVAL '1' DAY]: Cannot get a timestamp from sql expression [CURRENT_TIMESTAMP - INTERVAL '1' DAY]
a
Yeah, MSQ requires specific time ranges and no other expressions are currently allowed besides `OVERWRITE WHERE __time >= TIMESTAMP '<lower bound>' AND __time < TIMESTAMP '<upper bound>'`: https://druid.apache.org/docs/latest/multi-stage-query/reference/#replace-specific-time-ranges
s
@Abhishek Balaji Radhakrishnan Thanks for confirming. So that means there is no way to run MSQ with
dropExisting
as false correct?
a
That's right,
dropExisting
applies to native batch. If you want to overwrite data, I'm curious why would you want to drop existing data? Also, fwiw, the
INSERT
statement would append to existing data if that's the behavior you want.
s
I'm trying to overwrite existing data only for the intervals present in the input data. The challenge is that I can't hardcode intervals in the ingestion spec but i do know it is always the last x days of data. If I use
overwrite all
it replaces all the data outside of my ingested interval with tombstones.