You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/01/25 20:31:35 UTC

[GitHub] villebro commented on a change in pull request #6719: Adding support for Pinot

villebro commented on a change in pull request #6719: Adding support for Pinot
URL: https://github.com/apache/incubator-superset/pull/6719#discussion_r251120556
 
 

 ##########
 File path: superset/connectors/sqla/models.py
 ##########
 @@ -804,10 +837,24 @@ def query(self, query_obj):
                 df = df.rename(index=str, columns=self.mutated_labels)
         except Exception as e:
             status = utils.QueryStatus.FAILED
-            logging.exception(e)
+            logging.exception(f'Query {sql} on schema {self.schema} failed')
             error_message = (
                 self.database.db_engine_spec.extract_error_message(e))
 
+        labels_expected = query_str_ext.labels_expected
+        if df is not None and \
+                not df.empty and \
+                not self.database.db_engine_spec.db_respects_given_column_labels and \
+                labels_expected is not None:
+            if len(df.columns) != len(labels_expected):
+                error_message = (f'For {sql}, df.columns: {df.columns}' +
+                                 f' differs from {labels_expected}')
+                status = utils.QueryStatus.FAILED
+            else:
+                logging.info(f'For query {sql}, renaming the df.columns from'
+                             f' {df.columns} to {labels_expected}')
+                df.columns = labels_expected
+
 
 Review comment:
   This seems very specific to Pinot. I wonder if this could be dealt with in `db_engine_specs`, too by adding a method called `mutate_column_labels(...)` or similar?

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org