This message was deleted.
# general
s
This message was deleted.
b
I believe, You should have added the select clause at the end. the regular expression is:
Copy code
REPLACE INTO <target table>
OVERWRITE WHERE __time >= TIMESTAMP '<lower bound>' AND __time < TIMESTAMP '<upper bound>'
< SELECT query >
PARTITIONED BY <time granularity>
[ CLUSTERED BY <column list> ]
a
My actual problem is not to replace but to remove
REPLACE INTO "WaterMeterTest" OVERWRITE WHERE "__time">'2022-01-01T000000' AND __time< '2022-01-02T000000' AND "content.FLOW_TEMPERATURE" = 18.1 Select * from "WaterMeterTest" i have written above query now but getting below error : Error: Plan validation failed Expressions must be of the form __time <operator> TIMESTAMP org.apache.calcite.tools.ValidationException
b
For REPLACE clause SELECT is mandatory, For this error you should add TIMESTAMP before your timestamp value.
Copy code
TIMESTAMP '<lower bound>'
But i do not think this is correct approach to delete any specific data.
a
Druid doesnot provide much to delete data
b
To delete specific records, we should use reindex along with filter and filter out specific records during reingestion.
a
can you tell how to do that?
i'm struggling to delete some records
b
a
i'm following this only for sql, they have used replace to remove records, i'm trying that only
b
This is what i ran to replace 3 records(page=Salo Toraut) from my datasource
Copy code
REPLACE INTO "wikipedia-uri"
OVERWRITE ALL
select * from "wikipedia-uri" where page <>'Salo Toraut'
PARTITIONED BY DAY
For specific time interval:
Copy code
REPLACE INTO "wikipedia-uri"
OVERWRITE WHERE ("__time" >= TIMESTAMP '2016-01-01' AND "__time" < TIMESTAMP '2017-01-01')
select * from "wikipedia-uri" where page <>'Salo Toraut'
PARTITIONED BY DAY
a
Hi, it is working, thanks a lot.
👍 1
s
one additional suggestion is to just select from the appropriate time interval in order to avoid unnecessary processing or rows that will not be in the target time interval:
Copy code
REPLACE INTO "wikipedia-uri"
OVERWRITE WHERE ("__time" >= TIMESTAMP '2016-01-01' AND "__time" < TIMESTAMP '2017-01-01')
select * from "wikipedia-uri" 
where page <>'Salo Toraut' 
AND "__time" >= TIMESTAMP '2016-01-01' AND "__time" < TIMESTAMP '2017-01-01'
PARTITIONED BY DAY
👍 1