akune commented on code in PR #14603:
URL: https://github.com/apache/iceberg/pull/14603#discussion_r2548694301
##########
core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java:
##########
@@ -264,6 +261,71 @@ private void updateSchemaIfRequired() {
}
}
+ private boolean isOracle(Connection conn) {
+ try {
+ String databaseProductName = conn.getMetaData().getDatabaseProductName();
+ return databaseProductName != null
+ && databaseProductName.toLowerCase(Locale.ROOT).contains("oracle");
+ } catch (SQLException e) {
+ throw new UncheckedSQLException(e, "Cannot determine database product
name");
+ }
+ }
+
+ private boolean tableExists(Connection conn, String tableNamePattern) throws
SQLException {
+ DatabaseMetaData dbMeta = conn.getMetaData();
+
+ String[] tableVariants =
+ new String[] {
+ tableNamePattern,
+ tableNamePattern == null ? null :
tableNamePattern.toUpperCase(Locale.ROOT),
+ tableNamePattern == null ? null :
tableNamePattern.toLowerCase(Locale.ROOT)
+ };
+
+ for (String t : tableVariants) {
+ if (t == null) {
+ continue;
+ }
Review Comment:
Agreed, I was overthinking it here. I introduced a Null check at the
beginning of both methods and simplified them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]