-
Notifications
You must be signed in to change notification settings - Fork 618
Made mapping for all known table engines to a table types in JDBC #2737
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
base: main
Are you sure you want to change the base?
Conversation
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
JDBC V1 CoverageCoverage Report
Class Coverage
|
Client V1 CoverageCoverage Report
Class Coverage
|
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Outdated
Show resolved
Hide resolved
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Show resolved
Hide resolved
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Outdated
Show resolved
Hide resolved
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Show resolved
Hide resolved
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| /** | ||
| * Converts engine name to table type. Returns TABLE as default for unknown engines. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns TABLE as default for unknown engines.
if a user is trying to write use an unknown/undefined table engine, shouldn't the client throw an exception and prevent this behavior? Otherwise, their query will fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users of older JDBC versions should be able to work with newer servers. Having unknown engine mapped to TABLE let user see them.
Showing error results blocking them until upgrade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
understood - can you add this to the comment please?
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Outdated
Show resolved
Hide resolved
| if (engine == null) { | ||
| return TableType.TABLE.getTypeName(); | ||
| } | ||
| // Check for system tables (engines starting with "System" or "Async") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's an example of a table engine that starts with System or Async? I don't see any here: https://clickhouse.com/docs/engines/table-engines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not listed but present in system database. Here are some.
SELECT
name,
database,
engine
FROM system.tables
WHERE startsWith(engine, 'System') OR startsWith(engine, 'Async')
Query id: da51240b-613a-4d2a-84b1-163298e2ad69
┌─name───────────────────────────┬─database─┬─engine─────────────────────────────┐
1. │ aggregate_function_combinators │ system │ SystemAggregateFunctionCombinators │
2. │ asynchronous_inserts │ system │ SystemAsynchronousInserts │
3. │ asynchronous_loader │ system │ SystemAsyncLoader │
4. │ asynchronous_metrics │ system │ SystemAsynchronousMetrics │
5. │ azure_queue │ system │ SystemAzureQueue │
6. │ azure_queue_settings │ system │ SystemAzureQueueSettings │
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Outdated
Show resolved
Hide resolved
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Outdated
Show resolved
Hide resolved
kurnoolsaketh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some things to address
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Show resolved
Hide resolved
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Outdated
Show resolved
Hide resolved
kurnoolsaketh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some things to address
…lumn name with constant
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Outdated
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Show resolved
Hide resolved
|
the security issue will be addressed in #2739 |


Summary
Closes #2664
Checklist
Delete items not relevant to your PR:
Note
Medium Risk
Changes
DatabaseMetaDataImpl.getTables()filtering andTABLE_TYPEderivation based on engine/temporary/system rules, which can affect how clients discover objects; coverage is improved with new integration tests.Overview
Improves JDBC v2 table type reporting by adding
MATERIALIZED VIEWand introducing an explicitENGINE_TO_TABLE_TYPEmapping sogetTables()classifies ClickHouse objects by engine (including many remote/external engines) instead of a small set of heuristics.getTables()now uses prepared statements, builds an engine-based filter for the requested JDBC table types (including defaulting unknown engines toTABLE, special-casingSystem*/Async*, and handling temporary tables), and post-processes results via a mutator to return the final JDBCTABLE_TYPE.getTableTypes()is also parameterized and backed by the enum-derived list.Adds integration tests to validate type lists, per-type filtering behavior across representative objects (table/view/materialized view/dictionary/remote/system), and a guard test ensuring all engines in
system.table_enginesare mapped (or covered by the system/async prefix rule). Updates the performance module to use Testcontainers2.0.2and the renamedtestcontainers-clickhouseartifact.Written by Cursor Bugbot for commit 6eeaf08. This will update automatically on new commits. Configure here.