You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by kh...@apache.org on 2021/02/19 01:05:09 UTC

[madlib] branch master updated: DL: Update ind/dep var shape to INTEGER instead of smallint

This is an automated email from the ASF dual-hosted git repository.

khannaekta 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 a8a7df0  DL: Update ind/dep var shape to INTEGER instead of smallint
a8a7df0 is described below

commit a8a7df0ca2d9db66cb5825546b061e2d55468d42
Author: Ekta Khanna <ek...@vmware.com>
AuthorDate: Thu Feb 18 15:45:46 2021 -0800

    DL: Update ind/dep var shape to INTEGER instead of smallint
    
    JIRA: MADLIB-1468
    
    training_preprocessor_dl() function fails with the following error when the
    number of images in a buffer is > range for smallint i.e. -32768 to +32767.
    ```
    ERROR: spiexceptions.NumericValueOutOfRange: smallint out of range
    ```
    This commit replaces smallint with INTEGER for the shape column.
    
    Co-authored-by: Nikhil Kak <nk...@vmware.com>
---
 .../postgres/modules/deep_learning/input_data_preprocessor.py_in      | 4 ++--
 src/ports/postgres/modules/deep_learning/madlib_keras_helper.py_in    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/ports/postgres/modules/deep_learning/input_data_preprocessor.py_in b/src/ports/postgres/modules/deep_learning/input_data_preprocessor.py_in
index 68d067b..21838a3 100644
--- a/src/ports/postgres/modules/deep_learning/input_data_preprocessor.py_in
+++ b/src/ports/postgres/modules/deep_learning/input_data_preprocessor.py_in
@@ -280,7 +280,7 @@ class InputDataPreprocessorDL(object):
                 {self.schema_madlib}.agg_array_concat(ARRAY[{i}_norm::{float32}[]]) AS {i}
                 """.format(**locals()))
             shape_sql.append("""
-                ARRAY[count, {j}]::SMALLINT[] AS {i}_shape
+                ARRAY[count, {j}]::INTEGER[] AS {i}_shape
                 """.format(**locals()))
             bytea_sql.append("""
                 {self.schema_madlib}.array_to_bytea({i}) AS {i}
@@ -291,7 +291,7 @@ class InputDataPreprocessorDL(object):
                 {self.schema_madlib}.agg_array_concat(ARRAY[{i}]) AS {i}
                 """.format(**locals()))
             shape_sql.append("""
-                ARRAY[count, {j}]::SMALLINT[] AS {i}_shape
+                ARRAY[count, {j}]::INTEGER[] AS {i}_shape
                 """.format(**locals()))
             bytea_sql.append("""
                 {self.schema_madlib}.array_to_bytea({i}) AS {i}
diff --git a/src/ports/postgres/modules/deep_learning/madlib_keras_helper.py_in b/src/ports/postgres/modules/deep_learning/madlib_keras_helper.py_in
index 243acd1..66641b1 100644
--- a/src/ports/postgres/modules/deep_learning/madlib_keras_helper.py_in
+++ b/src/ports/postgres/modules/deep_learning/madlib_keras_helper.py_in
@@ -132,7 +132,7 @@ def get_image_count_per_seg_for_minibatched_data_from_db(table_name, shape_col):
 
     if is_platform_pg():
         res = plpy.execute(
-            """ SELECT {0}::SMALLINT[] AS shape
+            """ SELECT {0} AS shape
                 FROM {1}
             """.format(shape_col, table_name))
         images_per_seg = [sum(r['shape'][0] for r in res)]