Hey,
we’re using a custom type in a map in a cassandra table. We query the data with
the QueryCassandra processor and try to store the result in JSON. Unfortunately
the custom type value (source in our example) is stored as string instead of an
object as expected.
Is it supposed to work in that way and if so, how can we convert that string to
a proper JSON object with Nifi?
An example looks like the following:
CREATE TYPE "dateIdTuple" (
"date" TIMESTAMP,
id TEXT
);
CREATE TABLE users (
deviceId TEXT,
source MAP<TEXT, FROZEN <"dateIdTuple">>,
PRIMARY KEY (deviceId)
);
INSERT INTO users (deviceId, source) VALUES ('a1234', {"batch": {"id": 'a1234',
"date": '2017-01-06 17:46:35'}})
The JSON contains something like this:
{
"deviceid": "a1234",
"source": {
"batch": "{id:'a1234',date:1483726401000}"
}
}
And it should be like the following:
{
"deviceid": "a1234",
"source": {
"batch": {
"id": "a1234",
"date": 1483726401000
}
}
}
Any help would be appreciated ;-).
Thanks,
Seb