i got this string representing json:
val query =
"""
{
“queries” : [ {
“queryId” : “f7436f4bdd7162d1:c1fac9fc00000000”,
“statement” : “SELECT ‘Hello World!’”,
“queryType” : “QUERY”,
“queryState” : “CREATED”,
“startTime” : “2017-08-06T18:11:50.098Z”,
“rowsProduced” : null,
“attributes” : {
“thread_storage_wait_time” : “0”,
“admission_result” : “Admitted immediately”,
“session_id” : “f745e3785d36ab82:8ca4a969df63c181”,
“planning_wait_time” : “2543”,
“oom” : “false”,
“stats_missing” : “false”,
“memory_spilled” : “0”,
“network_address” : “192.168.126.130:43005”,
“admission_wait” : “0”,
“file_formats” : “”,
“planning_wait_time_percentage” : “2”,
“client_fetch_wait_time” : “0”,
“client_fetch_wait_time_percentage” : “0”,
“pool” : “root.cloudera”,
“session_type” : “HIVESERVER2”,
“connected_user” : “cloudera”,
“thread_network_receive_wait_time” : “0”,
“thread_network_send_wait_time” : “0”,
“impala_version” : “impalad version 2.7.0-cdh5.10.0 RELEASE (build 785a073cd07e2540d521ecebb8b38161ccbd2aa2)”,
“estimated_per_node_peak_memory” : “1024”,
“query_status” : “OK”
},
“user” : “cloudera”,
“coordinator” : {
“hostId” : “quickstart.cloudera”
},
“detailsAvailable” : true,
“database” : “default”,
“durationMillis” : 135828
}],
“warnings” : [ ]
}
basicly, i got string with json of two arrays.
The Array queries is array of jsons.
I want take the queries array and convert it to array of ImpalaQuery
class ImpalaQuery(val queryId: String,startTime:Timestamp,planning_wait_time_percentage:Int) {
}
*Pay Attention attributes.planning_wait_time_percntage is int and not map.
what is the best way to do this?
Thx.