rdblue commented on a change in pull request #3543:
URL: https://github.com/apache/iceberg/pull/3543#discussion_r766267110
##########
File path:
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java
##########
@@ -383,14 +390,52 @@ public boolean dropNamespace(String[] namespace) throws
NoSuchNamespaceException
@Override
public final void initialize(String name, CaseInsensitiveStringMap options) {
- this.cacheEnabled =
Boolean.parseBoolean(options.getOrDefault("cache-enabled", "true"));
- Catalog catalog = buildIcebergCatalog(name, options);
+ this.cacheEnabled = PropertyUtil.propertyAsBoolean(options,
+ CatalogProperties.TABLE_CACHE_ENABLED,
CatalogProperties.TABLE_CACHE_ENABLED_DEFAULT);
+
+ // If the user disabled caching and did not set the
cache.expiration-interval-ms, we'll set it to zero for
+ // them on their behalf. If they disabled caching but explicitly set a
non-zero cache expiration
+ // interval, we will fail initialization as that's an invalid
configuration.
Review comment:
I'm not sure I agree with this. I think that an `enabled` flag is
compatible with other configuration. It is one simple config you can use to
flip on or off a feature, without altering other properties. For example, if I
were trying to debug something and I suspected caching, I'd go set this to
disabled. It would annoy me at that point if Iceberg complained that I have
caching disabled, but set a config property for it. So I'd probably override
with `cache-enabled` and ignore that the interval is set or not.
--
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]