简体   繁体   中英

ksql to convert a string to an array, then explode

I'm working a topic that

+-----------------------------+------------------------------------------------------------+
|_ID                          |FULLDOCUMENT                                                |
+-----------------------------+------------------------------------------------------------+
|{"_data": "8262ECB4B900008"} |{"_id": {"$oid": "61cb1968838939009c7c9399"}, "categories": |
|                             |[{"$oid": "5c9afc56e4d34677a31b2087"}, {"$oid": "5c9b0bff9b6|
|                             |5d57b5297197f"}]                                            |

The FULLDOCUMENT is described as a string

FULLDOCUMENT      | VARCHAR(STRING)

but it's actually JSON object.

Within it, I have categories as an array

"categories": [{"$oid": "5c9afc56e4d34677a31b2087"}, {"$oid": "5c9b0bff9b65d57b5297197f"}]

And I would like to use EXPLODE function to explode it to something like below

+-----------------------------+
|CATEGORIES                   |
+-----------------------------+
| 5c9afc56e4d34677a31b2087    |
| 5c9b0bff9b65d57b5297197f    |
|                             |

I have tried to use different functions from ksqldb documentation but haven't managed to convert this to array, then explode it. Thank you for any suggestions!

We already implemented the required function (JSON_ITEMS) which will be available in our next release in a few weeks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM