You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by ok...@apache.org on 2017/11/01 18:28:48 UTC

madlib git commit: LMF: Disable ORCA to improve the performance

Repository: madlib
Updated Branches:
  refs/heads/master e6e7c3903 -> 3057d3b7e


LMF: Disable ORCA to improve the performance


Project: http://git-wip-us.apache.org/repos/asf/madlib/repo
Commit: http://git-wip-us.apache.org/repos/asf/madlib/commit/3057d3b7
Tree: http://git-wip-us.apache.org/repos/asf/madlib/tree/3057d3b7
Diff: http://git-wip-us.apache.org/repos/asf/madlib/diff/3057d3b7

Branch: refs/heads/master
Commit: 3057d3b7eafeb8b5017714523110b7d64da748ef
Parents: e6e7c39
Author: Orhan Kislal <ok...@pivotal.io>
Authored: Wed Nov 1 11:27:51 2017 -0700
Committer: Orhan Kislal <ok...@pivotal.io>
Committed: Wed Nov 1 11:27:51 2017 -0700

----------------------------------------------------------------------
 src/ports/postgres/modules/convex/lmf_igd.py_in | 78 +++++++++++---------
 1 file changed, 42 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/madlib/blob/3057d3b7/src/ports/postgres/modules/convex/lmf_igd.py_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/convex/lmf_igd.py_in b/src/ports/postgres/modules/convex/lmf_igd.py_in
index 971da02..a2d42f6 100644
--- a/src/ports/postgres/modules/convex/lmf_igd.py_in
+++ b/src/ports/postgres/modules/convex/lmf_igd.py_in
@@ -11,6 +11,7 @@
 """
 
 from utilities.control import IterationController2S
+from utilities.control import OptimizerControl
 
 def compute_lmf_igd(schema_madlib, rel_args, rel_state, rel_source,
     col_row, col_column, col_value, **kwargs):
@@ -33,40 +34,45 @@ def compute_lmf_igd(schema_madlib, rel_args, rel_state, rel_source,
     @return The iteration number (i.e., the key) with which to look up the
         result in \c rel_state
     """
-    iterationCtrl = IterationController2S(
-        rel_args = rel_args,
-        rel_state = rel_state,
-        stateType = "DOUBLE PRECISION[]",
-        truncAfterIteration = False,
-        schema_madlib = schema_madlib, # Identifiers start here
-        rel_source = rel_source,
-        col_row = col_row,
-        col_column = col_column,
-        col_value = col_value)
-    with iterationCtrl as it:
-        it.iteration = 0
-        while True:
-            it.update("""
-                SELECT
-                    {schema_madlib}.lmf_igd_step(
-                        (_src.{col_row})::integer,
-                        (_src.{col_column})::integer,
-                        (_src.{col_value})::integer,
-                        m4_ifdef(`__HAWQ__', `{{__state__}}', `
-                        (SELECT _state FROM {rel_state}
-                            WHERE _iteration = {iteration})'),
-                        (_args.row_dim)::integer,
-                        (_args.column_dim)::integer,
-                        (_args.max_rank)::integer,
-                        (_args.stepsize)::FLOAT8,
-                        (_args.scale_factor)::FLOAT8)
-                FROM {rel_source} AS _src, {rel_args} AS _args
-                """)
-            if it.test("""
-                {iteration} > _args.num_iterations OR
-                {schema_madlib}.internal_lmf_igd_distance(
-                    _state_previous, _state_current) < _args.tolerance
-                """):
-                break
-    return iterationCtrl.iteration
+
+    # We disable ORCA since this function creates an edge case where
+    # the performance is worse than the planner. (MADLIB-1170)
+
+    with OptimizerControl(False):
+        iterationCtrl = IterationController2S(
+            rel_args = rel_args,
+            rel_state = rel_state,
+            stateType = "DOUBLE PRECISION[]",
+            truncAfterIteration = False,
+            schema_madlib = schema_madlib, # Identifiers start here
+            rel_source = rel_source,
+            col_row = col_row,
+            col_column = col_column,
+            col_value = col_value)
+        with iterationCtrl as it:
+            it.iteration = 0
+            while True:
+                it.update("""
+                    SELECT
+                        {schema_madlib}.lmf_igd_step(
+                            (_src.{col_row})::integer,
+                            (_src.{col_column})::integer,
+                            (_src.{col_value})::integer,
+                            m4_ifdef(`__HAWQ__', `{{__state__}}', `
+                            (SELECT _state FROM {rel_state}
+                                WHERE _iteration = {iteration})'),
+                            (_args.row_dim)::integer,
+                            (_args.column_dim)::integer,
+                            (_args.max_rank)::integer,
+                            (_args.stepsize)::FLOAT8,
+                            (_args.scale_factor)::FLOAT8)
+                    FROM {rel_source} AS _src, {rel_args} AS _args
+                    """)
+                if it.test("""
+                    {iteration} > _args.num_iterations OR
+                    {schema_madlib}.internal_lmf_igd_distance(
+                        _state_previous, _state_current) < _args.tolerance
+                    """):
+                    break
+        return iterationCtrl.iteration