JdbcCatalog fails to initialize with MS SQL Server
- Dominant language
- Java
- Stars
- 9.2k
- Forks
- 3.5k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 132
Description
### Apache Iceberg version
1.5.0 (latest release)
### Query engine
None
### Please describe the bug 🐞
Attempting to use MS SQL Server as JdbcCatalog produces the following:
```
Exception in thread "main" org.apache.iceberg.jdbc.UncheckedSQLException: Cannot check and eventually update SQL schema
at org.apache.iceberg.jdbc.JdbcCatalog.updateSchemaIfRequired(JdbcCatalog.java:238)
at org.apache.iceberg.jdbc.JdbcCatalog.initialize(JdbcCatalog.java:144)
at org.apache.iceberg.CatalogUtil.loadCatalog(CatalogUtil.java:255)
at org.apache.iceberg.CatalogUtil.buildIcebergCatalog(CatalogUtil.java:309)
at org.apache.iceberg.rest.RESTCatalogServer.backendCatalog(RESTCatalogServer.java:84)
at org.apache.iceberg.rest.RESTCatalogServer.main(RESTCatalogServer.java:88)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'COLUMN'.
```
I believe this is due to changes in https://github.com/apache/iceberg/pull/9487 which introduced the failing `ADD COLUMN` statement.
Setting `jdbc.schema-version=V0` to avoid the schema update prevents the fatal error.
Contributor guide
Research direction
Start in JdbcCatalog.java at updateSchemaIfRequired and initialize, then inspect the schema change introduced by pull request 9487, especially the ADD COLUMN statement. Compare that SQL with SQL Server's syntax and the jdbc.schema-version=V0 behavior. Done means JdbcCatalog can initialize against MS SQL Server without the schema-update syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100