drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Salil Sanghvi <salil.sang...@renianalytics.com>
Subject How to write dynamic queries in Apache Drill to query Nested JSON ...
Date Thu, 28 Feb 2019 08:35:14 GMT
Hi,

We have a requirement to query HBASE table which has single column with
nested json:
1. What will be the query to convert the JSON data  into table format.
2. Also the query should be generic enough to pick any new columns that may
vary between different json blocks.
3. In below example the 1st JSON block has attribute "taste" and second
JSON block has attribute "type", but the query should be generic enough to
return both type and taste
4. Query should be able to extract any new attribute introduced in future.

{
	"id": "0001",
	"taste": "donut",
	"name": "Cake",
	"ppu": 0.55,
	"batters":
		{
			"batter":
				[
					{ "id": "1001", "type": "Regular" },},
					{ "id": "1004", "type": "Devil's Food" }
				]
		},
	"topping":
		[
			{ "id": "5001", "type": "None" },
			{ "id": "5002", "type": "Glazed" }			
		]
}

{
	"id": "0002",
	"type": "donut",
	"name": "Cake",
	"ppu": 0.55,
	"batters":
		{
			"batter":
				[
					{ "id": "1001", "type": "Regular" },
					{ "id": "1004", "type": "Devil's Food" }
				]
		},
	"topping":
		[
			{ "id": "5001", "type": "None" },
			{ "id": "5004", "type": "Maple" }
		]
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message