Skip to content

Method from JDK 10 not found while using clickhouse-jdbc in Spark application, running on JDK 8 #2816

Closed

Description

@ejolos

Description

Hi ClickHouse team,
I'm encountered an issue using clickhouse-jdbc from Spark application, Spark 3.x run on java 8.

Steps to reproduce

  1. Create a table in ClickHouse
  2. Try read from the table using spark.read.jdbc

Error Log or Exception StackTrace

method does not exist URLDecoder.decode(String, Charset) at com.clickhouse.jdbc.internal.JdbcConfiguration#222

Expected Behaviour

Spark application executes clickhouse table reading w/out errors.

Code Example

   try {
      val ds = spark.read.jdbc("jdbc:clickhouse://<host>:8123/<db>)", "select 1 from sks_data.sks_last_event limit 1", connectionProperties)
      ds.take(1)
    } catch {
      case e: Exception => throw new Exception(s"Target entity $entityName not found, by query '$query': ${e.getMessage}")
    }

Configuration

Client Configuration

Client is a spark application connecting via clickhouse-jdbc-0.9.8,

Additional libraries besides Spark distribution Hadoop and Spark libraries:
animal-sniffer-annotations-1.17.jar
antlr4-runtime-4.9.3.jar
asm-9.7.jar
cats-core_2.13-2.0.0.jar
cats-effect_2.13-2.0.0.jar
cats-kernel_2.13-2.8.0.jar
cats-macros_2.13-2.0.0.jar
checker-qual-2.5.2.jar
circe-core_2.13-0.12.0-M3.jar
circe-generic_2.13-0.12.0-M3.jar
circe-jawn_2.13-0.12.0-M3.jar
circe-numbers_2.13-0.12.0-M3.jar
circe-parser_2.13-0.12.0-M3.jar
circe-refined_2.13-0.12.0-M3.jar
clickhouse-client-0.9.8.jar
clickhouse-data-0.9.8.jar
clickhouse-http-client-0.9.8.jar
clickhouse-jdbc-0.9.8.jar
client-v2-0.9.8.jar

commons-codec-1.15.jar
commons-compress-1.28.0.jar
commons-io-2.20.0.jar
commons-lang3-3.20.0.jar
error_prone_annotations-2.2.0.jar
failureaccess-1.0.jar
httpclient5-5.4.4.jar
httpcore5-5.3.4.jar
httpcore5-h2-5.3.4.jar
j2objc-annotations-1.1.jar
jawn-parser_2.13-0.14.2.jar
jdbc-v2-0.9.8.jar
jline-3.21.0.jar
jna-5.9.0.jar
jspecify-1.0.0.jar
jsr305-3.0.0.jar
listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
lz4-java-1.10.4.jar
paranamer-2.8.jar
refined_2.13-0.9.8.jar
RoaringBitmap-1.0.6.jar
scalaj-http_2.13-2.4.2.jar
scala-logging_2.13-3.9.5.jar
scala-xml_2.13-2.1.0.jar
shapeless_2.13-2.3.3.jar
slf4j-api-2.0.6.jar
sqltool-2.6.1-jdk8.jar

Environment

  • Hadoop 3.2.4
  • Spark 3.4.3
  • OS: ALT Linux: "Linux 5.10.156-std-def-alt0.c9f.2 Build preparation #1 SMP Fri Nov 25 21:32:34 UTC 2022 x86_64 GNU/Linux"

ClickHouse Server

  • ClickHouse Server version: 24.8.8.17
  • CREATE TABLE sks_data.sks_last_event ON CLUSTER default_cluster ( document_id String, time_control_id String, knd Nullable(String)) ENGINE = MergeTree PARTITION BY cityHash64(document_id) % 100 ORDER BY document_id SETTINGS index_granularity = 8192

Activity

  1. chernser commented on Apr 1, 2026

    @chernser
    Contributor

    @ejolos
    Thank you for reporting!

    Will look into it shortly.

  2. dolfinus commented on Apr 15, 2026

    @dolfinus
    Contributor

    Fix: #2821

  3. added this to the 0.9.9 milestone on Apr 15, 2026
  4. chernser commented on Apr 15, 2026

    @chernser
    Contributor

    Thank you, @dolfinus !

  5. ejolos commented on Apr 17, 2026

    @ejolos
    Author

    Great thank you!

    Just another note about running on Spark 3, JDK 8: spark dustribution depend on older version of guava - guava-27.0-jre.jar.
    The clickhouse-java uses just few methods from this library newer version, e.g. ImmutableMap.builder.buildKeepingLast in com.clickhouse.client.api.metadata.TableSchema (there is a user suggestion to get rid of guava at all :) )
    So clickhouse-java version 0.9.x usage still impossible on Spark 3, JDK 8 - exception due to buildKeepingLast is missing. Using newer guava as a classpath library with user's spark job is dangerous, cause Spark itself rely on older version.

    I'd like to suggest a change - incorporate a method from recent guava into clickhouse-java, this way clickhouse-java could rely/depend on guava 27 and would be capable to run on Spark 3, JDK8.
    The method to borrow is ImmutableMap#lastEntryForEachKey, the changed TableSchema is attached

    TableSchema.java

  6. chernser commented on Apr 17, 2026

    @chernser
    Contributor

    @ejolos

    Thank you for the info!
    We will look into it shortly - issue #2831.

    Have you tried shaded version with -all qualifier? This should have no clash in dependencies.

  7. ejolos commented on Apr 17, 2026

    @ejolos
    Author

    no, didn't tried shaded version before current issue 2816 has been resolved,
    will definitely try later on! (it would be 0.9.9 I understand)
    thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions