-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Static Analysis #1350
Update Static Analysis #1350
Changes from 1 commit
ec364e7
3bc9cd6
b78acbc
1aeaf75
0f23296
e452662
2ec9ead
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
OrElse vs OrElseGet
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,8 +143,9 @@ class Reader implements DataSourceReader, SupportsScanColumnarBatch, SupportsPus | |
} catch (IOException ioe) { | ||
LOG.warn("Failed to get Hadoop Filesystem", ioe); | ||
} | ||
Boolean localityFallback = LOCALITY_WHITELIST_FS.contains(scheme); | ||
this.localityPreferred = options.get("locality").map(Boolean::parseBoolean) | ||
.orElse(LOCALITY_WHITELIST_FS.contains(scheme)); | ||
.orElse(localityFallback); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because schema is non-final we can't just switch this to a lambda There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think actually this would actually be fine, but to make the rules happy we would have to reassign Scheme anyway so I figured we may as well just put the result in a local var There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could refactor scheme detection into a method to make scheme effectively final here. |
||
} else { | ||
this.localityPreferred = false; | ||
} | ||
|
@@ -154,10 +155,10 @@ class Reader implements DataSourceReader, SupportsScanColumnarBatch, SupportsPus | |
this.encryptionManager = encryptionManager; | ||
this.caseSensitive = caseSensitive; | ||
|
||
this.batchReadsEnabled = options.get("vectorization-enabled").map(Boolean::parseBoolean).orElse( | ||
this.batchReadsEnabled = options.get("vectorization-enabled").map(Boolean::parseBoolean).orElseGet(() -> | ||
PropertyUtil.propertyAsBoolean(table.properties(), | ||
TableProperties.PARQUET_VECTORIZATION_ENABLED, TableProperties.PARQUET_VECTORIZATION_ENABLED_DEFAULT)); | ||
this.batchSize = options.get("batch-size").map(Integer::parseInt).orElse( | ||
this.batchSize = options.get("batch-size").map(Integer::parseInt).orElseGet(() -> | ||
PropertyUtil.propertyAsInt(table.properties(), | ||
TableProperties.PARQUET_BATCH_SIZE, TableProperties.PARQUET_BATCH_SIZE_DEFAULT)); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice that it catches these.