Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spark-SQL - Hiveserver2 interface does not show tables as prompt #2973

Closed
divincode opened this issue Sep 1, 2022 · 8 comments
Closed

Spark-SQL - Hiveserver2 interface does not show tables as prompt #2973

divincode opened this issue Sep 1, 2022 · 8 comments

Comments

@divincode
Copy link
Contributor

divincode commented Sep 1, 2022

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:
Use spark-sql with hiveserver2 interface
we can see the following error

sparksql-livy

while in livy interface table
spark_sql-hive

Steps to reproduce it?
Steps are simple.

Hue version or source? (e.g. open source 4.5, CDH 5.16, CDP 1.0...). System info (e.g. OS, Browser...).
4.10

@divincode
Copy link
Contributor Author

Went deep into the code the error showing -

RCA -

Traceback (most recent call last):
File "/usr/lib/hue/apps/beeswax/src/beeswax/api.py", line 129, in _autocomplete
tables_meta = db.get_tables_meta(database=database)
File "/usr/lib/hue/apps/beeswax/src/beeswax/server/dbms.py", line 381, in get_tables_meta
tables = self._get_tables_via_sparksql(database, identifier)
File "/usr/lib/hue/apps/beeswax/src/beeswax/server/dbms.py", line 432, in _get_tables_via_sparksql
for row in result.rows()

Let me give context fxn call ->
api call -> /api/editor/autocomplete/(database_name) - >
def _autocomplete(db, database) (beeswax/src/beeswax/api.py) - >
def get_tables_meta() (beeswax/src/beeswax/server/dbms.py) ->
def _get_tables_via_sparksql() (beeswax/src/beeswax/server/dbms.py) -> error in this fxn
def fetch() (beeswax/src/beeswax/server/dbms.py) ->
def fetch() (beeswax/src/beeswax/server/hive_server2_lib.py) returns and wraps ResultCompatible(class)
Last fxn in the trace -
def fetch_data() beeswax/src/beeswax/server/hive_server2_lib.py)
returns the results,schema in a wrapper of HiveServerDataTable(class)

TFetchResultsResp(status=TStatus(errorCode=None, errorMessage=None, sqlState=None, infoMessages=None, statusCode=0), results=TRowSet(columnCount=None, binaryColumns=None, rows=[], columns=[TColumn(i32Val=None, byteVal=None, i16Val=None, i64Val=None, stringVal=TStringColumn(nulls='\x00', values=['call_center', 'catalog_page', 'catalog_returns', 'catalog_sales', 'customer', 'customer_address', 'customer_demographics', 'date_dim', 'household_demographics', 'income_band', 'inventory', 'item', 'promotion', 'reason', 'ship_mode', 'store', 'store_returns', 'store_sales', 'time_dim', 'warehouse', 'web_page', 'web_returns', 'web_sales', 'web_site']), boolVal=None, doubleVal=None, binaryVal=None)], startRowOffset=0), hasMoreRows=False)

As we can see in values we get the tables data eg ('catalog_page', 'catalog_returns', 'catalog_sales', 'customer', 'customer_address', 'customer_demographics', ) but there seems to be wrong implementation multiple wrappers.

the main part of this def _get_tables_via_sparksql() (beeswax/src/beeswax/server/dbms.py) -
hql = "SHOW TABLES IN %s" % database
query = hql_query(hql)
handle = self.execute_and_wait(query, timeout_sec=timeout)
result = self.fetch(handle, rows=5000)
return [{
'name': row[1],
'type': 'VIEW' if row[2] else 'TABLE',
'comment': ''
}
for row in result.rows()

Now the result is a beeswax.server.hive_server2_lib.ResultCompatible object and .rows() is generators fxn which is bounded by the inner class HiveServerDataTable.Thats why we get IndexError: list index out of range .

@divincode
Copy link
Contributor Author

@Harshg999 any suggestions.

@divincode divincode changed the title Spark-SQL - livy interface does not show tables as prompt Spark-SQL - Hiveserver2 interface does not show tables as prompt Sep 26, 2022
@divincode
Copy link
Contributor Author

#3012 created a pr for the same.

@divincode
Copy link
Contributor Author

divincode commented Sep 26, 2022

@romainr @Harshg999 Do guide.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity and is not "roadmap" labeled or part of any milestone. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Oct 27, 2022
@Harshg999 Harshg999 removed the Stale label Oct 28, 2022
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity and is not "roadmap" labeled or part of any milestone. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Nov 28, 2022
@Harshg999
Copy link
Collaborator

Hi @divincode, the PR with your changes is closed. Will you be reopening it and take this issue up?

@Harshg999 Harshg999 removed the Stale label Nov 29, 2022
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity and is not "roadmap" labeled or part of any milestone. Remove stale label or comment or this will be closed in 5 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants