I made a typo in the JIRA number with this commit. Anyone know how to fix this?
Thanks, Jaideep ---------- Forwarded message ---------- From: <[email protected]> Date: Thu, Mar 5, 2015 at 12:41 PM Subject: incubator-lens git commit: LENS-280 NPE when query fails with execute_timeout api (Amareshwari via jdhok) To: [email protected] Repository: incubator-lens Updated Branches: refs/heads/master 252d67b9c -> ea8b970b6 LENS-280 NPE when query fails with execute_timeout api (Amareshwari via jdhok) Project: http://git-wip-us.apache.org/repos/asf/incubator-lens/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-lens/commit/ea8b970b Tree: http://git-wip-us.apache.org/repos/asf/incubator-lens/tree/ea8b970b Diff: http://git-wip-us.apache.org/repos/asf/incubator-lens/diff/ea8b970b Branch: refs/heads/master Commit: ea8b970b6cf7bdf6e2768d2012b55b075efbac3c Parents: 252d67b Author: jdhok <[email protected]> Authored: Thu Mar 5 12:41:43 2015 +0530 Committer: jdhok <[email protected]> Committed: Thu Mar 5 12:41:43 2015 +0530 ---------------------------------------------------------------------- .../server/query/QueryExecutionServiceImpl.java | 4 ++- .../lens/server/query/TestQueryService.java | 30 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/ea8b970b/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java b/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java index 15b9849..2f44938 100644 --- a/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java +++ b/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java @@ -1435,6 +1435,9 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu } } QueryCompletionListener listener = new QueryCompletionListenerImpl(handle); + if (getQueryContext(sessionHandle, handle).getSelectedDriver() == null) { + return result; + } getQueryContext(sessionHandle, handle).getSelectedDriver() .registerForCompletionNotification(handle, timeoutMillis, listener); try { @@ -1448,7 +1451,6 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu result.setResult(getResultset(handle).toQueryResult()); } return result; - } /** http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/ea8b970b/lens-server/src/test/java/org/apache/lens/server/query/TestQueryService.java ---------------------------------------------------------------------- diff --git a/lens-server/src/test/java/org/apache/lens/server/query/TestQueryService.java b/lens-server/src/test/java/org/apache/lens/server/query/TestQueryService.java index c350d09..ea991b7 100644 --- a/lens-server/src/test/java/org/apache/lens/server/query/TestQueryService.java +++ b/lens-server/src/test/java/org/apache/lens/server/query/TestQueryService.java @@ -1278,6 +1278,36 @@ public class TestQueryService extends LensJerseyTest { } /** + * Test execute with timeout query. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException the interrupted exception + */ + @Test + public void testExecuteWithTimeoutFailingQuery() throws IOException, InterruptedException { + final WebTarget target = target().path("queryapi/queries"); + + final FormDataMultiPart mp = new FormDataMultiPart(); + mp.bodyPart(new FormDataBodyPart(FormDataContentDisposition.name("sessionid").build(), lensSessionId, + MediaType.APPLICATION_XML_TYPE)); + mp.bodyPart(new FormDataBodyPart(FormDataContentDisposition.name("query").build(), "select ID from nonexist")); + mp.bodyPart(new FormDataBodyPart(FormDataContentDisposition.name("operation").build(), "execute_with_timeout")); + // set a timeout value enough for tests + mp.bodyPart(new FormDataBodyPart(FormDataContentDisposition.name("timeoutmillis").build(), "300000")); + mp.bodyPart(new FormDataBodyPart(FormDataContentDisposition.name("conf").fileName("conf").build(), new LensConf(), + MediaType.APPLICATION_XML_TYPE)); + + QueryHandleWithResultSet result = target.request().post(Entity.entity(mp, MediaType.MULTIPART_FORM_DATA_TYPE), + QueryHandleWithResultSet.class); + Assert.assertNotNull(result.getQueryHandle()); + Assert.assertNull(result.getResult()); + + LensQuery ctx = target.path(result.getQueryHandle().toString()).queryParam("sessionid", lensSessionId).request() + .get(LensQuery.class); + Assert.assertEquals(ctx.getStatus().getStatus(), Status.FAILED); + } + + /** * Test default config. * * @throws LensException the lens exception -- - Jaideep Dhok -- _____________________________________________________________ The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorized to receive it. It may contain confidential or legally privileged information. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. The firm is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt.
