I am currently using the druid-Incubating-0.16.0 version. As mentioned in https://druid.apache.org/docs/latest/tutorials/tutorial-update-data.html tutorial link, we can use combining firehose to update and merge the data for a data source.
Step: 1 I am using the same sample data with the initial structure as
┌──────────────────────────┬──────────┬───────┬────────┐
│ __time │ animal │ count │ number │
├──────────────────────────┼──────────┼───────┼────────┤
│ 2018-01-01T01:01:00.000Z │ tiger │ 1 │ 100 │
│ 2018-01-01T03:01:00.000Z │ aardvark │ 1 │ 42 │
│ 2018-01-01T03:01:00.000Z │ giraffe │ 1 │ 14124 │
└──────────────────────────┴──────────┴───────┴────────┘
Step 2: I updated the data for tiger with {"timestamp":"2018-01-01T01:01:35Z","animal":"tiger", "number":30} with appendToExisting = false and rollUp = true and found the result
┌──────────────────────────┬──────────┬───────┬────────┐
│ __time │ animal │ count │ number │
├──────────────────────────┼──────────┼───────┼────────┤
│ 2018-01-01T01:01:00.000Z │ tiger │ 2 │ 130 │
│ 2018-01-01T03:01:00.000Z │ aardvark │ 1 │ 42 │
│ 2018-01-01T03:01:00.000Z │ giraffe │ 1 │ 14124 │
└──────────────────────────┴──────────┴───────┴────────┘
Step 3: Now i am updating giraffe with {"timestamp":"2018-01-01T03:01:35Z","animal":"giraffe", "number":30} with appendToExisting = false and rollUp = true and getting the following result
┌──────────────────────────┬──────────┬───────┬────────┐
│ __time │ animal │ count │ number │
├──────────────────────────┼──────────┼───────┼────────┤
│ 2018-01-01T01:01:00.000Z │ tiger │ 1 │ 130 │
│ 2018-01-01T03:01:00.000Z │ aardvark │ 1 │ 42 │
│ 2018-01-01T03:01:00.000Z │ giraffe │ 2 │ 14154 │
└──────────────────────────┴──────────┴───────┴────────┘
My doubt is, In step 3 the count of the tiger is getting decreased by 1 but I think it should not be changed since there are no changes in step 3 for tiger and there is no number change also
FYI, count and number are metricSpec and they are count and longSum respectively. Please clarify.
when using ingestSegment firehose with initial data like
┌──────────────────────────┬──────────┬───────┬────────┐
│ __time │ animal │ count │ number │
├──────────────────────────┼──────────┼───────┼────────┤
│ 2018-01-01T00:00:00.000Z │ aardvark │ 1 │ 9999 │
│ 2018-01-01T00:00:00.000Z │ bear │ 1 │ 111 │
│ 2018-01-01T00:00:00.000Z │ lion │ 2 │ 200 │
└──────────────────────────┴──────────┴───────┴────────┘
while adding a new data {"timestamp":"2018-01-01T03:01:35Z","animal":"giraffe", "number":30} with appendToExisting = true, i am getting
┌──────────────────────────┬──────────┬───────┬────────┐
│ __time │ animal │ count │ number │
├──────────────────────────┼──────────┼───────┼────────┤
│ 2018-01-01T00:00:00.000Z │ aardvark │ 1 │ 9999 │
│ 2018-01-01T00:00:00.000Z │ bear │ 1 │ 111 │
│ 2018-01-01T00:00:00.000Z │ lion │ 2 │ 200 │
│ 2018-01-01T00:00:00.000Z │ aardvark │ 1 │ 9999 │
│ 2018-01-01T00:00:00.000Z │ bear │ 1 │ 111 │
│ 2018-01-01T00:00:00.000Z │ giraffe │ 1 │ 30 │
│ 2018-01-01T00:00:00.000Z │ lion │ 1 │ 200 │
└──────────────────────────┴──────────┴───────┴────────┘
is it correct and expected output? why the rollup didn't happen?