فهرست منبع

HUE-6077 [metadata] Add proper metadata information to the query upload

Romain Rigaux 8 سال پیش
والد
کامیت
47b8b81f57

+ 1 - 1
desktop/libs/metadata/src/metadata/optimizer_api.py

@@ -311,7 +311,7 @@ def _convert_queries(queries_data):
       original_query_id = '%s:%s' % struct.unpack(b"QQ", base64.decodestring(query_data['snippets'][0]['result']['handle']['guid']))
       execution_time = query_data['snippets'][0]['result']['executionTime'] * 100
       statement = ' '.join([line for line in _get_statement(query_data).strip().splitlines() if not line.strip().startswith('--')])
-      queries.append((original_query_id, execution_time, statement, query_data['snippets'][0].get('database', 'default')))
+      queries.append((original_query_id, execution_time, statement, query_data['snippets'][0].get('database', 'default').strip()))
     except Exception, e:
       LOG.warning('Skipping upload of %s: %s' % (query_data['uuid'], e))
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
desktop/libs/metadata/src/metadata/optimizer_api_tests.py


+ 7 - 10
desktop/libs/metadata/src/metadata/optimizer_client.py

@@ -96,6 +96,12 @@ class OptimizerApi(object):
       extra_parameters = {
           'colDelim': ',',
           'rowDelim': '\n',
+          "headerFields": [
+            {"count": 0, "name": "SQL_ID", "coltype": "SQL_ID", "use": True, "tag": ""},
+            {"count": 0, "name": "ELAPSED_TIME", "coltype": "NONE", "use": True, "tag": ""},
+            {"count": 0, "name": "SQL_FULLTEXT", "coltype": "SQL_QUERY", "use": True, "tag": ""},
+            {"count": 0, "name": "DATABASE", "coltype": "NONE", "use": True, "tag": "DATABASE"}
+          ],
       }
 
     f_queries_path = NamedTemporaryFile(suffix=data_suffix)
@@ -227,17 +233,8 @@ class OptimizerApi(object):
     return self._call('getTopDatabases', args)
 
 
-  UPLOAD = {
-    'queries': {
-      'headers': ['SQL_ID', 'ELAPSED_TIME', 'SQL_FULLTEXT', 'DATABASE'],
-      "colDelim": ",",
-      "rowDelim": "\\n",
-    }
-  }
-
-
 def OptimizerQueryDataAdapter(data):
-  headers = OptimizerApi.UPLOAD['queries']['headers']
+  headers = ['SQL_ID', 'ELAPSED_TIME', 'SQL_FULLTEXT', 'DATABASE']
 
   if data and len(data[0]) == 4:
     rows = data

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است