Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when compression=True and "send_logs_level": "debug" #203

Closed
smagellan opened this issue Mar 27, 2021 · 0 comments
Closed

Exception when compression=True and "send_logs_level": "debug" #203

smagellan opened this issue Mar 27, 2021 · 0 comments

Comments

@smagellan
Copy link
Contributor

smagellan commented Mar 27, 2021

Describe the bug
driver fails to process server answer if compression=True and "send_logs_level": "debug". Looks like server logs data block is transferred in non-compressed form.

To Reproduce

import clickhouse_driver
from clickhouse_driver import Client
from clickhouse_driver.util import helpers

if __name__ == '__main__':
    print(clickhouse_driver.__version__);
    client = Client(host='localhost', port='9000', database='default', user='default', password='default',
                    compression=True);
    settings = {'max_block_size': 50, 'insert_block_size': 2, "send_logs_level": "debug"};
    rv = client.execute("select * from system.data_type_families",
                                            settings=settings);
Output
0.2.0
Traceback (most recent call last):
  File "/home/vladimir/PycharmProjects/pythonProject/main.py", line 12, in <module>
    rv = client.execute("select * from system.data_type_families",
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/client.py", line 248, in execute
    rv = self.process_ordinary_query(
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/client.py", line 446, in process_ordinary_query
    return self.receive_result(with_column_types=with_column_types,
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/client.py", line 113, in receive_result
    return result.get_result()
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/result.py", line 50, in get_result
    for packet in self.packet_generator:
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/client.py", line 129, in packet_generator
    packet = self.receive_packet()
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/client.py", line 143, in receive_packet
    packet = self.connection.receive_packet()
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/connection.py", line 477, in receive_packet
    block = self.receive_data()
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/connection.py", line 527, in receive_data
    return self.block_in.read()
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/streams/native.py", line 59, in read
    info.read(self.fin)
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/block.py", line 22, in read
    field_num = read_varint(buf)
  File "clickhouse_driver/varint.pyx", line 62, in clickhouse_driver.varint.read_varint
  File "clickhouse_driver/bufferedreader.pyx", line 55, in clickhouse_driver.bufferedreader.BufferedReader.read_one
  File "clickhouse_driver/bufferedreader.pyx", line 251, in clickhouse_driver.bufferedreader.CompressedBufferedReader.read_into_buffer
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/streams/compressed.py", line 78, in read_block
    decompressor_cls = get_decompressor_cls(method_byte)
  File "/home/vladimir/.local/lib/python3.9/site-packages/clickhouse_driver/compression/__init__.py", line 26, in get_decompressor_cls
    raise errors.UnknownCompressionMethod()
clickhouse_driver.errors.UnknownCompressionMethod: Code: 89.

Expected behavior
No exception. Compare with case when compression=False and "send_logs_level": "debug":

0.2.0
[('Polygon', 0, ''), ('Ring', 0, ''), ('MultiPolygon', 0, ''), ('IPv6', 0, ''), ('IntervalSecond', 0, ''), ('IPv4', 0, ''), ('UInt32', 0, ''), ('IntervalYear', 0, ''), ('IntervalQuarter', 0, ''), ('IntervalMonth', 0, ''), ('Int64', 0, ''), ('IntervalDay', 0, ''), ('IntervalHour', 0, ''), ('UInt256', 0, ''), ('Int16', 0, ''), ('LowCardinality', 0, ''), ('AggregateFunction', 0, ''), ('Nothing', 0, ''), ('Decimal256', 1, ''), ('Tuple', 0, ''), ('Array', 0, ''), ('Enum16', 0, ''), ('IntervalMinute', 0, ''), ('FixedString', 0, ''), ('String', 0, ''), ('DateTime', 1, ''), ('Map', 0, ''), ('UUID', 0, ''), ('Decimal64', 1, ''), ('Nullable', 0, ''), ('Enum', 0, ''), ('Int32', 0, ''), ('UInt8', 0, ''), ('Date', 1, ''), ('Decimal32', 1, ''), ('Point', 0, ''), ('Float64', 0, ''), ('DateTime64', 1, ''), ('Int128', 0, ''), ('Decimal128', 1, ''), ('Int8', 0, ''), ('SimpleAggregateFunction', 0, ''), ('Nested', 0, ''), ('Decimal', 1, ''), ('Int256', 0, ''), ('IntervalWeek', 0, ''), ('UInt64', 0, ''), ('Enum8', 0, ''), ('DateTime32', 1, ''), ('UInt16', 0, ''), ('Float32', 0, ''), ('INET6', 1, 'IPv6'), ('INET4', 1, 'IPv4'), ('BINARY', 1, 'FixedString'), ('NATIONAL CHAR VARYING', 1, 'String'), ('BINARY VARYING', 1, 'String'), ('NCHAR LARGE OBJECT', 1, 'String'), ('NATIONAL CHARACTER VARYING', 1, 'String'), ('NATIONAL CHARACTER LARGE OBJECT', 1, 'String'), ('NATIONAL CHARACTER', 1, 'String'), ('NATIONAL CHAR', 1, 'String'), ('CHARACTER VARYING', 1, 'String'), ('LONGBLOB', 1, 'String'), ('MEDIUMTEXT', 1, 'String'), ('TEXT', 1, 'String'), ('TINYBLOB', 1, 'String'), ('VARCHAR2', 1, 'String'), ('CHARACTER LARGE OBJECT', 1, 'String'), ('DOUBLE PRECISION', 1, 'Float64'), ('LONGTEXT', 1, 'String'), ('NVARCHAR', 1, 'String'), ('INT1 UNSIGNED', 1, 'UInt8'), ('VARCHAR', 1, 'String'), ('CHAR VARYING', 1, 'String'), ('MEDIUMBLOB', 1, 'String'), ('NCHAR', 1, 'String'), ('CHAR', 1, 'String'), ('SMALLINT UNSIGNED', 1, 'UInt16'), ('TIMESTAMP', 1, 'DateTime'), ('FIXED', 1, 'Decimal'), ('TINYTEXT', 1, 'String'), ('NUMERIC', 1, 'Decimal'), ('DEC', 1, 'Decimal'), ('TINYINT UNSIGNED', 1, 'UInt8'), ('INTEGER UNSIGNED', 1, 'UInt32'), ('INT UNSIGNED', 1, 'UInt32'), ('CLOB', 1, 'String'), ('MEDIUMINT UNSIGNED', 1, 'UInt32'), ('BOOL', 1, 'Int8'), ('SMALLINT', 1, 'Int16'), ('INTEGER SIGNED', 1, 'Int32'), ('NCHAR VARYING', 1, 'String'), ('INT SIGNED', 1, 'Int32'), ('TINYINT SIGNED', 1, 'Int8'), ('BIGINT SIGNED', 1, 'Int64'), ('BINARY LARGE OBJECT', 1, 'String'), ('SMALLINT SIGNED', 1, 'Int16'), ('MEDIUMINT', 1, 'Int32'), ('INTEGER', 1, 'Int32'), ('INT1 SIGNED', 1, 'Int8'), ('BIGINT UNSIGNED', 1, 'UInt64'), ('BYTEA', 1, 'String'), ('INT', 1, 'Int32'), ('SINGLE', 1, 'Float32'), ('FLOAT', 1, 'Float32'), ('MEDIUMINT SIGNED', 1, 'Int32'), ('BOOLEAN', 1, 'Int8'), ('DOUBLE', 1, 'Float64'), ('INT1', 1, 'Int8'), ('CHAR LARGE OBJECT', 1, 'String'), ('TINYINT', 1, 'Int8'), ('BIGINT', 1, 'Int64'), ('CHARACTER', 1, 'String'), ('BYTE', 1, 'Int8'), ('BLOB', 1, 'String'), ('REAL', 1, 'Float32')]

Versions

ClickHouse server version: 21.3.3 revision 54447.
Driver version: 0.2.0
Python version: 3.9.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant