You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "giftig (via GitHub)" <gi...@apache.org> on 2023/05/15 13:02:15 UTC

[GitHub] [superset] giftig opened a new issue, #24055: Preview table query fails for trino tables with date partition

giftig opened a new issue, #24055:
URL: https://github.com/apache/superset/issues/24055

   An error is seen on the frontend as a result of running the preview table query in SQL Lab; this appears to be a regression in 2.1. The error reads:
   
   ```
   Cannot apply operator: date = varchar(10)
   ```
   and the underlying query looks like:
   
   ```sql
   SELECT (redacted fields),
                 ...,
                 date
   FROM my_schema.my_table
   WHERE date = '2023-04-17'
   LIMIT 100
   ```
   This is due to comparing text with a date field here, as the query should read `WHERE date = DATE '2023-04-17'` instead.
   
   #### How to reproduce the bug
   
   1. Connect a trino database with a table partitioned on a DATE column
   2. Go to SQL Lab
   3. Select the appropriate database, schema, and table
   4. See preview query run and result in the above error
   
   ### Expected results
   
   The preview should provide an actual preview of the table
   
   ### Actual results
   
   The above error. Full stacktrace here:
   
   ```
   superset.exceptions.SupersetErrorsException: [SupersetError(message='trino error: line 11:12: Cannot apply operator: date = varchar(10)', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'Trino', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})]
   2023-05-11 14:44:29,745:WARNING:superset.views.base:SupersetErrorsException
   Traceback (most recent call last):
     File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1517, in full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1503, in dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
     File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
       return f(self, *args, **kwargs)
     File "/opt/superset/superset/views/base_api.py", line 122, in wraps
       raise ex
     File "/opt/superset/superset/views/base_api.py", line 113, in wraps
       duration, response = time_function(f, self, *args, **kwargs)
     File "/opt/superset/superset/utils/core.py", line 1586, in time_function
       response = func(*args, **kwargs)
     File "/opt/superset/superset/views/base_api.py", line 85, in wraps
       return f(self, *args, **kwargs)
     File "/opt/superset/superset/utils/log.py", line 266, in wrapper
       value = f(*args, **kwargs)
     File "/opt/superset/superset/sqllab/api.py", line 256, in execute_sql_query
       command_result: CommandResult = command.run()
     File "/opt/superset/superset/sqllab/commands/execute.py", line 121, in run
       raise ex
     File "/opt/superset/superset/sqllab/commands/execute.py", line 103, in run
       status = self._run_sql_json_exec_from_scratch()
     File "/opt/superset/superset/sqllab/commands/execute.py", line 162, in _run_sql_json_exec_from_scratch
       raise ex
     File "/opt/superset/superset/sqllab/commands/execute.py", line 157, in _run_sql_json_exec_from_scratch
       return self._sql_json_executor.execute(
     File "/opt/superset/superset/sqllab/sql_json_executer.py", line 111, in execute
       raise SupersetErrorsException(
   superset.exceptions.SupersetErrorsException: [SupersetError(message='trino error: line 11:12: Cannot apply operator: date = varchar(10)', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'Trino', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})]
   ```
   Note that the error is somewhat difficult to trace from this alone, as the frontend gets the query from one endpoint, where it's provided as `selectStar`, and comes from the DB engine spec, and then posts that SQL to the normal run SQL endpoint, which is where the above stack trace occurs.
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: all
   - superset version: `2.1`
   - python version: `python --version`
   - node.js version: `node -v`
   - any feature flags active:
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   ### Additional context
   
   Add any other context about the problem here.
   


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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [I] Preview table query fails for trino tables with date partition [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #24055:
URL: https://github.com/apache/superset/issues/24055#issuecomment-1965520595

   Assuming this was resolved by the linked PR. If not, feel free to re-open and update context as warranted.


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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] giftig commented on issue #24055: Preview table query fails for trino tables with date partition

Posted by "giftig (via GitHub)" <gi...@apache.org>.
giftig commented on issue #24055:
URL: https://github.com/apache/superset/issues/24055#issuecomment-1547824104

   PR: https://github.com/apache/superset/pull/24054
   Slack discussion: https://apache-superset.slack.com/archives/C015WAZL0KH/p1683881155589549


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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [I] Preview table query fails for trino tables with date partition [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #24055: Preview table query fails for trino tables with date partition
URL: https://github.com/apache/superset/issues/24055


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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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