You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by nj...@apache.org on 2019/06/03 19:02:37 UTC
[madlib] 03/03: get_cols() only uses 1 paramter,
so get rid of all the unused ones.
This is an automated email from the ASF dual-hosted git repository.
njayaram pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/madlib.git
commit 2479a6a8ba14aba214655e9760e78ba44d937e93
Author: Domino Valdano <dv...@pivotal.io>
AuthorDate: Tue May 28 15:21:47 2019 -0700
get_cols() only uses 1 paramter, so get rid of all the unused ones.
Co-authored-by: Ekta Khanna <ek...@pivotal.io>
---
.../postgres/modules/deep_learning/madlib_keras_validator.py_in | 2 +-
src/ports/postgres/modules/linalg/matrix_ops.py_in | 2 +-
.../postgres/modules/recursive_partitioning/decision_tree.py_in | 2 +-
src/ports/postgres/modules/utilities/path.py_in | 2 +-
src/ports/postgres/modules/utilities/sessionize.py_in | 2 +-
src/ports/postgres/modules/utilities/validate_args.py_in | 6 +++---
src/ports/postgres/modules/validation/cross_validation.py_in | 4 ++--
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/ports/postgres/modules/deep_learning/madlib_keras_validator.py_in b/src/ports/postgres/modules/deep_learning/madlib_keras_validator.py_in
index e344c05..4ab5d45 100644
--- a/src/ports/postgres/modules/deep_learning/madlib_keras_validator.py_in
+++ b/src/ports/postgres/modules/deep_learning/madlib_keras_validator.py_in
@@ -140,7 +140,7 @@ class InputValidator:
MODEL_ARCH_TABLE_COLNAME,
NORMALIZING_CONST_COLNAME]
_assert(columns_exist_in_table(
- self.model_summary_table, cols_to_check_for, cols_to_check_for),
+ self.model_summary_table, cols_to_check_for),
"{0} error: One or more expected columns missing in model "
"summary table ('{1}'). The expected columns are {2}.".format(
self.module_name, self.model_summary_table, cols_to_check_for))
diff --git a/src/ports/postgres/modules/linalg/matrix_ops.py_in b/src/ports/postgres/modules/linalg/matrix_ops.py_in
index 4fc9a15..bdbb502 100644
--- a/src/ports/postgres/modules/linalg/matrix_ops.py_in
+++ b/src/ports/postgres/modules/linalg/matrix_ops.py_in
@@ -187,7 +187,7 @@ def cast_dense_input_table_to_correct_columns(schema_madlib, matrix_in,
# Returns true if a new table was generated. Returns false otherwise.
_validate_output_table(matrix_out)
_validate_input_table(matrix_in)
- cols = get_cols(matrix_in, schema_madlib)
+ cols = get_cols(matrix_in)
createTable = False
if len(cols) == 2:
cols.remove(row_id)
diff --git a/src/ports/postgres/modules/recursive_partitioning/decision_tree.py_in b/src/ports/postgres/modules/recursive_partitioning/decision_tree.py_in
index 26b0e1f..69a54f3 100644
--- a/src/ports/postgres/modules/recursive_partitioning/decision_tree.py_in
+++ b/src/ports/postgres/modules/recursive_partitioning/decision_tree.py_in
@@ -149,7 +149,7 @@ def _get_features_to_use(schema_madlib, training_table_name,
for i in [id_col_name, weights, dependent_variable])
if list_of_features.strip() == '*':
- all_col_set = set(get_cols(training_table_name, schema_madlib))
+ all_col_set = set(get_cols(training_table_name))
exclude_set = set(split_quoted_delimited_str(list_of_features_to_exclude))
feature_set = all_col_set - exclude_set
filtered_feature_list = list(feature_set - group_set - other_col_set)
diff --git a/src/ports/postgres/modules/utilities/path.py_in b/src/ports/postgres/modules/utilities/path.py_in
index acbaf8d..7a51203 100644
--- a/src/ports/postgres/modules/utilities/path.py_in
+++ b/src/ports/postgres/modules/utilities/path.py_in
@@ -82,7 +82,7 @@ def path(schema_madlib, source_table, output_table, partition_expr,
match_to_row_id = unique_string('match_to_row_id')
match_id = unique_string('match_id')
- all_input_cols = [i.strip() for i in get_cols(source_table, schema_madlib)]
+ all_input_cols = [i.strip() for i in get_cols(source_table)]
all_input_cols_str = ', '.join(all_input_cols)
if persist_rows:
matched_rows = add_postfix(output_table, "_tuples")
diff --git a/src/ports/postgres/modules/utilities/sessionize.py_in b/src/ports/postgres/modules/utilities/sessionize.py_in
index 278e1f8..0d593e6 100644
--- a/src/ports/postgres/modules/utilities/sessionize.py_in
+++ b/src/ports/postgres/modules/utilities/sessionize.py_in
@@ -61,7 +61,7 @@ def sessionize(schema_madlib, source_table, output_table, partition_expr,
# in output_cols. Using '*' as is, without expanding it to specific
# column names leads to some temporary intermediate columns
# (new_partition and new_session defined below) occurring in the output.
- cols_to_project_list = [', '.join(get_cols(source_table, schema_madlib)) if i=='*' else i
+ cols_to_project_list = [', '.join(get_cols(source_table)) if i=='*' else i
for i in split_quoted_delimited_str(output_cols)]
# Examples of Invalid SELECT expression in output_cols:
diff --git a/src/ports/postgres/modules/utilities/validate_args.py_in b/src/ports/postgres/modules/utilities/validate_args.py_in
index 073563c..41e9a11 100644
--- a/src/ports/postgres/modules/utilities/validate_args.py_in
+++ b/src/ports/postgres/modules/utilities/validate_args.py_in
@@ -297,7 +297,7 @@ def table_is_empty(tbl, filter_str=None):
# -------------------------------------------------------------------------
-def get_cols(tbl, *args, **kwargs):
+def get_cols(tbl):
"""
Get all column names in a table.
@@ -313,7 +313,7 @@ def get_cols(tbl, *args, **kwargs):
WHERE attrelid = '{tbl}'::regclass
AND NOT attisdropped
AND attnum > 0"""
- return plpy.execute(sql_string.format(**locals()))[0]["cols"]
+ return plpy.execute(sql_string.format(tbl=tbl))[0]["cols"]
# -------------------------------------------------------------------------
@@ -436,7 +436,7 @@ def columns_exist_in_table(tbl, cols, schema_madlib="madlib"):
Returns:
True if all columns in 'cols' exist in source table else False
"""
- existing_cols = set(unquote_ident(i) for i in get_cols(tbl, schema_madlib))
+ existing_cols = set(unquote_ident(i) for i in get_cols(tbl))
for col in cols:
if not col or unquote_ident(col) not in existing_cols:
return False
diff --git a/src/ports/postgres/modules/validation/cross_validation.py_in b/src/ports/postgres/modules/validation/cross_validation.py_in
index 1be5b86..f1fd0b9 100644
--- a/src/ports/postgres/modules/validation/cross_validation.py_in
+++ b/src/ports/postgres/modules/validation/cross_validation.py_in
@@ -313,7 +313,7 @@ def cross_validation_general(
"""
with MinWarning("warning"):
if not data_cols:
- data_cols = get_cols(data_tbl, schema_madlib)
+ data_cols = get_cols(data_tbl)
n_rows = _validate_cv_args(**locals())
@@ -408,7 +408,7 @@ def cross_validation_grouping_w_params(
"""
with MinWarning("warning"):
if not data_cols:
- data_cols = get_cols(data_tbl, schema_madlib)
+ data_cols = get_cols(data_tbl)
n_rows = _validate_cv_args(**locals())
explore_type_str = "::INTEGER"