Hi Puneeth,

What version of Phoenix are you using?

Indeed per [1], maxRowCount should control the number of rows returned in the ExecuteResponse. However, given that you see 100 rows (which is the default), it sounds like the value is not being respected. The most recent docs may not align with the version of code you're running.

Unless you can guarantee that you never see more than a few hundred rows, it is likely not a good idea to request all of the rows in one request (use the FetchRequest to get subsequent batches).

- Josh

[1] http://calcite.apache.org/avatica/docs/json_reference.html#prepareandexecuterequest

Puneeth Prasad wrote:
Hi,

PrepareAndExecute statement has a default limit of returning 100 rows.
To avoid that, we use maxRowCount = -1, but it still gives only 100 rows.

I've copied the PHP code below, the highlighted part is the necessary
change to fetch all the rows possible. Can you please suggest where
we've gone wrong and how to correct it? Is there something pretty
obvious we missed out here?

curl_setopt($ch, CURLOPT_URL, "http://ip.address.of.phoenix.server:8765/
<http://120.138.8.208:8765/>");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POST, 1);

$headers[] = "Request:
{\"request\":\"openConnection\",\"connectionId\":\"000000-0000-0000-00000000\"}";

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);

$headers[] = "Request:
{\"request\":\"createStatement\",\"connectionId\":\"000000-0000-0000-00000000\"}";

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);

$headers[] = "Request:
{\"request\":\"prepareAndExecute\",\"connectionId\":\"000000-0000-0000-00000000\",\"statementId\":
".$a.",\"sql\": \"SELECT * FROM TABLE_NAME\",*\"maxRowCount\":-1*}";

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);

$headers[] = "Request:
{\"request\":\"closeStatement\",\"connectionId\":\"000000-0000-0000-00000000\",\"statementId\":
1}";

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);

$headers[] = "Request:
{\"request\":\"closeConnection\",\"connectionId\":\"000000-0000-0000-00000000\"}";

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);

Thanks!

Puneeth

Reply via email to