浏览代码

HUE-2316 [metastore] Create a new table from a file requires Windows (\r\n) line endings

Romain Rigaux 11 年之前
父节点
当前提交
d8895da
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      apps/beeswax/src/beeswax/create_table.py

+ 2 - 2
apps/beeswax/src/beeswax/create_table.py

@@ -428,7 +428,7 @@ class GzipFileReader(object):
     except IOError:
     except IOError:
       return None
       return None
     try:
     try:
-      return unicode(data, encoding, errors='replace').split('\n')[:IMPORT_PEEK_NLINES]
+      return unicode(data, encoding, errors='replace').splitlines()[:IMPORT_PEEK_NLINES]
     except UnicodeError:
     except UnicodeError:
       return None
       return None
 
 
@@ -444,7 +444,7 @@ class TextFileReader(object):
     """readlines(fileobj, encoding) -> list of lines"""
     """readlines(fileobj, encoding) -> list of lines"""
     try:
     try:
       data = fileobj.read(IMPORT_PEEK_SIZE)
       data = fileobj.read(IMPORT_PEEK_SIZE)
-      return unicode(data, encoding, errors='replace').split('\n')[:IMPORT_PEEK_NLINES]
+      return unicode(data, encoding, errors='replace').splitlines()[:IMPORT_PEEK_NLINES]
     except UnicodeError:
     except UnicodeError:
       return None
       return None