You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by sj...@apache.org on 2016/05/17 23:09:39 UTC
[26/40] vxquery git commit: filesystem check for doc function
filesystem check for doc function
Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/dbe1afbb
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/dbe1afbb
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/dbe1afbb
Branch: refs/heads/steven/hdfs
Commit: dbe1afbbc277b75add851e70f599c2e304093a3b
Parents: e7eabe3
Author: efikalti <ka...@lab.grid.auth.gr>
Authored: Wed Aug 19 19:00:00 2015 +0300
Committer: efikalti <ka...@lab.grid.auth.gr>
Committed: Wed Aug 19 19:00:00 2015 +0300
----------------------------------------------------------------------
.../runtime/functions/util/FunctionHelper.java | 49 ++++++++++----------
1 file changed, 24 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/vxquery/blob/dbe1afbb/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
index c664cb4..9a0f48e 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
@@ -1190,33 +1190,32 @@ public class FunctionHelper {
} catch (SystemException e) {
throw new HyracksDataException(e);
}
- File file = new File(fName);
- if(file.exists())
- {
- parser.parseDocument(file, abvs);
+ if (!fName.contains("hdfs:/")) {
+ File file = new File(fName);
+ if (file.exists()) {
+ parser.parseDocument(file, abvs);
+ }
}
//else check in HDFS file system
- else
- {
- HDFSFunctions hdfs = new HDFSFunctions();
- FileSystem fs = hdfs.getFileSystem();
- if (fs != null)
- {
- Path xmlDocument = new Path(fName);
- try {
- if (fs.exists(xmlDocument))
- {
- InputStream in = fs.open(xmlDocument).getWrappedStream();
- parser.parseHDFSDocument( in, abvs);
- }
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- System.err.println(e);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- System.err.println(e);
- }
- }
+ else {
+ fName = fName.replaceAll("hdfs:/", "");
+ HDFSFunctions hdfs = new HDFSFunctions();
+ FileSystem fs = hdfs.getFileSystem();
+ if (fs != null) {
+ Path xmlDocument = new Path(fName);
+ try {
+ if (fs.exists(xmlDocument)) {
+ InputStream in = fs.open(xmlDocument).getWrappedStream();
+ parser.parseHDFSDocument(in, abvs);
+ }
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ System.err.println(e);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ System.err.println(e);
+ }
+ }
}
}