-
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 3 commits
ec364e7
3bc9cd6
b78acbc
1aeaf75
0f23296
e452662
2ec9ead
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,7 +347,9 @@ public String toString() { | |
} | ||
|
||
@Override | ||
public void setBatchSize(int batchSize) {} | ||
public void setBatchSize(int batchSize) { | ||
|
||
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. Do we require the empty line? 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. Yep, we actually did for the Private Constructors as well but we were ignoring that everywhere so I deleted that check
Basically Check-style was just broken before (see my comment on this PR) and didn't work correctly on empty blocks. 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 don't suppose it's possible to make it okay to have the right curly on the line just after the method definition? 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. That is allowed, I'll change it 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. Does that allow us to turn it back on for private constructors without too much trouble? 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. You want to have it on for private constructors and I can change all the references to
Because I can do that no problem 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 that's what we do in most places isn't it? I was hoping that with this update it wouldn't be too many places to change. Probably good to update them to all be standard, right? 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. But we can do that in a separate PR if you want to keep this one small. |
||
} | ||
} | ||
|
||
/** | ||
|
@@ -377,8 +379,9 @@ public String toString() { | |
} | ||
|
||
@Override | ||
public void setBatchSize(int batchSize) {} | ||
public void setBatchSize(int batchSize) { | ||
|
||
} | ||
} | ||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,7 +267,7 @@ private static TypeDescription buildOrcProjection(Integer fieldId, Type type, bo | |
// e.g. renaming column c -> d and adding new column d | ||
String name = Optional.ofNullable(mapping.get(nestedField.fieldId())) | ||
.map(OrcField::name) | ||
.orElse(nestedField.name() + "_r" + nestedField.fieldId()); | ||
.orElseGet(() -> nestedField.name() + "_r" + nestedField.fieldId()); | ||
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. Nice that it catches these. |
||
TypeDescription childType = buildOrcProjection(nestedField.fieldId(), nestedField.type(), | ||
isRequired && nestedField.isRequired(), mapping); | ||
orcType.addField(name, childType); | ||
|
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.
This seems more general than "allowThrowsTagsForSubclasses"? Are we sure it does the same thing?
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.
It's a bit of a complicated story
checkstyle/checkstyle#7329
Long story short, the checks were basically broken in check style so they were removed and are no longer valid configs. We actually don't need to set "validateThrows" to false either since it is false by default. I just wanted to make sure we were aware that we weren't validating any throw related tags.