Skip to content

Commit

Permalink
Fix self in to/from quads
Browse files Browse the repository at this point in the history
  • Loading branch information
xzkostyan committed Sep 20, 2023
1 parent caeec0a commit 41ba852
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions clickhouse_driver/columns/largeint.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cdef object MAX_UINT64 = writer.MAX_UINT64
cdef object MAX_INT64 = writer.MAX_INT64


def int128_from_quads(quad_items, unsigned long long n_items):
def int128_from_quads(self, quad_items, unsigned long long n_items):

This comment has been minimized.

Copy link
@shadchin

shadchin Mar 7, 2024

Now have

    return await self.run_in_executor(self._client.execute, *args,
/concurrent/futures/thread.py:58: in run
    result = self.fn(*self.args, **self.kwargs)
/clickhouse_driver/client.py:382: in execute
    rv = self.process_ordinary_query(
/clickhouse_driver/client.py:580: in process_ordinary_query
    return self.receive_result(with_column_types=with_column_types,
/clickhouse_driver/client.py:213: in receive_result
    return result.get_result()
/clickhouse_driver/result.py:50: in get_result
    for packet in self.packet_generator:
/clickhouse_driver/client.py:229: in packet_generator
    packet = self.receive_packet()
/clickhouse_driver/client.py:243: in receive_packet
    packet = self.connection.receive_packet()
/clickhouse_driver/connection.py:577: in receive_packet
    packet.block = self.receive_data(may_be_use_numpy=True)
/clickhouse_driver/connection.py:652: in receive_data
    return reader.read(use_numpy=use_numpy)
/clickhouse_driver/streams/native.py:83: in read
    column = read_column(
/clickhouse_driver/columns/service.py:154: in read_column
    return col.read_data(n_items, buf)
/clickhouse_driver/columns/base.py:162: in read_data
    items = self._read_data(n_items, buf, nulls_map=nulls_map)
/clickhouse_driver/columns/decimalcolumn.py:75: in _read_data
    return super(DecimalColumn, self)._read_data(
/clickhouse_driver/columns/base.py:166: in _read_data
    items = self.read_items(n_items, buf)
/clickhouse_driver/columns/intcolumn.py:121: in read_items
    return self.from_quads(items, n_items)
/clickhouse_driver/columns/largeint.pyx:10: in clickhouse_driver.columns.largeint.int128_from_quads
    ???
E   TypeError: int128_from_quads() takes exactly 3 positional arguments (2 given)

This comment has been minimized.

Copy link
@xzkostyan

xzkostyan Mar 7, 2024

Author Member

These code is covered by successfully passing tests.

It will be really helpful to add snippet that still produces the problem instead of posting bare stacktrace.

cdef unsigned int factor = 2
items = PyTuple_New(n_items)

Expand All @@ -33,7 +33,7 @@ def int128_from_quads(quad_items, unsigned long long n_items):
return items


def int128_to_quads(items, unsigned long long n_items):
def int128_to_quads(self, items, unsigned long long n_items):
cdef unsigned int factor = 2
quad_items = PyTuple_New(n_items * factor)

Expand Down Expand Up @@ -67,7 +67,7 @@ def int128_to_quads(items, unsigned long long n_items):
return quad_items


def uint128_from_quads(quad_items, unsigned long long n_items):
def uint128_from_quads(self, quad_items, unsigned long long n_items):
cdef unsigned int factor = 2
items = PyTuple_New(n_items)

Expand All @@ -84,7 +84,7 @@ def uint128_from_quads(quad_items, unsigned long long n_items):
return items


def uint128_to_quads(items, unsigned long long n_items):
def uint128_to_quads(self, items, unsigned long long n_items):
cdef unsigned int factor = 2
quad_items = PyTuple_New(n_items * factor)

Expand All @@ -108,7 +108,7 @@ def uint128_to_quads(items, unsigned long long n_items):
# 256 bits


def int256_from_quads(quad_items, unsigned long long n_items):
def int256_from_quads(self, quad_items, unsigned long long n_items):
cdef unsigned int factor = 4
items = PyTuple_New(n_items)

Expand Down Expand Up @@ -141,7 +141,7 @@ def int256_from_quads(quad_items, unsigned long long n_items):
return items


def int256_to_quads(items, unsigned long long n_items):
def int256_to_quads(self, items, unsigned long long n_items):
cdef unsigned int factor = 4
quad_items = PyTuple_New(n_items * factor)

Expand Down Expand Up @@ -191,7 +191,7 @@ def int256_to_quads(items, unsigned long long n_items):
return quad_items


def uint256_from_quads(quad_items, unsigned long long n_items):
def uint256_from_quads(self, quad_items, unsigned long long n_items):
cdef unsigned int factor = 4
items = PyTuple_New(n_items)

Expand All @@ -213,7 +213,7 @@ def uint256_from_quads(quad_items, unsigned long long n_items):
return items


def uint256_to_quads(items, unsigned long long n_items):
def uint256_to_quads(self, items, unsigned long long n_items):
cdef unsigned int factor = 4
quad_items = PyTuple_New(n_items * factor)

Expand Down

0 comments on commit 41ba852

Please sign in to comment.