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 2019/10/11 17:28:32 UTC
[madlib] branch master updated: Pivot: Use output_table instead of
out_table
This is an automated email from the ASF dual-hosted git repository.
okislal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/madlib.git
The following commit(s) were added to refs/heads/master by this push:
new 91923af Pivot: Use output_table instead of out_table
91923af is described below
commit 91923af3c3aa71fe24c85679cbbc30933e06fd97
Author: Orhan Kislal <ok...@apache.org>
AuthorDate: Wed Oct 9 18:28:10 2019 -0400
Pivot: Use output_table instead of out_table
JIRA: MADLIB-1376
---
src/ports/postgres/modules/utilities/pivot.py_in | 22 +++++++++++-----------
src/ports/postgres/modules/utilities/pivot.sql_in | 18 +++++++++---------
2 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/ports/postgres/modules/utilities/pivot.py_in b/src/ports/postgres/modules/utilities/pivot.py_in
index d3d4e91..1b1a5d9 100644
--- a/src/ports/postgres/modules/utilities/pivot.py_in
+++ b/src/ports/postgres/modules/utilities/pivot.py_in
@@ -48,14 +48,14 @@ from validate_args import get_expr_type
m4_changequote(`<!', `!>')
-def pivot(schema_madlib, source_table, out_table, index, pivot_cols,
+def pivot(schema_madlib, source_table, output_table, index, pivot_cols,
pivot_values, aggregate_func=None, fill_value=None, keep_null=False,
output_col_dictionary=False, output_type=None, **kwargs):
"""
Helper function that can be used to pivot tables
Args:
@param source_table The original data table
- @param out_table The output table that contains the dummy
+ @param output_table The output table that contains the dummy
variable columns
@param index The index columns to group the records by
@param pivot_cols The columns to pivot the table
@@ -123,7 +123,7 @@ def pivot(schema_madlib, source_table, out_table, index, pivot_cols,
# always build dictionary table if output is array
output_col_dictionary = True if is_array_output else output_col_dictionary
- validate_pivot_coding(source_table, out_table, indices, pcols, pvals)
+ validate_pivot_coding(source_table, output_table, indices, pcols, pvals)
# Strip the end quotes for building output columns (this can only be
# performed after the validation)
@@ -207,7 +207,7 @@ def pivot(schema_madlib, source_table, out_table, index, pivot_cols,
pcol_types = plpy.execute("SELECT {0} FROM {1} LIMIT 1".
format(types_str, source_table))[0]
if output_col_dictionary:
- out_dict = out_table + "_dictionary"
+ out_dict = output_table + "_dictionary"
_assert(not table_exists(out_dict),
"Pivot: Output dictionary table already exists!")
# Create the empty dictionary table
@@ -330,7 +330,7 @@ def pivot(schema_madlib, source_table, out_table, index, pivot_cols,
try:
plpy.execute("""
- CREATE TABLE {out_table} AS
+ CREATE TABLE {output_table} AS
SELECT {index},
{all_pivot_sel_str}
FROM (
@@ -339,7 +339,7 @@ def pivot(schema_madlib, source_table, out_table, index, pivot_cols,
FROM {source_table}
) x
GROUP BY {index}
- """.format(out_table=out_table,
+ """.format(output_table=output_table,
index=index,
source_table=source_table,
all_pivot_from_str=', '.join(pivot_from_list),
@@ -403,18 +403,18 @@ def parse_aggregates(pvals, aggregate_func):
# ------------------------------------------------------------------------------
-def validate_pivot_coding(source_table, out_table, indices, pivs, vals):
+def validate_pivot_coding(source_table, output_table, indices, pivs, vals):
"""
Args:
@param source_table The original data table
- @param out_table The output table that will contain dummy columns
+ @param output_table The output table that will contain dummy columns
@param indices An array of index column names
@param cols An array of categorical column names
"""
- _assert(out_table and out_table.strip().lower() not in ('null', ''),
+ _assert(output_table and output_table.strip().lower() not in ('null', ''),
"Pivot: Invalid output table name!")
- _assert(not table_exists(out_table),
+ _assert(not table_exists(output_table),
"Pivot: Output table already exists!")
_assert(source_table and source_table.strip().lower() not in ('null', ''),
"Pivot: Invalid data table name!")
@@ -491,7 +491,7 @@ For more details on function usage:
-----------------------------------------------------------------------
SELECT {schema_madlib}.pivot(
source_table, -- Name of source table containing data for pivoting
- out_table, -- Name of output table taht contains pivoted data
+ output_table, -- Name of output table taht contains pivoted data
index, -- Comma-separated columns that will form the index
-- of the output pivot table
pivot_cols, -- Comma-separated columns that will form the
diff --git a/src/ports/postgres/modules/utilities/pivot.sql_in b/src/ports/postgres/modules/utilities/pivot.sql_in
index ab34868..dd50a34 100644
--- a/src/ports/postgres/modules/utilities/pivot.sql_in
+++ b/src/ports/postgres/modules/utilities/pivot.sql_in
@@ -699,7 +699,7 @@ database vendor to identify the PostgreSQL version it is based on.
* @brief Helper function that can be used to pivot tables
*
* @param source_table The original data table
- * @param out_table The output table that contains the dummy
+ * @param output_table The output table that contains the dummy
* variable columns
* @param index The index columns to group by the records by
* @param pivot_cols The columns to pivot the table
@@ -719,7 +719,7 @@ database vendor to identify the PostgreSQL version it is based on.
CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pivot(
source_table TEXT,
- out_table TEXT,
+ output_table TEXT,
index TEXT,
pivot_cols TEXT,
pivot_values TEXT,
@@ -736,7 +736,7 @@ m4_ifdef(`\_\_HAS_FUNCTION_PROPERTIES\_\_', `MODIFIES SQL DATA', `');
CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pivot(
source_table TEXT,
- out_table TEXT,
+ output_table TEXT,
index TEXT,
pivot_cols TEXT,
pivot_values TEXT,
@@ -752,7 +752,7 @@ m4_ifdef(`\_\_HAS_FUNCTION_PROPERTIES\_\_', `CONTAINS SQL', `');
CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pivot(
source_table TEXT,
- out_table TEXT,
+ output_table TEXT,
index TEXT,
pivot_cols TEXT,
pivot_values TEXT,
@@ -767,7 +767,7 @@ m4_ifdef(`\_\_HAS_FUNCTION_PROPERTIES\_\_', `CONTAINS SQL', `');
CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pivot(
source_table TEXT,
- out_table TEXT,
+ output_table TEXT,
index TEXT,
pivot_cols TEXT,
pivot_values TEXT,
@@ -781,7 +781,7 @@ m4_ifdef(`\_\_HAS_FUNCTION_PROPERTIES\_\_', `CONTAINS SQL', `');
CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pivot(
source_table TEXT,
- out_table TEXT,
+ output_table TEXT,
index TEXT,
pivot_cols TEXT,
pivot_values TEXT,
@@ -796,7 +796,7 @@ m4_ifdef(`\_\_HAS_FUNCTION_PROPERTIES\_\_', `CONTAINS SQL', `');
CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pivot(
source_table TEXT,
- out_table TEXT,
+ output_table TEXT,
index TEXT,
pivot_cols TEXT,
pivot_values TEXT,
@@ -809,7 +809,7 @@ m4_ifdef(`\_\_HAS_FUNCTION_PROPERTIES\_\_', `CONTAINS SQL', `');
CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pivot(
source_table TEXT,
- out_table TEXT,
+ output_table TEXT,
index TEXT,
pivot_cols TEXT,
pivot_values TEXT,
@@ -822,7 +822,7 @@ m4_ifdef(`\_\_HAS_FUNCTION_PROPERTIES\_\_', `CONTAINS SQL', `');
CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pivot(
source_table TEXT,
- out_table TEXT,
+ output_table TEXT,
index TEXT,
pivot_cols TEXT,
pivot_values TEXT