You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
get_inner_columns_with_types function (from clickhouse_driver.columns.util module) returns a wrong value when input spec argument has a trailing space character. For example:
get_inner_columns_with_types('test String') (no trailing space) returns [('test', 'String')] which is correct.
but get_inner_columns_with_types('test String ') (with a trailing space) returns [('test String', '')] (no type is detected) which is incorrect.
Real life example for trailing whitespace characters:
ch_client.execute(
external_tables=[{
'name': 'ext',
'structure': [('nested_field', '''Nested( test String )''')], # here trailing whitespaces appear
…
Possible solution
Maybe a simple spec.rstrip() should help. At least it helps when calling get_inner_columns_with_types('test String '.rstrip()) :)
As a part of a fix, I would also recommend replace elif x == ' ': with elif x.isspace()::
Example of a wrong behaviour
get_inner_columns_with_types
function (fromclickhouse_driver.columns.util
module) returns a wrong value when inputspec
argument has a trailing space character. For example:get_inner_columns_with_types('test String')
(no trailing space) returns[('test', 'String')]
which is correct.get_inner_columns_with_types('test String ')
(with a trailing space) returns[('test String', '')]
(no type is detected) which is incorrect.Real life example for trailing whitespace characters:
Possible solution
Maybe a simple
spec.rstrip()
should help. At least it helps when callingget_inner_columns_with_types('test String '.rstrip())
:)As a part of a fix, I would also recommend replace
elif x == ' ':
withelif x.isspace():
:clickhouse-driver/clickhouse_driver/columns/util.py
Line 57 in ce712b5
Versions
clickhouse_driver
version is 0.2.6The text was updated successfully, but these errors were encountered: