浏览代码

HUE-8554 [indexer] Protect against empty sample data that can be null

Romain Rigaux 7 年之前
父节点
当前提交
09c6a49cc8
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      desktop/libs/indexer/src/indexer/api3.py

+ 1 - 1
desktop/libs/indexer/src/indexer/api3.py

@@ -167,7 +167,7 @@ def guess_field_types(request):
     })
 
     # Note: Would also need to set charset to table (only supported in Hive)
-    if 'sample' in format_:
+    if 'sample' in format_ and format_['sample']:
       format_['sample'] = escape_rows(format_['sample'], nulls_only=True, encoding=encoding)
     for col in format_['columns']:
       col['name'] = smart_unicode(col['name'], errors='replace', encoding=encoding)