|
89 | 89 | import java.net.InetAddress;
|
90 | 90 | import java.net.UnknownHostException;
|
91 | 91 | import java.sql.Connection;
|
92 |
| -import java.sql.DatabaseMetaData; |
93 | 92 | import java.sql.PreparedStatement;
|
94 | 93 | import java.sql.ResultSet;
|
95 | 94 | import java.sql.SQLException;
|
|
98 | 97 | import java.time.LocalDate;
|
99 | 98 | import java.time.LocalDateTime;
|
100 | 99 | import java.time.ZonedDateTime;
|
101 |
| -import java.util.Collection; |
102 | 100 | import java.util.List;
|
103 | 101 | import java.util.Map;
|
104 | 102 | import java.util.Map.Entry;
|
@@ -294,25 +292,25 @@ public boolean isTopNGuaranteed(ConnectorSession session)
|
294 | 292 | return true;
|
295 | 293 | }
|
296 | 294 |
|
297 |
| - @Override |
298 |
| - public ResultSet getTables(Connection connection, Optional<String> schemaName, Optional<String> tableName) |
299 |
| - throws SQLException |
300 |
| - { |
301 |
| - // Clickhouse maps their "database" to SQL catalogs and does not have schemas |
302 |
| - DatabaseMetaData metadata = connection.getMetaData(); |
303 |
| - return metadata.getTables( |
304 |
| - schemaName.orElse(null), |
305 |
| - null, |
306 |
| - escapeObjectNameForMetadataQuery(tableName, metadata.getSearchStringEscape()).orElse(null), |
307 |
| - getTableTypes().map(types -> types.toArray(String[]::new)).orElse(null)); |
308 |
| - } |
309 |
| - |
310 |
| - @Override |
311 |
| - protected String getTableSchemaName(ResultSet resultSet) |
312 |
| - throws SQLException |
313 |
| - { |
314 |
| - return resultSet.getString("TABLE_CAT"); |
315 |
| - } |
| 295 | +// @Override |
| 296 | +// public ResultSet getTables(Connection connection, Optional<String> schemaName, Optional<String> tableName) |
| 297 | +// throws SQLException |
| 298 | +// { |
| 299 | +// // Clickhouse maps their "database" to SQL catalogs and does not have schemas |
| 300 | +// DatabaseMetaData metadata = connection.getMetaData(); |
| 301 | +// return metadata.getTables( |
| 302 | +// schemaName.orElse(null), |
| 303 | +// null, |
| 304 | +// escapeObjectNameForMetadataQuery(tableName, metadata.getSearchStringEscape()).orElse(null), |
| 305 | +// getTableTypes().map(types -> types.toArray(String[]::new)).orElse(null)); |
| 306 | +// } |
| 307 | +// |
| 308 | +// @Override |
| 309 | +// protected String getTableSchemaName(ResultSet resultSet) |
| 310 | +// throws SQLException |
| 311 | +// { |
| 312 | +// return resultSet.getString("TABLE_CAT"); |
| 313 | +// } |
316 | 314 |
|
317 | 315 | private static Optional<JdbcTypeHandle> toTypeHandle(DecimalType decimalType)
|
318 | 316 | {
|
@@ -352,25 +350,25 @@ protected void copyTableSchema(ConnectorSession session, Connection connection,
|
352 | 350 | }
|
353 | 351 | }
|
354 | 352 |
|
355 |
| - @Override |
356 |
| - public Collection<String> listSchemas(Connection connection) |
357 |
| - { |
358 |
| - // for Clickhouse, we need to list catalogs instead of schemas |
359 |
| - try (ResultSet resultSet = connection.getMetaData().getCatalogs()) { |
360 |
| - ImmutableSet.Builder<String> schemaNames = ImmutableSet.builder(); |
361 |
| - while (resultSet.next()) { |
362 |
| - String schemaName = resultSet.getString("TABLE_CAT"); |
363 |
| - // skip internal schemas |
364 |
| - if (filterSchema(schemaName)) { |
365 |
| - schemaNames.add(schemaName); |
366 |
| - } |
367 |
| - } |
368 |
| - return schemaNames.build(); |
369 |
| - } |
370 |
| - catch (SQLException e) { |
371 |
| - throw new TrinoException(JDBC_ERROR, e); |
372 |
| - } |
373 |
| - } |
| 353 | +// @Override |
| 354 | +// public Collection<String> listSchemas(Connection connection) |
| 355 | +// { |
| 356 | +// // for Clickhouse, we need to list catalogs instead of schemas |
| 357 | +// try (ResultSet resultSet = connection.getMetaData().getCatalogs()) { |
| 358 | +// ImmutableSet.Builder<String> schemaNames = ImmutableSet.builder(); |
| 359 | +// while (resultSet.next()) { |
| 360 | +// String schemaName = resultSet.getString("TABLE_CAT"); |
| 361 | +// // skip internal schemas |
| 362 | +// if (filterSchema(schemaName)) { |
| 363 | +// schemaNames.add(schemaName); |
| 364 | +// } |
| 365 | +// } |
| 366 | +// return schemaNames.build(); |
| 367 | +// } |
| 368 | +// catch (SQLException e) { |
| 369 | +// throw new TrinoException(JDBC_ERROR, e); |
| 370 | +// } |
| 371 | +// } |
374 | 372 |
|
375 | 373 | @Override
|
376 | 374 | public Optional<String> getTableComment(ResultSet resultSet)
|
|
0 commit comments