Skip to content

Commit 6258e6e

Browse files
committed
Intermediate changes
commit_hash:1338f91346a59e6bbff8c8f2444e990a51dc2e63
1 parent 1e95bf1 commit 6258e6e

File tree

11 files changed

+71
-58
lines changed

11 files changed

+71
-58
lines changed

contrib/libs/croaring/.yandex_meta/override.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
pkgs: attrs: with pkgs; with attrs; rec {
22
pname = "croaring";
3-
version = "4.2.0";
3+
version = "4.2.1";
44

55
src = fetchFromGitHub {
66
owner = "RoaringBitmap";
77
repo = "CRoaring";
88
rev = "v${version}";
9-
hash = "sha256-PzwtQDAsnRGIjeb3Ax6qqXtdEqtwaCWsj6g46J3Oqm0=";
9+
hash = "sha256-qOFkDu0JM+wBIlGGyewojicCp2pmtr643J3dW6el+O4=";
1010
};
1111

1212
patches = [];

contrib/libs/croaring/README.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -530,55 +530,55 @@ bitset_free(b); // frees memory
530530
More advanced example:
531531
532532
```C
533-
bitset_t *b = bitset_create();
534-
for (int k = 0; k < 1000; ++k) {
535-
bitset_set(b, 3 * k);
536-
}
537-
// We have bitset_count(b) == 1000.
538-
// We have bitset_get(b, 3) is true
539-
// You can iterate through the values:
540-
size_t k = 0;
541-
for (size_t i = 0; bitset_next_set_bit(b, &i); i++) {
542-
// You will have i == k
543-
k += 3;
544-
}
545-
// We support a wide range of operations on two bitsets such as
546-
// bitset_inplace_symmetric_difference(b1,b2);
547-
// bitset_inplace_symmetric_difference(b1,b2);
548-
// bitset_inplace_difference(b1,b2);// should make no difference
549-
// bitset_inplace_union(b1,b2);
550-
// bitset_inplace_intersection(b1,b2);
551-
// bitsets_disjoint
552-
// bitsets_intersect
533+
bitset_t *b = bitset_create();
534+
for (int k = 0; k < 1000; ++k) {
535+
bitset_set(b, 3 * k);
536+
}
537+
// We have bitset_count(b) == 1000.
538+
// We have bitset_get(b, 3) is true
539+
// You can iterate through the values:
540+
size_t k = 0;
541+
for (size_t i = 0; bitset_next_set_bit(b, &i); i++) {
542+
// You will have i == k
543+
k += 3;
544+
}
545+
// We support a wide range of operations on two bitsets such as
546+
// bitset_inplace_symmetric_difference(b1,b2);
547+
// bitset_inplace_symmetric_difference(b1,b2);
548+
// bitset_inplace_difference(b1,b2);// should make no difference
549+
// bitset_inplace_union(b1,b2);
550+
// bitset_inplace_intersection(b1,b2);
551+
// bitsets_disjoint
552+
// bitsets_intersect
553553
```
554554

555555
In some instances, you may want to convert a Roaring bitmap into a conventional (uncompressed) bitset.
556556
Indeed, bitsets have advantages such as higher query performances in some cases. The following code
557557
illustrates how you may do so:
558558

559559
```C
560-
roaring_bitmap_t *r1 = roaring_bitmap_create();
561-
for (uint32_t i = 100; i < 100000; i+= 1 + (i%5)) {
560+
roaring_bitmap_t *r1 = roaring_bitmap_create();
561+
for (uint32_t i = 100; i < 100000; i+= 1 + (i%5)) {
562562
roaring_bitmap_add(r1, i);
563-
}
564-
for (uint32_t i = 100000; i < 500000; i+= 100) {
563+
}
564+
for (uint32_t i = 100000; i < 500000; i+= 100) {
565565
roaring_bitmap_add(r1, i);
566-
}
567-
roaring_bitmap_add_range(r1, 500000, 600000);
568-
bitset_t * bitset = bitset_create();
569-
bool success = roaring_bitmap_to_bitset(r1, bitset);
570-
assert(success); // could fail due to memory allocation.
571-
assert(bitset_count(bitset) == roaring_bitmap_get_cardinality(r1));
572-
// You can then query the bitset:
573-
for (uint32_t i = 100; i < 100000; i+= 1 + (i%5)) {
574-
assert(bitset_get(bitset,i));
575-
}
576-
for (uint32_t i = 100000; i < 500000; i+= 100) {
577-
assert(bitset_get(bitset,i));
578-
}
579-
// you must free the memory:
580-
bitset_free(bitset);
581-
roaring_bitmap_free(r1);
566+
}
567+
roaring_bitmap_add_range(r1, 500000, 600000);
568+
bitset_t * bitset = bitset_create();
569+
bool success = roaring_bitmap_to_bitset(r1, bitset);
570+
assert(success); // could fail due to memory allocation.
571+
assert(bitset_count(bitset) == roaring_bitmap_get_cardinality(r1));
572+
// You can then query the bitset:
573+
for (uint32_t i = 100; i < 100000; i+= 1 + (i%5)) {
574+
assert(bitset_get(bitset,i));
575+
}
576+
for (uint32_t i = 100000; i < 500000; i+= 100) {
577+
assert(bitset_get(bitset,i));
578+
}
579+
// you must free the memory:
580+
bitset_free(bitset);
581+
roaring_bitmap_free(r1);
582582
```
583583
584584
You should be aware that a convention bitset (`bitset_t *`) may use much more

contrib/libs/croaring/include/roaring/roaring_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// /include/roaring/roaring_version.h automatically generated by release.py, do not change by hand
33
#ifndef ROARING_INCLUDE_ROARING_VERSION
44
#define ROARING_INCLUDE_ROARING_VERSION
5-
#define ROARING_VERSION "4.2.0"
5+
#define ROARING_VERSION "4.2.1"
66
enum {
77
ROARING_VERSION_MAJOR = 4,
88
ROARING_VERSION_MINOR = 2,
9-
ROARING_VERSION_REVISION = 0
9+
ROARING_VERSION_REVISION = 1
1010
};
1111
#endif // ROARING_INCLUDE_ROARING_VERSION
1212
// clang-format on

contrib/libs/croaring/src/containers/bitset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ int bitset_container_##opname##_nocard(const bitset_container_t *src_1, \
904904
} \
905905
int bitset_container_##opname##_justcard(const bitset_container_t *src_1, \
906906
const bitset_container_t *src_2) { \
907-
printf("A1\n"); const uint64_t * __restrict__ words_1 = src_1->words; \
907+
const uint64_t * __restrict__ words_1 = src_1->words; \
908908
const uint64_t * __restrict__ words_2 = src_2->words; \
909909
int32_t sum = 0; \
910910
for (size_t i = 0; i < BITSET_CONTAINER_SIZE_IN_WORDS; i += 2) { \

contrib/libs/croaring/ya.make

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ LICENSE(
1010

1111
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
1212

13-
VERSION(4.2.0)
13+
VERSION(4.2.1)
1414

15-
ORIGINAL_SOURCE(https://github.com/RoaringBitmap/CRoaring/archive/v4.2.0.tar.gz)
15+
ORIGINAL_SOURCE(https://github.com/RoaringBitmap/CRoaring/archive/v4.2.1.tar.gz)
1616

1717
ADDINCL(
1818
GLOBAL contrib/libs/croaring/include

contrib/python/clickhouse-connect/.dist-info/METADATA

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: clickhouse-connect
3-
Version: 0.8.1
3+
Version: 0.8.2
44
Summary: ClickHouse Database Core Driver for Python, Pandas, and Superset
55
Home-page: https://github.com/ClickHouse/clickhouse-connect
66
Author: ClickHouse Inc.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '0.8.1'
1+
version = '0.8.2'

contrib/python/clickhouse-connect/clickhouse_connect/driver/client.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,15 @@ def __init__(self,
5959
"""
6060
self.query_limit = coerce_int(query_limit)
6161
self.query_retries = coerce_int(query_retries)
62+
if database and not database == '__default__':
63+
self.database = database
6264
if show_clickhouse_errors is not None:
6365
self.show_clickhouse_errors = coerce_bool(show_clickhouse_errors)
6466
self.server_host_name = server_host_name
67+
self.uri = uri
68+
self._init_common_settings(apply_server_timezone)
69+
70+
def _init_common_settings(self, apply_server_timezone:Optional[Union[str, bool]] ):
6571
self.server_tz, dst_safe = pytz.UTC, True
6672
self.server_version, server_tz = \
6773
tuple(self.command('SELECT version(), timezone()', use_database=False))
@@ -83,8 +89,7 @@ def __init__(self,
8389
readonly = common.get_setting('readonly')
8490
server_settings = self.query(f'SELECT name, value, {readonly} as readonly FROM system.settings LIMIT 10000')
8591
self.server_settings = {row['name']: SettingDef(**row) for row in server_settings.named_results()}
86-
if database and not database == '__default__':
87-
self.database = database
92+
8893
if self.min_version(CH_VERSION_WITH_PROTOCOL):
8994
# Unfortunately we have to validate that the client protocol version is actually used by ClickHouse
9095
# since the query parameter could be stripped off (in particular, by CHProxy)
@@ -95,7 +100,9 @@ def __init__(self,
95100
self.protocol_version = PROTOCOL_VERSION_WITH_LOW_CARD
96101
if self._setting_status('date_time_input_format').is_writable:
97102
self.set_client_setting('date_time_input_format', 'best_effort')
98-
self.uri = uri
103+
if self._setting_status('allow_experimental_json_type').is_set:
104+
self.set_client_setting('cast_string_to_dynamic_use_inference', '1')
105+
99106

100107
def _validate_settings(self, settings: Optional[Dict[str, Any]]) -> Dict[str, str]:
101108
"""
@@ -655,7 +662,8 @@ def insert_df(self, table: str = None,
655662
settings=settings, context=context)
656663

657664
def insert_arrow(self, table: str,
658-
arrow_table, database: str = None,
665+
arrow_table,
666+
database: str = None,
659667
settings: Optional[Dict] = None) -> QuerySummary:
660668
"""
661669
Insert a PyArrow table DataFrame into ClickHouse using raw Arrow format
@@ -666,7 +674,8 @@ def insert_arrow(self, table: str,
666674
:return: QuerySummary with summary information, throws exception if insert fails
667675
"""
668676
full_table = table if '.' in table or not database else f'{database}.{table}'
669-
column_names, insert_block = arrow_buffer(arrow_table)
677+
compression = self.write_compression if self.write_compression in ('zstd', 'lz4') else None
678+
column_names, insert_block = arrow_buffer(arrow_table, compression)
670679
return self.raw_insert(full_table, column_names, insert_block, settings, 'Arrow')
671680

672681
def create_insert_context(self,

contrib/python/clickhouse-connect/clickhouse_connect/driver/httputil.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ def buffered():
244244
else:
245245
chunk = chunks.popleft()
246246
current_size -= len(chunk)
247-
yield chunk
247+
if chunk:
248+
yield chunk
248249

249250
self.gen = buffered()
250251

contrib/python/clickhouse-connect/clickhouse_connect/driver/query.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,12 @@ def to_arrow_batches(buffer: IOBase) -> StreamContext:
374374
return StreamContext(buffer, reader)
375375

376376

377-
def arrow_buffer(table) -> Tuple[Sequence[str], bytes]:
377+
def arrow_buffer(table, compression: Optional[str] = None) -> Tuple[Sequence[str], bytes]:
378378
pyarrow = check_arrow()
379+
options = None
380+
if compression in ('zstd', 'lz4'):
381+
options = pyarrow.ipc.IpcWriteOptions(compression=pyarrow.Codec(compression=compression))
379382
sink = pyarrow.BufferOutputStream()
380-
with pyarrow.RecordBatchFileWriter(sink, table.schema) as writer:
383+
with pyarrow.RecordBatchFileWriter(sink, table.schema, options=options) as writer:
381384
writer.write(table)
382385
return table.schema.names, sink.getvalue()

0 commit comments

Comments
 (0)