john-bodley commented on a change in pull request #13082:
URL: https://github.com/apache/superset/pull/13082#discussion_r574915077



##########
File path: superset/db_engine_specs/presto.py
##########
@@ -911,10 +912,14 @@ def where_latest_partition(  # pylint: 
disable=too-many-arguments
         if values is None:
             return None
 
-        column_names = {column.get("name") for column in columns or []}
+        column_names = {column.get("name") : column.get('type') for column in 
columns or []}

Review comment:
       Maybe this should be `column_type_by_name` and thus line 918 will be 
easier to grok. In that case you could roll lines 918 and 919 into one.

##########
File path: superset/db_engine_specs/presto.py
##########
@@ -911,10 +912,14 @@ def where_latest_partition(  # pylint: 
disable=too-many-arguments
         if values is None:
             return None
 
-        column_names = {column.get("name") for column in columns or []}
+        column_names = {column.get("name") : column.get('type') for column in 
columns or []}
         for col_name, value in zip(col_names, values):
             if col_name in column_names:
-                query = query.where(Column(col_name) == value)
+                col_type = column_names.get(col_name)
+                if col_type == 'TIMESTAMP':

Review comment:
       I agree the existing logic is wrong but I wonder if SQLAlchemy has a 
mechanism for auto-casting between the type of `value` and the column type for 
the comparison.




----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to