Docs: Changing java api quickstart to use recommended no-arg constructor#3253
Docs: Changing java api quickstart to use recommended no-arg constructor#3253rdblue merged 2 commits intoapache:masterfrom samredai:javaquickstart
Conversation
| properties.put("warehouse", "..."); | ||
| properties.put("uri", "..."); | ||
|
|
||
| catalog.initialize("hive", properties); |
There was a problem hiding this comment.
We know that this currently fails in 0.12.0 because it doesn't pass Configuration right?
There was a problem hiding this comment.
Yes it currently fails but I think it's isolated to just if toString() is called which is hard to get around when using a REPL. The failure actually happens earlier than initialize() and seems to happen right at construction. (I'm going to try and confirm that last part)
There was a problem hiding this comment.
Confirmed that initialize is guaranteed to fail without a conf, updating this soon...
site/docs/java-api-quickstart.md
Outdated
| catalog.initialize("hive", properties); | ||
| ``` | ||
|
|
||
| Alternatively, you can configure the Hive Catalog using Spark's Hadoop configuration. |
There was a problem hiding this comment.
I wouldn't say that adding the conf is an alternative because that implies that you don't need to pass the catalog properties. Catalog properties are separate config so you should always pass them to configure the catalog. The Hive connection URI and warehouse location are defaulted for Hive, but that's not a normal thing. Other catalogs pretty much ignore the Configuration except to load a Hadoop FileSystem internally.
There was a problem hiding this comment.
Ah I see! I missed that part but it makes total sense, I'll update this.
| The Hive catalog connects to a Hive MetaStore to keep track of Iceberg tables. This example uses Spark's Hadoop configuration to get a Hive catalog: | ||
| The Hive catalog connects to a Hive MetaStore to keep track of Iceberg tables. | ||
| You can initialize a Hive Catalog with a name and some properties. | ||
| (see: [Catalog properties](https://iceberg.apache.org/configuration/#catalog-properties)) |
There was a problem hiding this comment.
Should we call out that initialize will currently fail unless setConf is called first?
There was a problem hiding this comment.
Done! Added a note right before the code snippet:
**note:** Currently, `setConf` is always required for hive catalogs, but this will change in the future.|
Thanks, @samredai! |
This is tied to #3235 and updates the Java Quickstart to use the recommended constructor (instead of the deprecated one). The logic in the quickstart is also dependent on a NPE fix recently merged in.