databendlabs / databend

𝗗𝗮𝘁𝗮, 𝗔𝗻𝗮𝗹𝘆𝘁𝗶𝗰𝘀 & 𝗔𝗜. Modern alternative to Snowflake. Cost-effective and simple for massive-scale analytics. https://databend.com
https://docs.databend.com
Other
7.85k stars 750 forks source link

bug: http query sql return none #11267

Closed wolftail closed 1 year ago

wolftail commented 1 year ago

Search before asking

Version

8.0.26-v1.1.12-nightly-f808049433399554ac2c5c67e10cdd1d1210ac3a(rust-1.70.0-nightly-2023-04-20T16:10:49.973342372Z)

What's Wrong?

use mysql client query sql " select * from stage_files where status = 0 order by created_at asc limit 200" return correct result, but invoke http handle return none. if remove "order by created_at asc" , it works right.

How to Reproduce?

No response

Are you willing to submit PR?

sundy-li commented 1 year ago

what's the create SQL of stage_files ?

invoke http handle return none

What's the result of HTTP handler, it will return a next uri.

wolftail commented 1 year ago

table desc result +------------+---------+------+---------+-------+ | Field | Type | Null | Default | Extra | +------------+---------+------+---------+-------+ | stage_name | VARCHAR | NO | "" | | | status | INT | NO | 0 | | | filename | VARCHAR | NO | "" | | | size | INT | NO | 0 | | | created_at | INT | NO | 0 | | +------------+---------+------+---------+-------+

wolftail commented 1 year ago

what's the create SQL of stage_files ?

invoke http handle return none

What's the result of HTTP handler, it will return a next uri.

return 0 results.

sundy-li commented 1 year ago

Could you paste the original response?

sundy-li commented 1 year ago

https://github.com/datafuselabs/databend/blob/d72d33c472c605d4181c5c85c5606f2b4ce3332f/docs/doc/11-integrations/00-api/00-rest.md

There is next_uri field to poll the results, if you want to have sync response, you can set wait_time_secs to a larger number.

### Overview

This handler return results in `pages` with long-polling.

1. Start with A `POST` to `/v1/query` with JSON of type `QueryRequest` which contains the SQL to execute, returns a JSON
   of type `QueryResponse`.
2. Use fields of `QueryResponse` for further processing:
    1. A `GET` to the `next_uri` returns the next `page` of query results. It returns `QueryResponse` too, processing it
       the same way until `next_uri` is null.
    2. (optional) A `GET` to the `kill_uri` to kill the query. Return empty body.
    3. (optional) A `GET` to the `stats_uri` to get stats only at once (without long-polling), return `QueryResponse`
       with empty `data` field.
BohuTANG commented 1 year ago

The relevant documentation also here: Databend REST API Overview