Skip to content

Commit 5d3bb3d

Browse files
sfc-gh-stakedaankit-bhatnagar167
authored andcommitted
SNOW-101495: Fix extension module import failure on windows. Add a large result set test
1 parent c574d39 commit 5d3bb3d

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

chunk_downloader.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@
1717
import json
1818
from io import BytesIO
1919
from gzip import GzipFile
20-
21-
try:
22-
from .arrow_iterator import PyArrowIterator
23-
from .arrow_context import ArrowConverterContext
24-
except ImportError:
25-
pass
20+
from .arrow_context import ArrowConverterContext
2621

2722
DEFAULT_REQUEST_TIMEOUT = 3600
2823

@@ -329,6 +324,7 @@ def __init__(self, meta, connection):
329324
Handler to consume data as arrow stream
330325
"""
331326
def to_iterator(self, raw_data_fd, download_time):
327+
from .arrow_iterator import PyArrowIterator
332328
gzip_decoder = GzipFile(fileobj=raw_data_fd, mode='r')
333329
it = PyArrowIterator(gzip_decoder, self._arrow_context)
334330
return it

test/test_arrow_result.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,25 @@ def test_select_with_empty_resultset(conn_cnx):
418418
assert cursor.fetchone() is None
419419

420420

421+
@pytest.mark.skipif(
422+
no_arrow_iterator_ext,
423+
reason="arrow_iterator extension is not built.")
424+
def test_select_with_large_resultset(conn_cnx):
425+
col_count = 5
426+
row_count = 1000000
427+
random_seed = get_random_seed()
428+
429+
sql_text = "select seq4() as c1, " \
430+
"uniform(-10000, 10000, random({})) as c2, " \
431+
"randstr(5, random({})) as c3, " \
432+
"randstr(10, random({})) as c4, " \
433+
"uniform(-100000, 100000, random({})) as c5 " \
434+
"from table(generator(rowcount=>{}))"\
435+
.format(random_seed, random_seed, random_seed, random_seed, row_count)
436+
437+
iterate_over_test_chunk("large_resultset", conn_cnx, sql_text, row_count, col_count)
438+
439+
421440
def get_random_seed():
422441
random.seed(datetime.now())
423442
return random.randint(0, 10000)

0 commit comments

Comments
 (0)