From 9fe17d2a1f2cd095dd2f9c1a0a61e505520ed893 Mon Sep 17 00:00:00 2001 From: Ankit Ladhania Date: Fri, 11 Mar 2016 17:57:15 +0530 Subject: [PATCH 1/3] Solved: Issue with "compileonly" flag while executing queries Issue No. : VXQUERY-139 Description : Previously executing queries with compileonly flag gave NPE, which was due to null value of IHyracksClientConnection. Solver : ankitladhania --- .gitignore | 1 + .../main/java/org/apache/vxquery/cli/VXQuery.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index fdde96af6..65263b39e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .project .settings .classpath +.idea target /ClusterControllerService/ diff --git a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java index 53b352f16..e44690476 100644 --- a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java +++ b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java @@ -240,13 +240,16 @@ private void runQueries() throws IOException, SystemException, Exception { * @throws Exception */ private String[] getNodeList() throws Exception { - Map nodeControllerInfos = hcc.getNodeControllerInfos(); - String[] nodeList = new String[nodeControllerInfos.size()]; - int index = 0; - for (String node : nodeControllerInfos.keySet()) { - nodeList[index++] = node; + if(hcc != null) { + Map nodeControllerInfos = hcc.getNodeControllerInfos(); + String[] nodeList = new String[nodeControllerInfos.size()]; + int index = 0; + for (String node : nodeControllerInfos.keySet()) { + nodeList[index++] = node; + } + return nodeList; } - return nodeList; + return new String[0]; } /** From e9bd9115d5a09d811d45ef6a8ab81e2eafbdaa81 Mon Sep 17 00:00:00 2001 From: Ankit Ladhania Date: Sat, 12 Mar 2016 00:14:19 +0530 Subject: [PATCH 2/3] Reformatted the Coding Style according to standards followed by VXQuery community. --- .../java/org/apache/vxquery/cli/VXQuery.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java index e44690476..a02c65dea 100644 --- a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java +++ b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java @@ -81,8 +81,7 @@ public class VXQuery { /** * Constructor to use command line options passed. * - * @param opts - * Command line options object + * @param opts Command line options object */ public VXQuery(CmdLineOptions opts) { this.opts = opts; @@ -240,7 +239,7 @@ private void runQueries() throws IOException, SystemException, Exception { * @throws Exception */ private String[] getNodeList() throws Exception { - if(hcc != null) { + if (hcc != null) { Map nodeControllerInfos = hcc.getNodeControllerInfos(); String[] nodeList = new String[nodeControllerInfos.size()]; int index = 0; @@ -256,10 +255,8 @@ private String[] getNodeList() throws Exception { * Creates a Hyracks dataset, if not already existing with the job frame size, and 1 reader. Allocates a new buffer of size specified in the frame of Hyracks * node. Creates new dataset reader with the current job ID and result set ID. Outputs the string in buffer for each frame. * - * @param spec - * JobSpecification object, containing frame size. Current specified job. - * @param writer - * Writer for output of job. + * @param spec JobSpecification object, containing frame size. Current specified job. + * @param writer Writer for output of job. * @throws Exception */ private void runJob(JobSpecification spec, PrintWriter writer) throws Exception { @@ -342,8 +339,7 @@ public void stopLocalHyracks() throws Exception { /** * Reads the contents of file given in query into a String. The file is always closed. For XML files UTF-8 encoding is used. * - * @param query - * The query with filename to be processed + * @param query The query with filename to be processed * @return UTF-8 formatted query string * @throws IOException */ @@ -365,7 +361,8 @@ private static void timingMessage(String message) { * Helper class with fields and methods to handle all command line options */ private static class CmdLineOptions { - @Option(name = "-available-processors", usage = "Number of available processors. (default: java's available processors)") + @Option(name = "-available-processors", + usage = "Number of available processors. (default: java's available processors)") private int availableProcessors = -1; @Option(name = "-client-net-ip-address", usage = "IP Address of the ClusterController.") From f4ef29bf9dc20941042e99ef6f3e5c0fc8b0440b Mon Sep 17 00:00:00 2001 From: Ankit Ladhania Date: Sat, 12 Mar 2016 01:25:09 +0530 Subject: [PATCH 3/3] Removed NPE due to null value of nodeList in getNodeList of VXQuery-CLI Issue No. : VXQUERY-139 --- .../src/main/java/org/apache/vxquery/cli/VXQuery.java | 2 +- .../apache/vxquery/metadata/VXQueryMetadataProvider.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java index a02c65dea..deed1dac0 100644 --- a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java +++ b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java @@ -248,7 +248,7 @@ private String[] getNodeList() throws Exception { } return nodeList; } - return new String[0]; + return null; } /** diff --git a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java index 238f6d3e6..4d7fbc419 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java @@ -111,9 +111,11 @@ public static AlgebricksPartitionConstraint getClusterLocations(String[] nodeLis public static AlgebricksPartitionConstraint getClusterLocations(String[] nodeList, int partitions) { ArrayList locs = new ArrayList(); - for (String node : nodeList) { - for (int j = 0; j < partitions; j++) { - locs.add(node); + if (nodeList != null) { + for (String node : nodeList) { + for (int j = 0; j < partitions; j++) { + locs.add(node); + } } } String[] cluster = new String[locs.size()];