Changeset: c237c9b653ef for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c237c9b653ef
Modified Files:
        sql/test/miscellaneous/Tests/simple_plans.test
        testing/explain.py
Branch: default
Log Message:

Added histogram for functions returning more than one bat. I need it to test 
opt_postfix optimizer


diffs (90 lines):

diff --git a/sql/test/miscellaneous/Tests/simple_plans.test 
b/sql/test/miscellaneous/Tests/simple_plans.test
--- a/sql/test/miscellaneous/Tests/simple_plans.test
+++ b/sql/test/miscellaneous/Tests/simple_plans.test
@@ -292,29 +292,38 @@ 1
 sql.resultSet
 1
 
-query T python .explain.function_histogram
-EXPLAIN SELECT 1 FROM another_t t1 INNER JOIN another_t t2 ON t1.col1 > t2.col1
+query T python .explain.function_with_more_than_one_result_bat
+EXPLAIN SELECT t1.col1 FROM another_t t1 INNER JOIN another_t t2 ON t1.col1 = 
t2.col1
 ----
-user.main
-1
-querylog.define
-1
-bat.pack
-5
-sql.mvc
+
+
+query T python .explain.function_with_more_than_one_result_bat
+EXPLAIN SELECT t2.col1 FROM another_t t1 INNER JOIN another_t t2 ON t1.col1 = 
t2.col1
+----
+
+
+query T python .explain.function_with_more_than_one_result_bat
+EXPLAIN SELECT t1.col1, t2.col1 FROM another_t t1 INNER JOIN another_t t2 ON 
t1.col1 = t2.col1
+----
+algebra.join
 1
-sql.tid
-1
-sql.bind
-1
-algebra.projection
-2
+
+
+query T python .explain.function_with_more_than_one_result_bat
+EXPLAIN SELECT t1.col1 FROM another_t t1 INNER JOIN another_t t2 ON t1.col1 > 
t2.col1
+----
+
+
+query T python .explain.function_with_more_than_one_result_bat
+EXPLAIN SELECT t2.col1 FROM another_t t1 INNER JOIN another_t t2 ON t1.col1 > 
t2.col1
+----
+
+
+query T python .explain.function_with_more_than_one_result_bat
+EXPLAIN SELECT t1.col1, t2.col1 FROM another_t t1 INNER JOIN another_t t2 ON 
t1.col1 > t2.col1
+----
 algebra.thetajoin
 1
-algebra.project
-1
-sql.resultSet
-1
 
 query T nosort
 PLAN SELECT 1 FROM another_t WHERE (col1 >= 1 AND col1 <= 2) OR col2 IS NULL
diff --git a/testing/explain.py b/testing/explain.py
--- a/testing/explain.py
+++ b/testing/explain.py
@@ -26,3 +26,25 @@ def function_histogram(tab):
         row.append(str(val))
         nhisto.append(row)
     return nhisto
+
+# Returns functions returning more than one parameter in the MAL plan, at the 
moment, all returning parameters must be bats
+def function_with_more_than_one_result_bat(tab):
+    histo = {}
+    for row in tab:
+        if row[0].find('usec') < 0:
+            g = re.match('.*\(([A-Z]\_[0-9]+:bat\[:[a-z]+\],?\ ?)+\)\ :=\ 
.*;', row[0])
+            if g:
+                g2 = 
re.match('.*\s([a-zA-Z_][a-zA-Z_0-9]*\.[a-zA-Z_][a-zA-Z_0-9]*\().*;', row[0])
+                if g2:
+                    f = g2.groups(1)[0][:-1] # Remove the trailing round 
bracket
+                    if f in histo:
+                        histo[f]+=1
+                    else:
+                        histo[f]=1
+    nhisto = []
+    for key,val in histo.items():
+        row=[]
+        row.append(key)
+        row.append(str(val))
+        nhisto.append(row)
+    return nhisto
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to