orhankislal commented on a change in pull request #467: DL: Improve performance 
of mini-batch preprocessor
URL: https://github.com/apache/madlib/pull/467#discussion_r362651161
 
 

 ##########
 File path: 
src/ports/postgres/modules/deep_learning/input_data_preprocessor.py_in
 ##########
 @@ -190,6 +207,52 @@ class InputDataPreprocessorDL(object):
             shape = parse_shape(shape)
         return shape
 
+    def run_batch_rows_query(self, local_vars):
+        """
+            This can be called from either pg or gpdb path,
+            dist_by_buffer_id & make_buffer_id must be set first
+        """
+        batching_query = """
+            CREATE TEMP TABLE {batched_table} AS SELECT
+                {make_buffer_id} buffer_id,
+                {self.schema_madlib}.agg_array_concat(
+                    ARRAY[x_norm::{FLOAT32_SQL_TYPE}[]]) AS {x},
+                {self.schema_madlib}.agg_array_concat(
+                    ARRAY[y]) AS {y},
+                COUNT(*) AS count
+            FROM {normalized_tbl}
+            GROUP BY buffer_id
+            {dist_by_buffer_id}
+        """.format(x=MINIBATCH_OUTPUT_INDEPENDENT_COLNAME_DL,
+               y=MINIBATCH_OUTPUT_DEPENDENT_COLNAME_DL,
+               FLOAT32_SQL_TYPE=FLOAT32_SQL_TYPE,
+               **local_vars)
+
+        # Disable hashagg since large number of arrays being concatenated
+        # could result in excessive memory usage.
+        with HashaggControl(False):
+            plpy_execute(batching_query)
+ 
+    def convert_to_bytea(self, local_vars):
 
 Review comment:
   This function creates a table which should be reflected in the name.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to