Accessing Arrays Inside VARIANT Columns in Apache Doris #60960
Unanswered
eqrvivek
asked this question in
A - General / Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a use case involving a VARIANT column that stores JSON with arrays of objects. For example:
{
"company": "Tech Innovations Inc.",
"departments": [
{
"name": "R&D",
"head": "Alice Johnson",
"employees": [
{"name": "John Doe", "position": "Engineer", "experience": 5},
{"name": "Jane Smith", "position": "Research Scientist", "experience": 7}
]
},
{
"name": "Marketing",
"head": "Michael Brown",
"employees": [
{"name": "Chris Lee", "position": "Marketing Specialist", "experience": 3},
{"name": "Sara Connor", "position": "Brand Manager", "experience": 6}
]
}
]
}
I want to query the first element of the departments array (or access array elements in general) directly, like I would in a normal ARRAY column: SELECT deptVariant['departments'][0] FROM dept_demo;
Problems:
I have used below queries but all return null ::
Is it possible in to access or flatten arrays inside VARIANT columns, or do I have to store them as typed ARRAY columns instead?
Beta Was this translation helpful? Give feedback.
All reactions