Pārlūkot izejas kodu

HUE-9059 [hive] Tables are missing first column in Assist with Hive on Tez

Romain 6 gadi atpakaļ
vecāks
revīzija
0fe07060fa
1 mainītis faili ar 6 papildinājumiem un 6 dzēšanām
  1. 6 6
      apps/beeswax/src/beeswax/server/hive_server2_lib.py

+ 6 - 6
apps/beeswax/src/beeswax/server/hive_server2_lib.py

@@ -112,15 +112,15 @@ class HiveServerTable(Table):
   @property
   def cols(self):
     rows = self.describe
-    col_row_index = 1
+    col_row_index = 0
     try:
-      cols = list(map(itemgetter('col_name'), rows[col_row_index:]))
-      if cols.index('') == 0: # TEZ starts at 1 vs Hive, Impala starts at 2
-        col_row_index = col_row_index + 1
-        cols.pop(0)
+      cols = [col.strip() for col in map(itemgetter('col_name'), rows[col_row_index:])]
+      if cols[0] == '# col_name': # Hive MR/Impala have headers and one blank line, Hive Tez has nothing
+        col_row_index = 2
+        cols = cols[2:]
       end_cols_index = cols.index('')
       return rows[col_row_index:][:end_cols_index] + self._get_partition_columns()
-    except ValueError:  # DESCRIBE on columns and nested columns does not always contain additional rows beyond cols
+    except ValueError: # DESCRIBE on nested columns does not always contain additional rows beyond cols
       return rows[col_row_index:]
     except:
       # Impala does not have it