TypeError: expected string or bytes-like object
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
Research direction
Start in pyhive/sqlalchemy_hive.py at HiveDialect.get_columns, especially the parsing around line 324, and reproduce the failure with the supplied Hive schema containing a newline in a column comment. Check the existing SQLAlchemy dialect tests for get_columns; done means reflection no longer raises TypeError for this schema and returns the column metadata.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 545
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dropbox/PyHive
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100