PyHive
PyHive copied to clipboard
TypeError: expected string or bytes-like object
my hive table comment contain '\n'
hive schema:
CREATE EXTERNAL TABLE test
.test_01
( name
string COMMENT 'aa bb\ncc');
pyhive rows:
['name', 'string', 'aa bb
cc']
TypeError: expected string or bytes-like object File "/usr/lib/python3.6.14/lib/python3.6/site-packages/pyhive/sqlalchemy_hive.py", line 324, in get_columns 311 def get_columns(self, connection, table_name, schema=None, **kw): (...) 320 break 321 # Take out the more detailed type information 322 # e.g. 'map<int,int>' -> 'map' 323 # 'decimal(10,1)' -> decimal --> 324 col_type = re.search(r'^\w+', full_col_type).group(0) 325 try: .................................................. self = <pyhive.sqlalchemy_hive.HiveDialect object at 0x7ff3fd0d2cc0> connection = <sqlalchemy.engine.base.Connection object at 0x7ff3cad2e0b8> table_name = 'ewsgz_ods_pck_info' schema = 'hudi' kw = {'info_cache': {}} col_type = 'bigint' re.search = <function 'search' re.py:179> full_col_type = None ..................................................
File "/usr/lib/python3.6.14/lib/python3.6/re.py", line 182, in search 179 def search(pattern, string, flags=0): 180 """Scan through string looking for a match to the pattern, returning 181 a match object, or None if no match was found.""" --> 182 return _compile(pattern, flags).search(string) .................................................. pattern = '^\w+' string = None flags = 0