Is the issue already present in https://github.com/cloudera/hue/issues or discussed in the forum https://discourse.gethue.com?
no
Describe the bug:
session ids mismatch in notebook, which leads to the exception in hue server.
Traceback (most recent call last):
File "/usr/lib/emr/current/hue/desktop/libs/notebook/src/notebook/decorators.py", line 119, in wrapper
return f(*args, **kwargs)
File "/usr/lib/emr/current/hue/desktop/libs/notebook/src/notebook/api.py", line 236, in execute
response = _execute_notebook(request, notebook, snippet)
File "/usr/lib/emr/current/hue/desktop/libs/notebook/src/notebook/api.py", line 161, in _execute_notebook
response['handle'] = interpreter.execute(notebook, snippet)
File "/usr/lib/emr/current/hue/desktop/libs/notebook/src/notebook/connectors/hiveserver2.py", line 99, in decorator
return func(*args, **kwargs)
File "/usr/lib/emr/current/hue/desktop/libs/notebook/src/notebook/connectors/hiveserver2.py", line 322, in execute
_session = self._get_session_by_id(notebook, snippet['type'])
File "/usr/lib/emr/current/hue/desktop/libs/notebook/src/notebook/connectors/hiveserver2.py", line 721, in _get_session_by_id
return Session.objects.get(**filters)
File "/usr/lib/emr/current/hue/build/env/lib/python2.7/site-packages/Django-1.11.29-py2.7.egg/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/lib/emr/current/hue/build/env/lib/python2.7/site-packages/Django-1.11.29-py2.7.egg/django/db/models/query.py", line 380, in get
self.model._meta.object_name
DoesNotExist: Session matching query does not exist.
Steps to reproduce it?
- create a blank notebook
- add a hive snippet, which invokes api /notebook/api/create_session, the response is
{"status": 0, "session": {"reuse_session": false, "session_id": "2b47d9a6457354c0:9f8030b890dbe8af", "properties": [{"multiple": true, "defaultValue": [], "value": [], "nice_name": "Files", "key": "files", "help_text": "Add one or more files, jars, or archives to the list of resources.", "type": "hdfs-files"}, {"multiple": true, "defaultValue": [], "value": [], "nice_name": "Functions", "key": "functions", "help_text": "Add one or more registered UDFs (requires function name and fully-qualified class name).", "type": "functions"}, {"nice_name": "Settings", "multiple": true, "key": "settings", "help_text": "Hive and Hadoop configuration properties.", "defaultValue": [], "type": "settings", "options": ["hive.map.aggr", "hive.exec.compress.output", "hive.exec.parallel", "hive.execution.engine", "mapreduce.job.queuename"], "value": []}], "configuration": {"hive.map.aggr": "true", "hive.execution.engine": "tez", "mapreduce.job.queuename": "default", "hive.exec.parallel": "true", "hive.exec.compress.output": "false", "hive.server2.thrift.resultset.default.fetch.size": "1000"}, "type": "hive", "id": 101}}
session id is 101
3. execute hive sql, it passes.
4. add a sparksql snippet, which also invokes api /notebook/api/create_session, the response is
{"status": 0, "session": {"reuse_session": false, "session_id": "4745b846bfcd60a7:ab1a5701d2f35983", "properties": [{"multiple": true, "defaultValue": [], "value": [], "nice_name": "Files", "key": "files", "help_text": "Add one or more files, jars, or archives to the list of resources.", "type": "hdfs-files"}, {"multiple": true, "defaultValue": [], "value": [], "nice_name": "Functions", "key": "functions", "help_text": "Add one or more registered UDFs (requires function name and fully-qualified class name).", "type": "functions"}, {"nice_name": "Settings", "multiple": true, "key": "settings", "help_text": "Hive and Hadoop configuration properties.", "defaultValue": [], "type": "settings", "options": ["hive.map.aggr", "hive.exec.compress.output", "hive.exec.parallel", "hive.execution.engine", "mapreduce.job.queuename"], "value": []}], "configuration": {}, "type": "sparksql", "id": 103}}
session id is 103
5. execute one sparksql, it passes.
6. reexecute the hive sql, error happens: Session matching query does not exist.
I find it happens because the session ids of hive and sparksql mismatch.
E.g. reexecute the hive sql invokes api /notebook/api/execute/hive, and the notebook field in payload is
{"id":null,"uuid":"05536e0a-016b-4b38-b547-b492733fe6c9","parentSavedQueryUuid":null,"isSaved":false,"sessions":[{"type":"hive","properties":[{"multiple":true,"defaultValue":[],"value":[],"nice_name":"Files","key":"files","help_text":"Add one or more files, jars, or archives to the list of resources.","type":"hdfs-files"},{"multiple":true,"defaultValue":[],"value":[],"nice_name":"Functions","key":"functions","help_text":"Add one or more registered UDFs (requires function name and fully-qualified class name).","type":"functions"},{"nice_name":"Settings","multiple":true,"key":"settings","help_text":"Hive and Hadoop configuration properties.","defaultValue":[],"type":"settings","options":["hive.map.aggr","hive.exec.compress.output","hive.exec.parallel","hive.execution.engine","mapreduce.job.queuename"],"value":[]}],"reuse_session":false,"session_id":"4745b846bfcd60a7:ab1a5701d2f35983","configuration":{"hive.map.aggr":"true","hive.execution.engine":"tez","mapreduce.job.queuename":"default","hive.exec.parallel":"true","hive.exec.compress.output":"false","hive.server2.thrift.resultset.default.fetch.size":"1000"},"id":103},{"type":"sparksql","properties":[{"multiple":true,"defaultValue":[],"value":[],"nice_name":"Files","key":"files","help_text":"Add one or more files, jars, or archives to the list of resources.","type":"hdfs-files"},{"multiple":true,"defaultValue":[],"value":[],"nice_name":"Functions","key":"functions","help_text":"Add one or more registered UDFs (requires function name and fully-qualified class name).","type":"functions"},{"nice_name":"Settings","multiple":true,"key":"settings","help_text":"Hive and Hadoop configuration properties.","defaultValue":[],"type":"settings","options":["hive.map.aggr","hive.exec.compress.output","hive.exec.parallel","hive.execution.engine","mapreduce.job.queuename"],"value":[]}],"reuse_session":false,"session_id":"4745b846bfcd60a7:ab1a5701d2f35983","configuration":{},"id":103}],"type":"notebook","name":"My Notebook"}
We can see that session ids of hive and sparsql are both 103, instead of hive 101, sparksql 103.
Hue version or source? (e.g. open source 4.5, CDH 5.16, CDP 1.0...). System info (e.g. OS, Browser...).
open source 4.9.0
editor