[
https://issues.apache.org/jira/browse/DRILL-4132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15263208#comment-15263208
]
ASF GitHub Bot commented on DRILL-4132:
---------------------------------------
Github user yufeldman commented on a diff in the pull request:
https://github.com/apache/drill/pull/368#discussion_r61516213
--- Diff:
exec/java-exec/src/test/java/org/apache/drill/exec/DrillSeparatePlanningTest.java
---
@@ -0,0 +1,350 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec;
+
+import static org.junit.Assert.*;
+import io.netty.buffer.DrillBuf;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+
+import org.apache.drill.BaseTestQuery;
+import org.apache.drill.common.DrillAutoCloseables;
+import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.common.util.TestTools;
+import org.apache.drill.exec.client.DrillClient;
+import org.apache.drill.exec.client.PrintingResultsListener;
+import org.apache.drill.exec.client.QuerySubmitter.Format;
+import org.apache.drill.exec.exception.SchemaChangeException;
+import org.apache.drill.exec.memory.BufferAllocator;
+import org.apache.drill.exec.proto.BitControl.PlanFragment;
+import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint;
+import org.apache.drill.exec.proto.UserBitShared.QueryData;
+import org.apache.drill.exec.proto.UserBitShared.QueryId;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
+import org.apache.drill.exec.proto.UserBitShared.QueryType;
+import org.apache.drill.exec.proto.UserProtos.QueryPlanFragments;
+import org.apache.drill.exec.record.RecordBatchLoader;
+import org.apache.drill.exec.record.VectorWrapper;
+import org.apache.drill.exec.rpc.ConnectionThrottle;
+import org.apache.drill.exec.rpc.DrillRpcFuture;
+import org.apache.drill.exec.rpc.RpcException;
+import org.apache.drill.exec.rpc.user.AwaitableUserResultsListener;
+import org.apache.drill.exec.rpc.user.QueryDataBatch;
+import org.apache.drill.exec.rpc.user.UserResultsListener;
+import org.apache.drill.exec.util.VectorUtil;
+import org.apache.drill.exec.vector.ValueVector;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * Class to test different planning use cases (separate form query
execution)
+ *
+ */
+public class DrillSeparatePlanningTest extends BaseTestQuery {
+
+ static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(DrillSeparatePlanningTest.class);
+
+ static final String WORKING_PATH = TestTools.getWorkingPath();
+ static final String TEST_RES_PATH = WORKING_PATH + "/src/test/resources";
+
+ //final String query = "SELECT sales_city, COUNT(*) cnt FROM
cp.`region.json` GROUP BY sales_city";
+ //final String query = "SELECT * FROM cp.`employee.json` where
employee_id > 1 and employee_id < 1000";
+ //final String query = "SELECT o_orderkey, o_custkey FROM
dfs.tmp.`multilevel` where dir0 = 1995 and o_orderkey > 100 and o_orderkey <
1000 limit 5";
+ //final String query = "SELECT sum(o_totalprice) FROM
dfs.tmp.`multilevel` where dir0 = 1995 and o_orderkey > 100 and o_orderkey <
1000";
+ //final String query = "SELECT o_orderkey FROM dfs.tmp.`multilevel`
order by o_orderkey";
+ //final String query = "SELECT dir1, sum(o_totalprice) FROM
dfs.tmp.`multilevel` where dir0 = 1995 group by dir1 order by dir1";
+ //final String query = String.format("SELECT dir0, sum(o_totalprice)
FROM dfs_test.`%s/multilevel/json` group by dir0 order by dir0", TEST_RES_PATH);
+
+
+ @Test(timeout=30000)
+ public void testSingleFragmentQuery() throws Exception {
+ final String query = "SELECT * FROM cp.`employee.json` where
employee_id > 1 and employee_id < 1000";
+
+ QueryPlanFragments planFragments = getFragmentsHelper(query);
+
+ assertNotNull(planFragments);
+
+ assertEquals(1, planFragments.getFragmentsCount());
+ assertTrue(planFragments.getFragments(0).getLeafFragment());
+
+ getResultsHelper(planFragments);
+ }
+
+ @Test(timeout=30000)
+ public void testMultiMinorFragmentSimpleQuery() throws Exception {
+ final String query = String.format("SELECT o_orderkey FROM
dfs_test.`%s/multilevel/json`", TEST_RES_PATH);
+
+ QueryPlanFragments planFragments = getFragmentsHelper(query);
+
+ assertNotNull(planFragments);
+
+ assertTrue((planFragments.getFragmentsCount() > 1));
+
+ for ( PlanFragment planFragment : planFragments.getFragmentsList()) {
+ assertTrue(planFragment.getLeafFragment());
+ }
+
+ getResultsHelper(planFragments);
+ }
+
+ @Test(timeout=30000)
+ public void testMultiMinorFragmentComplexQuery() throws Exception {
+ final String query = String.format("SELECT dir0, sum(o_totalprice)
FROM dfs_test.`%s/multilevel/json` group by dir0 order by dir0", TEST_RES_PATH);
+
+ QueryPlanFragments planFragments = getFragmentsHelper(query);
+
+ assertNotNull(planFragments);
+
+ assertTrue((planFragments.getFragmentsCount() > 1));
+
+ for ( PlanFragment planFragment : planFragments.getFragmentsList()) {
+ assertTrue(planFragment.getLeafFragment());
+ }
+
+ getResultsHelper(planFragments);
+
+ }
+
+ @Test(timeout=30000)
+ public void testPlanningNoSplit() throws Exception {
+ final String query = String.format("SELECT dir0, sum(o_totalprice)
FROM dfs_test.`%s/multilevel/json` group by dir0 order by dir0", TEST_RES_PATH);
+
+ updateTestCluster(2, config);
+
+ List<QueryDataBatch> results = client.runQuery(QueryType.SQL, "alter
session set `planner.slice_target`=1");
+ for(QueryDataBatch batch : results) {
+ batch.release();
+ }
+
+ DrillRpcFuture<QueryPlanFragments> queryFragmentsFutures =
client.planQuery(QueryType.SQL, query, false);
+
+ final QueryPlanFragments planFragments = queryFragmentsFutures.get();
+
+ assertNotNull(planFragments);
+
+ assertTrue((planFragments.getFragmentsCount() > 1));
+
+ PlanFragment rootFragment = planFragments.getFragments(0);
+ assertFalse(rootFragment.getLeafFragment());
+
+ getCombinedResultsHelper(planFragments);
+
+ client.close();
--- End diff --
tests work both ways - I would not check in w/o successful tests runs :).
But, yes, I am removing client.close() since it is done in base class
@AfterClass and in my tests I am anyway updating/resetting clients at the
beginning of each test
> Ability to submit simple type of physical plan directly to EndPoint DrillBit
> for execution
> ------------------------------------------------------------------------------------------
>
> Key: DRILL-4132
> URL: https://issues.apache.org/jira/browse/DRILL-4132
> Project: Apache Drill
> Issue Type: New Feature
> Components: Execution - Flow, Execution - RPC, Query Planning &
> Optimization
> Reporter: Yuliya Feldman
> Assignee: Yuliya Feldman
>
> Today Drill Query execution is optimistic and stateful (at least due to data
> exchanges) - if any of the stages of query execution fails whole query fails.
> If query is just simple scan, filter push down and project where no data
> exchange happens between DrillBits there is no need to fail whole query when
> one DrillBit fails, as minor fragments running on that DrillBit can be rerun
> on the other DrillBit. There are probably multiple ways to achieve this. This
> JIRA is to open discussion on:
> 1. agreement that we need to support above use case
> 2. means of achieving it.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)