Murtadha Hubail has posted comments on this change. Change subject: Introduced Local Filesystem Feed Adapter ......................................................................
Patch Set 3: (13 comments) Minor comments and few suggestions. https://asterix-gerrit.ics.uci.edu/#/c/376/3/asterix-external-data/src/main/java/org/apache/asterix/external/adapter/factory/LocalFileSystemFeedAdapterFactory.java File asterix-external-data/src/main/java/org/apache/asterix/external/adapter/factory/LocalFileSystemFeedAdapterFactory.java: Line 70: this.expression = (String) configuration.get(AsterixTupleParserFactory.KEY_EXPRESSION); Unnecessary cast. Line 71: String[] splits = ((String) configuration.get(AsterixTupleParserFactory.KEY_PATH)).split(","); Unnecessary cast. Line 77: private void configureFileSplits(String[] splits) throws AsterixException { Suggestion: This method could be factored out with NCFileSystemAdapterFactory. Something like: static FileSplit[] NCLocalFileSystemUtil.validateAndGetFileSplits(String[] splits). This will unify the external file path pattern checking as well. https://asterix-gerrit.ics.uci.edu/#/c/376/3/asterix-external-data/src/main/java/org/apache/asterix/external/adapter/factory/NCFileSystemAdapterFactory.java File asterix-external-data/src/main/java/org/apache/asterix/external/adapter/factory/NCFileSystemAdapterFactory.java: Line 75: this.expression = (String) configuration.get(AsterixTupleParserFactory.KEY_EXPRESSION); Unnecessary cast. Line 76: String[] splits = ((String) configuration.get(AsterixTupleParserFactory.KEY_PATH)).split(","); Unnecessary cast. https://asterix-gerrit.ics.uci.edu/#/c/376/3/asterix-external-data/src/main/java/org/apache/asterix/external/dataset/adapter/FileSystemWatcher.java File asterix-external-data/src/main/java/org/apache/asterix/external/dataset/adapter/FileSystemWatcher.java: Line 39: import org.apache.log4j.Level; Use Java Logger. Line 159: if (expression != null || Pattern.matches(expression, child.toString())) { This should be (expression == null ...). You might factor it out with something like addCandidateFile() with the code in registerAll. Line 165: LOGGER.warn(e.getMessage() + ":" + e.getStackTrace()); just use e.printStackTrace. I don't think e.getStackTrace().toString() would return the same thing unless you have tested it :) Line 246: return 1 + in.skip(n - 1); A comment here would really help :) https://asterix-gerrit.ics.uci.edu/#/c/376/3/asterix-external-data/src/main/java/org/apache/asterix/external/dataset/adapter/NCFileSystemAdapter.java File asterix-external-data/src/main/java/org/apache/asterix/external/dataset/adapter/NCFileSystemAdapter.java: Line 80: throw new IOException("Resource doesn't exist"); Would be nice to add the resource path to the exception message. Line 92: */ Suggestion: you are using recursion here and walkFileTree in FileSystemWatcher. You could probably factor out the code here and there. https://asterix-gerrit.ics.uci.edu/#/c/376/3/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java File asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java: Line 319: String[] builtInAdapterClassNames = new String[] { All of these need to be changed to dynamic class names. e.g. LocalFileSystemFeedAdapterFactory.class.getName(). Otherwise refactoring a class or a package name would break this. https://asterix-gerrit.ics.uci.edu/#/c/376/3/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/file/AsterixTupleParserFactory.java File asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/file/AsterixTupleParserFactory.java: Line 68: public static final Object KEY_EXPRESSION = "expression"; All configs are using Map<String, String>. Just keep using the wrong thing :) -- To view, visit https://asterix-gerrit.ics.uci.edu/376 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: I707756e3b4c9ffca4b55ec9817a08e5c16333010 Gerrit-PatchSet: 3 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: abdullah alamoudi <[email protected]> Gerrit-Reviewer: Ian Maxon <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Steven Jacobs <[email protected]> Gerrit-Reviewer: abdullah alamoudi <[email protected]> Gerrit-HasComments: Yes
