Skip to content

Some CTE variations failing to execute #2551

@chrisvlopez

Description

@chrisvlopez

High Level Area Labels:

  • jdbc-v2

Specific Area Labels:

  • jdbc-read

Description

Similar to this ticket. Looks like more variations of CTE parsing bugs.

This looks isolated to the JDBC driver. Testing via Clickhouse Web SQL UI works just fine with these test case.

Both test cases below fail. Also note that I originally just used the SqlParser() implementation as the other ticket to help repro testing but even successfully running statements were returning isHasErrors() as true.

Steps to reproduce

  1. Run sample test cases above
  2. Observe test failure

Expected Behaviour

JDBC driver behaves the same as The Clickhouse Web SQL UI so these should be able to execute fine.

Code Example

  @Test
  public void testClickhouseErrs() throws SQLException {
    List<String> erroringQueries =
        List.of(
            "WITH 'hello' REGEXP 'h' AS result SELECT 1",
            "WITH (select 1) as a, z AS (select 2) SELECT 1"
         );

    try (Connection c = dataSource.dataSource().getConnection()) {
      for (String query : erroringQueries) {
        try (Statement statement = c.createStatement()) {
          statement.execute(query);
          var res = statement.getResultSet();

          assertNotNull(res);
          assertTrue(res.next());
        }
      }
    }
  }

Configuration

using local docker clickhouse/clickhouse-server for testing

Client Configuration

Environment

  • Cloud
  • Client version: 0.9.1
  • Language version: Java 17
  • OS: Mac

ClickHouse Server

  • ClickHouse Server version:
  • ClickHouse Server non-default settings, if any:
  • CREATE TABLE statements for tables involved:
  • Sample data for all these tables, use clickhouse-obfuscator if necessary

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions