Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d1703cc
fixes CTE parsing issue and using table as alias
chernser Sep 10, 2025
1f30b73
Merge branch 'main' into jdbc_fix_cte_parse
chernser Sep 25, 2025
e9fe471
Merge branch 'main' into jdbc_fix_cte_parse
chernser Sep 28, 2025
9f4aa7a
Added more tests
chernser Oct 1, 2025
2113b87
filled test statements
chernser Oct 3, 2025
3a96804
moved parser to separate package to track coverage
chernser Oct 3, 2025
25cca50
fixed show statement tests
chernser Oct 6, 2025
6f7e415
Fixed statements with result set and several other
chernser Oct 7, 2025
b2d2399
fixed GRANT stmts and added REVOKE statements
chernser Oct 7, 2025
dfc938c
fixed more statement tests
chernser Oct 7, 2025
aefc7c9
added MOVE and UNDROP statements
chernser Oct 7, 2025
4efa2c1
Fixed quota statements
chernser Oct 7, 2025
25549e7
Fixed insert statements
chernser Oct 7, 2025
f9dd217
Fixed CTE and some minor bugs
chernser Oct 9, 2025
8db01eb
fixed CTE arguments positioning and fixed add column expression
chernser Oct 14, 2025
07eac76
fixed more statements
chernser Oct 14, 2025
0f04adf
fixed column position in alter statement and renamed QUERY to JDBC_PA…
chernser Oct 15, 2025
3e18522
created a SQL parser facade to implement SQL parser selection
chernser Oct 16, 2025
9cb7738
implemented antlr4 two variants
chernser Oct 17, 2025
0cbf958
Fixed issue with # comments
chernser Oct 17, 2025
505272d
Added javaCC parser implementation. not a default. some tests failing
chernser Oct 20, 2025
fdfc35b
Fixed javacc to support single line comments and some new statements
chernser Oct 22, 2025
f02382f
Fixed some keyword issues
chernser Oct 24, 2025
6372e4e
Fixed some more antlr4 issues
chernser Oct 25, 2025
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 @@ -20,13 +20,13 @@

import com.clickhouse.client.ClickHouseConfig;

public class ClickHouseSqlParserTest {
public class ClickHouseSqlParserFacadeTest {
private ClickHouseSqlStatement[] parse(String sql) {
return ClickHouseSqlParser.parse(sql, new ClickHouseConfig());
}

private String loadSql(String file) {
InputStream inputStream = ClickHouseSqlParserTest.class.getResourceAsStream("/sqls/" + file);
InputStream inputStream = ClickHouseSqlParserFacadeTest.class.getResourceAsStream("/sqls/" + file);

StringBuilder sql = new StringBuilder();
try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.io.IOException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.Period;
Expand Down Expand Up @@ -539,6 +540,9 @@ public void testDynamicWithPrimitives() throws Exception {
case Decimal128:
case Decimal256:
BigDecimal tmpDec = row.getBigDecimal("field").stripTrailingZeros();
if (tmpDec.divide((BigDecimal)value, RoundingMode.FLOOR).equals(BigDecimal.ONE)) {
continue;
}
strValue = tmpDec.toPlainString();
break;
case IntervalMicrosecond:
Expand Down Expand Up @@ -739,7 +743,7 @@ public void testTime64() throws Exception {
return; // time64 was introduced in 25.6
}

String table = "test_time64_type";
String table = "data_type_tests_time64";
client.execute("DROP TABLE IF EXISTS " + table).get();
client.execute(tableDefinition(table, "o_num UInt32", "t_sec Time64(0)", "t_ms Time64(3)", "t_us Time64(6)", "t_ns Time64(9)"),
(CommandSettings) new CommandSettings().serverSetting("allow_experimental_time_time64_type", "1")).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2146,7 +2146,7 @@ public void testGetDynamicValue() throws Exception {
} else if (decision == 1) {
return rnd.nextInt();
} else {
return rnd.nextDouble();
return rnd.nextLong();
}
}), 1000);

Expand Down
24 changes: 23 additions & 1 deletion jdbc-v2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<url>https://github.com/ClickHouse/clickhouse-java/tree/main/jdbc-v2</url>

<properties>
<javacc-plugin.version>4.1.4</javacc-plugin.version>
<javacc-plugin.version>5.0.0</javacc-plugin.version>
<spec.title>JDBC</spec.title>
<spec.version>4.2</spec.version>
<jackson.version>2.17.2</jackson.version>
Expand Down Expand Up @@ -180,6 +180,28 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.helger.maven</groupId>
<artifactId>ph-javacc-maven-plugin</artifactId>
<version>${javacc-plugin.version}</version>
<executions>
<execution>
<id>jjc</id>
<phase>generate-sources</phase>
<goals>
<goal>javacc</goal>
</goals>
<configuration>
<jdkVersion>${minJdk}</jdkVersion>
<javadocFriendlyComments>true</javadocFriendlyComments>
<packageName>com.clickhouse.jdbc.internal.parser.javacc</packageName>
<sourceDirectory>src/main/javacc</sourceDirectory>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>
Loading
Loading