Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class ClickHouseStatementImpl implements ClickHouseStatement {
*/
private final String initialDatabase;

private static final String[] selectKeywords = new String[]{"SELECT", "WITH", "SHOW", "DESC", "EXISTS"};
private static final String[] selectKeywords = new String[]{"SELECT", "WITH", "SHOW", "DESC", "EXISTS", "EXPLAIN"};
private static final String databaseKeyword = "CREATE DATABASE";

public ClickHouseStatementImpl(CloseableHttpClient client, ClickHouseConnection connection,
Expand Down Expand Up @@ -845,6 +845,7 @@ void sendStream(Writer writer, HttpEntity content) throws ClickHouseException {
content = applyRequestBodyCompression(content);

HttpPost httpPost = new HttpPost(uri);

httpPost.setEntity(content);
HttpResponse response = client.execute(httpPost);
entity = response.getEntity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ public void testIsSelect() {
assertFalse(ClickHouseStatementImpl.isSelect("/*"));
assertFalse(ClickHouseStatementImpl.isSelect("/**/"));
assertFalse(ClickHouseStatementImpl.isSelect(" --"));
assertTrue(ClickHouseStatementImpl.isSelect("explain select 42"));
assertTrue(ClickHouseStatementImpl.isSelect("EXPLAIN select 42"));
assertFalse(ClickHouseStatementImpl.isSelect("--EXPLAIN select 42\n alter"));
assertTrue(ClickHouseStatementImpl.isSelect("--\nEXPLAIN select 42"));
assertTrue(ClickHouseStatementImpl.isSelect("/*test*/ EXPLAIN select 42"));
}

}