Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Interface - HEAD request - return different result based on input format #40714

Open
mikeTWC1984 opened this issue Aug 28, 2022 · 1 comment

Comments

@mikeTWC1984
Copy link

I'm experimenting with NiFi, trying to use HTTP to insert data into clickhouse. Some of it processors invoke HEAD request before POST, and turns out response may vary based on data type. JSONEachRow works just fine, although other formats may return 400 or 500 error code. Neither the less, POST itself work for all types and data get inserted. Does it look normal? Below are some samples

root@9de3b6a16ec0:/# curl -I 'http://172.17.0.3:8123/?query=INSERT%20INTO%20test%20FORMAT%20CSV'
HTTP/1.1 200 OK
Date: Sun, 28 Aug 2022 01:37:00 GMT
Connection: Keep-Alive
Content-Type: text/plain; charset=UTF-8
X-ClickHouse-Server-Display-Name: 9de3b6a16ec0
Transfer-Encoding: chunked
Keep-Alive: timeout=3

root@9de3b6a16ec0:/# curl -I 'http://172.17.0.3:8123/?query=INSERT%20INTO%20test%20FORMAT%20Avro'
HTTP/1.1 500 Internal Server Error
Date: Sun, 28 Aug 2022 01:37:24 GMT
Connection: Keep-Alive
Content-Type: text/plain; charset=UTF-8
X-ClickHouse-Server-Display-Name: 9de3b6a16ec0
Transfer-Encoding: chunked
X-ClickHouse-Exception-Code: 1001
Keep-Alive: timeout=3

root@9de3b6a16ec0:/# curl -I 'http://172.17.0.3:8123/?query=INSERT%20INTO%20test%20FORMAT%20Parquet'
HTTP/1.1 400 Bad Request
Date: Sun, 28 Aug 2022 01:48:08 GMT
Connection: Keep-Alive
Content-Type: text/plain; charset=UTF-8
X-ClickHouse-Server-Display-Name: 9de3b6a16ec0
Transfer-Encoding: chunked
X-ClickHouse-Exception-Code: 117
Keep-Alive: timeout=3

root@9de3b6a16ec0:/# curl -I 'http://172.17.0.3:8123/?query=INSERT%20INTO%20test%20FORMAT%20JSONEachRow'
HTTP/1.1 200 OK
Date: Sun, 28 Aug 2022 01:48:49 GMT
Connection: Keep-Alive
Content-Type: text/plain; charset=UTF-8
X-ClickHouse-Server-Display-Name: 9de3b6a16ec0
Transfer-Encoding: chunked
Keep-Alive: timeout=3

@mikeTWC1984 mikeTWC1984 added the question Question? label Aug 28, 2022
@DerekChia DerekChia self-assigned this Sep 2, 2022
@DerekChia
Copy link
Contributor

DerekChia commented Sep 9, 2022

Interesting observation. I have the same response as you. Ideally they should have the same response.

❯ curl -I 'http://localhost:8123/?query=INSERT%20INTO%20test%20FORMAT%20CSV'
HTTP/1.1 200 OK
Date: Fri, 09 Sep 2022 08:44:25 GMT
Connection: Keep-Alive
Content-Type: text/plain; charset=UTF-8
X-ClickHouse-Server-Display-Name: b0cb632665c5
Transfer-Encoding: chunked
Keep-Alive: timeout=3

❯ curl -I 'http://localhost:8123/?query=INSERT%20INTO%20test%20FORMAT%20Avro'
HTTP/1.1 500 Internal Server Error
Date: Fri, 09 Sep 2022 08:44:39 GMT
Connection: Keep-Alive
Content-Type: text/plain; charset=UTF-8
X-ClickHouse-Server-Display-Name: b0cb632665c5
Transfer-Encoding: chunked
X-ClickHouse-Exception-Code: 1001
Keep-Alive: timeout=3

❯ curl -I 'http://localhost:8123/?query=INSERT%20INTO%20test%20FORMAT%20Parquet'
HTTP/1.1 400 Bad Request
Date: Fri, 09 Sep 2022 08:44:54 GMT
Connection: Keep-Alive
Content-Type: text/plain; charset=UTF-8
X-ClickHouse-Server-Display-Name: b0cb632665c5
Transfer-Encoding: chunked
X-ClickHouse-Exception-Code: 117
Keep-Alive: timeout=3

❯ curl -I 'http://localhost:8123/?query=INSERT%20INTO%20test%20FORMAT%20JSONEachRow'
HTTP/1.1 200 OK
Date: Fri, 09 Sep 2022 08:45:03 GMT
Connection: Keep-Alive
Content-Type: text/plain; charset=UTF-8
X-ClickHouse-Server-Display-Name: b0cb632665c5
Transfer-Encoding: chunked
Keep-Alive: timeout=3

❯ curl -I 'http://localhost:8123/?query=INSERT%20INTO%20test%20VALUES'
HTTP/1.1 200 OK
Date: Fri, 09 Sep 2022 09:04:15 GMT
Connection: Keep-Alive
Content-Type: text/plain; charset=UTF-8
X-ClickHouse-Server-Display-Name: b0cb632665c5
Transfer-Encoding: chunked
Keep-Alive: timeout=3

@DerekChia DerekChia removed their assignment Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants