tullis opened a new issue, #25636: URL: https://github.com/apache/superset/issues/25636
### Summary On Superset version 2.1.1 instance we can no longer see the table schema previews in SQL Lab. These were working for Superset version 1.5.3. <img src="https://github.com/apache/superset/assets/2117946/41baebf0-9ef9-4ef7-be4c-ece2fb5d332e" width="300"> ### Conditions * This only occurs when those tables are using Presto and a table `format = 'PARQUET'` * Other database types such as Druid and MySQL do not exhhibit this behaviour * This occurs when logged in as an Admin user, therefore I believe that it is likely unrelated to #25451 * When the presto table is using `format = 'TEXTFILE'` this error does not occur ### How to reproduce the bug 1. Go to Superset version 2.1.1 as an Admin user and select **SQL/SQL Lab** from the top menu 2. Select a database that uses the `presto` connector type 3. Select any schema 4. Select any table that uses a `format = 'PARQUET'` ### Expected results I would expect the left hand column to be populated with the column names from the selected schema. ### Actual results Several error messages appear stating that there were errors fetching table metadata and the left-hand column is not populated. #### Error messages in the server log We see some positive looking INFO messages (abbreviated for clarity). ``` INFO:pyhive.presto:SHOW FUNCTIONS INFO:pyhive.presto:SHOW COLUMNS FROM "wmf"."aqs_hourly" INFO:pyhive.presto:SELECT * FROM "aqs_hourly$partitions" ORDER BY year DESC, month DESC, day DESC, hour DESC LIMIT 1 INFO:pyhive.presto:SHOW CREATE VIEW wmf.aqs_hourly ``` This last `SHOW CREATE VIEW` command generates an error because it is a table, not a view.: ``` ERROR:flask_appbuilder.api:{'message': "line 1:1: Relation 'analytics_hive.wmf.aqs_hourly' is a table, not a view", 'errorCode': 1, 'errorName': 'SYNTAX_ERROR', 'errorType': 'USER_ERROR', 'boolean': False, 'errorLocation': {'lineNumber': 1, 'columnNumber': 1}, 'failureInfo': {'type': 'com.facebook.presto.sql.analyzer.SemanticException', 'message': "line 1:1: Relation 'analytics_hive.wmf.aqs_hourly' is a table, not a view", 'suppressed': [], 'stack': ['com.facebook.presto.sql.rewrite.ShowQueriesRewrite$Visitor.visitShowCreate(ShowQueriesRewrite.java:463)', 'com.facebook.presto.sql.rewrite.ShowQueriesRewrite$Visitor.visitShowCreate(ShowQueriesRewrite.java:178)', 'com.facebook.presto.sql.tree.ShowCreate.accept(ShowCreate.java:68)', 'com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:27)', 'com.facebook.presto.sql.rewrite.ShowQueriesRewrite.rewrite(ShowQueriesRewrite.java:175)', 'com.facebook.presto.sql.rewrite.StatementRewrite.rewrite(StatementRewrite.java:58)', 'com.fac ebook.presto.sql.analyzer.Analyzer.analyzeSemantic(Analyzer.java:94)', 'com.facebook.presto.sql.analyzer.BuiltInQueryAnalyzer.analyze(BuiltInQueryAnalyzer.java:80)', 'com.facebook.presto.execution.SqlQueryExecution.<init>(SqlQueryExecution.java:203)', 'com.facebook.presto.execution.SqlQueryExecution.<init>(SqlQueryExecution.java:107)', 'com.facebook.presto.execution.SqlQueryExecution$SqlQueryExecutionFactory.createQueryExecution(SqlQueryExecution.java:941)', 'com.facebook.presto.dispatcher.LocalDispatchQueryFactory.lambda$createDispatchQuery$0(LocalDispatchQueryFactory.java:167)', 'com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)', 'com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)', 'com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)', 'java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecu tor.java:1149)', 'java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)', 'java.lang.Thread.run(Thread.java:750)'], 'errorLocation': {'lineNumber': 1, 'columnNumber': 1}}} ``` This is followed by another stacktrace: ``` Traceback (most recent call last): File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/flask_appbuilder/api/__init__.py", line 110, in wraps return f(self, *args, **kwargs) File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/superset/views/base_api.py", line 122, in wraps raise ex File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/superset/views/base_api.py", line 113, in wraps duration, response = time_function(f, self, *args, **kwargs) File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/superset/utils/core.py", line 1594, in time_function response = func(*args, **kwargs) File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/superset/utils/log.py", line 266, in wrapper value = f(*args, **kwargs) File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/superset/databases/api.py", line 753, in table_extra_metadata payload = database.db_engine_spec.extra_table_metadata( File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/superset/db_engine_specs/presto.py", line 1182, in extra_table_metadata Any, cls.get_create_view(database, schema_name, table_name) File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/superset/db_engine_specs/presto.py", line 1208, in get_create_view rows = cls.fetch_data(cursor, 1) File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/superset/db_engine_specs/base.py", line 667, in fetch_data raise cls.get_dbapi_mapped_exception(ex) from ex File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/superset/db_engine_specs/base.py", line 665, in fetch_data return cursor.fetchall() File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/pyhive/common.py", line 142, in fetchall return list(iter(self.fetchone, None)) File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/pyhive/common.py", line 111, in fetchone self._fetch_while(lambda: not self._data and self._state != self._STATE_FINISHED) File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/pyhive/common.py", line 51, in _fetch_while self._fetch_more() File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/pyhive/presto.py", line 315, in _fetch_more self._process_response(self._requests_session.get(self._nextUri, **self._requests_kwargs)) File "/srv/deployment/analytics/superset/venv/lib/python3.9/site-packages/pyhive/presto.py", line 355, in _process_response raise DatabaseError(response_json['error']) ``` #### Screenshots <ins>**Error condition** on Superset version 2.1.1 with presto table using `format=PARQUET`</ins> <img src="https://github.com/apache/superset/assets/2117946/0a926d02-4c8c-4e02-8813-1637eb71e1da" width="600"> <ins>**No error** on Superset version 1.5.3 for the same table</ins> <img src="https://github.com/apache/superset/assets/2117946/9917dd22-865c-4792-b0a6-ca7ca7678abc" width="600"> <ins>**No error** on Superset version 2.1.1 with presto table using `format=TEXTFILE`</ins> <img src="https://github.com/apache/superset/assets/2117946/093c2c07-96ca-4da2-badb-92a179406ba3" width="600"> ### Environment - browser type and version: Firefox 118.0.1 (64-bit) on Linux, but this affects other browsers. - superset version: `2.1.1` - python version: `3.9.2` - node.js version: `16` - any feature flags active: - `ENABLE_TEMPLATE_PROCESSING` - `DASHBOARD_NATIVE_FILTERS` - `ENABLE_FILTER_BOX_MIGRATION` - metadata caching, memcached Metadata database: MariaDB 10.4 Presto version 0.281 Optional components: ``` pyhive[kerberos,presto]==0.7.0 gunicorn[gevent] apache-superset[hive,presto,mysql,druid,trino,spark,postgres] pylibmc==1.6.1 ``` ### 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. - [ ] I have reproduced the issue with at least the latest released version of superset. ( I will attempt to reproduce on Superset 3.0.0) - [x] I have checked the issue tracker for the same issue and I haven't found one similar. ### Additional context We have observed the same `Relation 'analytics_hive.wmf.aqs_hourly' is a table, not a view"` error message on Superset version 1.5.3 - However, it does not affect the display of the scema preview. This deployment uses pyhive version 0.6.2. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
