This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 0624f6b  [Doris On ES]Add simple explain for EsTable (#3341)
0624f6b is described below

commit 0624f6b9ebfc2882d8b0db86acba3839fa531d0e
Author: Yunfeng,Wu <[email protected]>
AuthorDate: Sat Apr 18 10:04:03 2020 +0800

    [Doris On ES]Add simple explain for EsTable (#3341)
    
    related issue: #3306
    Note: this PR just remove the es_scan_node_test.cpp which is useless
    
    For the moment, just add a simple explain syntax for EsTable without 
translating the native predicates to ES queryDSL which is better to finished 
with moving the predicate translating from Doris BE to Doris FE, the whole work 
is still WIP.
---
 be/test/exec/CMakeLists.txt                        |  2 +-
 .../java/org/apache/doris/planner/EsScanNode.java  | 53 +++++++++++++++++-----
 run-ut.sh                                          |  1 -
 3 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/be/test/exec/CMakeLists.txt b/be/test/exec/CMakeLists.txt
index 696b9c1..bef6053 100644
--- a/be/test/exec/CMakeLists.txt
+++ b/be/test/exec/CMakeLists.txt
@@ -49,7 +49,7 @@ ADD_BE_TEST(broker_scanner_test)
 ADD_BE_TEST(broker_scan_node_test)
 ADD_BE_TEST(tablet_info_test)
 ADD_BE_TEST(tablet_sink_test)
-ADD_BE_TEST(es_scan_node_test)
+# ADD_BE_TEST(es_scan_node_test)
 ADD_BE_TEST(es_http_scan_node_test)
 ADD_BE_TEST(es_predicate_test)
 ADD_BE_TEST(es_query_builder_test)
diff --git a/fe/src/main/java/org/apache/doris/planner/EsScanNode.java 
b/fe/src/main/java/org/apache/doris/planner/EsScanNode.java
index 10e878d..48ab435 100644
--- a/fe/src/main/java/org/apache/doris/planner/EsScanNode.java
+++ b/fe/src/main/java/org/apache/doris/planner/EsScanNode.java
@@ -32,6 +32,7 @@ import org.apache.doris.external.EsTableState;
 import org.apache.doris.system.Backend;
 import org.apache.doris.thrift.TEsScanNode;
 import org.apache.doris.thrift.TEsScanRange;
+import org.apache.doris.thrift.TExplainLevel;
 import org.apache.doris.thrift.TNetworkAddress;
 import org.apache.doris.thrift.TPlanNode;
 import org.apache.doris.thrift.TPlanNodeType;
@@ -244,19 +245,49 @@ public class EsScanNode extends ScanNode {
         }
         PartitionPruner partitionPruner = null;
         switch (partitionInfo.getType()) {
-        case RANGE: {
-            RangePartitionInfo rangePartitionInfo = (RangePartitionInfo) 
partitionInfo;
-                Map<Long, Range<PartitionKey>> keyRangeById = 
rangePartitionInfo.getIdToRange(false);
-            partitionPruner = new RangePartitionPruner(keyRangeById, 
rangePartitionInfo.getPartitionColumns(),
-                    columnFilters);
-            return partitionPruner.prune();
-        }
-        case UNPARTITIONED: {
-            return null;
+            case RANGE: {
+                RangePartitionInfo rangePartitionInfo = (RangePartitionInfo) 
partitionInfo;
+                    Map<Long, Range<PartitionKey>> keyRangeById = 
rangePartitionInfo.getIdToRange(false);
+                partitionPruner = new RangePartitionPruner(keyRangeById, 
rangePartitionInfo.getPartitionColumns(),
+                        columnFilters);
+                return partitionPruner.prune();
+            }
+            case UNPARTITIONED: {
+                return null;
+            }
+            default: {
+                return null;
+            }
         }
-        default: {
-            return null;
+    }
+
+    @Override
+    protected String getNodeExplainString(String prefix, TExplainLevel 
detailLevel) {
+        StringBuilder output = new StringBuilder();
+
+        output.append(prefix).append("TABLE: 
").append(table.getName()).append("\n");
+
+        if (null != sortColumn) {
+            output.append(prefix).append("SORT COLUMN: 
").append(sortColumn).append("\n");
         }
+
+        if (!conjuncts.isEmpty()) {
+            output.append(prefix).append("PREDICATES: ").append(
+                    getExplainString(conjuncts)).append("\n");
+            // reserved for later using: LOCAL_PREDICATES is processed by 
Doris EsScanNode
+            output.append(prefix).append("LOCAL_PREDICATES: ").append(" 
").append("\n");
+            // reserved for later using: REMOTE_PREDICATES is processed by 
remote ES Cluster
+            output.append(prefix).append("REMOTE_PREDICATES: ").append(" 
").append("\n");
+            // reserved for later using: translate predicates to ES queryDSL
+            output.append(prefix).append("ES_QUERY_DSL: ").append(" 
").append("\n");
+        } else {
+            output.append(prefix).append("ES_QUERY_DSL: 
").append("{\"match_all\": {}}").append("\n");
         }
+        String indexName = table.getIndexName();
+        String typeName = table.getMappingType();
+        output.append(prefix)
+                .append(String.format("ES index/type: %s/%s", indexName, 
typeName))
+                .append("\n");
+        return output.toString();
     }
 }
diff --git a/run-ut.sh b/run-ut.sh
index adc9754..a66af13 100755
--- a/run-ut.sh
+++ b/run-ut.sh
@@ -205,7 +205,6 @@ ${DORIS_TEST_BINARY_DIR}/exec/broker_scanner_test
 ${DORIS_TEST_BINARY_DIR}/exec/parquet_scanner_test
 ${DORIS_TEST_BINARY_DIR}/exec/orc_scanner_test
 ${DORIS_TEST_BINARY_DIR}/exec/broker_scan_node_test
-${DORIS_TEST_BINARY_DIR}/exec/es_scan_node_test
 ${DORIS_TEST_BINARY_DIR}/exec/es_http_scan_node_test
 ${DORIS_TEST_BINARY_DIR}/exec/es_predicate_test
 ${DORIS_TEST_BINARY_DIR}/exec/es_scan_reader_test


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to