public function executeQuery(IDruidQuery $query) { $generatedQuery = $query->generateQuery(); // "Connect and Execute query" if ($generatedQuery['queryType'] !== 'timeBoundary') { throw new \Exception('Malformed Query'); } $fakeResponse = array(0 => array("timestamp" => "2013-05-09T18:24:00.000Z", "result" => array("minTime" => "2013-05-09T18:24:00.000Z", "maxTime" => "2013-05-09T18:37:00.000Z"))); $response = $fakeResponse; $formattedResponse = $query->handleResponse($response); return $formattedResponse; }
public function executeQuery(IDruidQuery $query) { $generatedQuery = $query->generateQuery(); $client = new \Guzzle\Http\Client(); $baseUrl = 'http://' . $this->ip . ':' . $this->port; $url = $baseUrl . $this->endpoint; // Create a tweet using POST $request = $client->post($url, array("content-type" => "application/json"), json_encode($generatedQuery)); // Send the request and parse the JSON response into an array try { $response = $request->send(); } catch (\Guzzle\Http\Exception\CurlException $curlException) { throw new $curlException(); } $data = $response->json(); $formattedResponse = $query->handleResponse($data); return $formattedResponse; }