shaofengshi commented on a change in pull request #1134: KYLIN-4396 Close
FileReader in SaveDictStep
URL: https://github.com/apache/kylin/pull/1134#discussion_r387437755
##########
File path:
engine-mr/src/main/java/org/apache/kylin/engine/mr/streaming/SaveDictStep.java
##########
@@ -108,32 +108,32 @@ public boolean accept(Path path) {
}
});
- SequenceFile.Reader reader;
for (FileStatus file : files) {
- reader = new SequenceFile.Reader(fs, file.getPath(), conf);
- Text colName = new Text();
- Text dictInfo = new Text();
- while (reader.next(colName, dictInfo)) {
- TblColRef colRef = colRefMap.get(colName.toString());
- if (colRef == null) {
- throw new IllegalArgumentException("Invalid column
name " + colName
- + " or it need not build dictionary!");
- }
- DictionaryInfo dictionaryInfo = serializer.deserialize(new
DataInputStream(
- new ByteArrayInputStream(dictInfo.getBytes())));
-
- Dictionary dict = dictionaryInfo.getDictionaryObject();
- if (dict != null) {
- dictionaryInfo = dictManager.trySaveNewDict(dict,
dictionaryInfo);
- cubeSeg.putDictResPath(colRef,
dictionaryInfo.getResourcePath());
- if (cubeSeg.getRowkeyStats() != null) {
- cubeSeg.getRowkeyStats().add(
- new Object[] { colRef.getName(),
dict.getSize(), dict.getSizeOfId() });
+ try(SequenceFile.Reader reader = new SequenceFile.Reader(fs,
file.getPath(), conf)) {
Review comment:
The code format here is not well. Please format it...
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services