浏览代码

HUE-3583 [editor] Make split_statements performant for extremely large queries

Jenny Kim 9 年之前
父节点
当前提交
44372be
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

+ 4 - 1
desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

@@ -15,6 +15,7 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
+import cStringIO
 import logging
 import logging
 import re
 import re
 
 
@@ -302,8 +303,10 @@ class HS2Api(Api):
 
 
   def _get_statements(self, hql_query):
   def _get_statements(self, hql_query):
     hql_query = strip_trailing_semicolon(hql_query)
     hql_query = strip_trailing_semicolon(hql_query)
+    hql_query_sio = cStringIO.StringIO(hql_query)
+
     statements = []
     statements = []
-    for (start_row, start_col), (end_row, end_col), statement in split_statements(hql_query):
+    for (start_row, start_col), (end_row, end_col), statement in split_statements(hql_query_sio.read()):
       statements.append({
       statements.append({
         'start': {
         'start': {
           'row': start_row,
           'row': start_row,