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 2018/10/04 07:41:07 UTC
madlib git commit: Margins: Copy summary table instead of renaming
Repository: madlib
Updated Branches:
refs/heads/master d95dcfa25 -> bd3233908
Margins: Copy summary table instead of renaming
JIRA: MADLIB-1276
Margins summary table gets dropped since its schema remains pg_temp.
This commit fixed the issue by copying the contents instead of renaming.
Closes #330
Project: http://git-wip-us.apache.org/repos/asf/madlib/repo
Commit: http://git-wip-us.apache.org/repos/asf/madlib/commit/bd323390
Tree: http://git-wip-us.apache.org/repos/asf/madlib/tree/bd323390
Diff: http://git-wip-us.apache.org/repos/asf/madlib/diff/bd323390
Branch: refs/heads/master
Commit: bd3233908f74c68bbe0f57bffeeb001cf2ff4c8a
Parents: d95dcfa
Author: Orhan Kislal <ok...@apache.org>
Authored: Thu Oct 4 10:40:20 2018 +0300
Committer: Orhan Kislal <ok...@apache.org>
Committed: Thu Oct 4 10:40:20 2018 +0300
----------------------------------------------------------------------
src/ports/postgres/modules/regress/marginal.py_in | 11 ++++-------
src/ports/postgres/modules/regress/test/marginal.sql_in | 4 ++++
2 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/madlib/blob/bd323390/src/ports/postgres/modules/regress/marginal.py_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/regress/marginal.py_in b/src/ports/postgres/modules/regress/marginal.py_in
index ddade74..474bc20 100644
--- a/src/ports/postgres/modules/regress/marginal.py_in
+++ b/src/ports/postgres/modules/regress/marginal.py_in
@@ -15,7 +15,6 @@ from utilities.utilities import _assert
from utilities.utilities import py_list_to_sql_string
from utilities.validate_args import table_exists
-from utilities.validate_args import rename_table
from utilities.validate_args import columns_exist_in_table
from utilities.validate_args import table_is_empty
@@ -167,9 +166,8 @@ def margins_logregr(schema_madlib, source_table, out_table,
tolerance_str=tolerance_str, verbose=verbose_mode))
# Rename the output summary table
- rename_table(schema_madlib,
- "{old}_summary".format(old=logr_out_table),
- "{new}_summary".format(new=out_table))
+ plpy.execute("""CREATE TABLE {out_table}_summary AS
+ SELECT * FROM {logr_out_table}_summary""".format(**locals()))
plpy.execute("""UPDATE {out_table}_summary SET out_table = '{out_table}'
""".format(out_table=out_table))
@@ -522,9 +520,8 @@ def margins_mlogregr(schema_madlib, source_table, out_table,
""".format(**all_arguments))
# Rename the output summary table
- rename_table(schema_madlib,
- "{old}_summary".format(old=mlog_out_table),
- "{new}_summary".format(new=out_table))
+ plpy.execute("""CREATE TABLE {out_table}_summary AS
+ SELECT * FROM {mlog_out_table}_summary""".format(**locals()))
plpy.execute("UPDATE {out_table}_summary SET out_table = '{out_table}'".
format(out_table=out_table))
http://git-wip-us.apache.org/repos/asf/madlib/blob/bd323390/src/ports/postgres/modules/regress/test/marginal.sql_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/regress/test/marginal.sql_in b/src/ports/postgres/modules/regress/test/marginal.sql_in
index 4d037da..ec984d7 100644
--- a/src/ports/postgres/modules/regress/test/marginal.sql_in
+++ b/src/ports/postgres/modules/regress/test/marginal.sql_in
@@ -56,6 +56,10 @@ select margins_logregr(
ARRAY[1, 2, 3]
);
+SELECT * FROM result_table;
+
+SELECT * FROM result_table_summary;
+
-- CHECK : Make sure all possible default values work
drop table if exists result_table;
drop table if exists result_table_summary;