|
29 | 29 | from trino.transaction import IsolationLevel |
30 | 30 |
|
31 | 31 |
|
32 | | -@pytest.fixture |
33 | | -def trino_connection(run_trino): |
| 32 | +@pytest.fixture(params=[None, "json+zstd", "json+lz4", "json"]) |
| 33 | +def trino_connection(request, run_trino): |
34 | 34 | host, port = run_trino |
| 35 | + encoding = request.param |
35 | 36 |
|
36 | 37 | yield trino.dbapi.Connection( |
37 | | - host=host, port=port, user="test", source="test", max_attempts=1 |
| 38 | + host=host, port=port, user="test", source="test", max_attempts=1, encoding=encoding |
38 | 39 | ) |
39 | 40 |
|
40 | 41 |
|
@@ -1833,8 +1834,22 @@ def test_select_query_spooled_segments(trino_connection): |
1833 | 1834 | stop => 5, |
1834 | 1835 | step => 1)) n""") |
1835 | 1836 | rows = cur.fetchall() |
1836 | | - # TODO: improve test |
1837 | | - assert len(rows) > 0 |
| 1837 | + assert len(rows) == 300875 |
| 1838 | + for row in rows: |
| 1839 | + assert isinstance(row[0], int), f"Expected integer for orderkey, got {type(row[0])}" |
| 1840 | + assert isinstance(row[1], int), f"Expected integer for partkey, got {type(row[1])}" |
| 1841 | + assert isinstance(row[2], int), f"Expected integer for suppkey, got {type(row[2])}" |
| 1842 | + assert isinstance(row[3], int), f"Expected int for linenumber, got {type(row[3])}" |
| 1843 | + assert isinstance(row[4], float), f"Expected float for quantity, got {type(row[4])}" |
| 1844 | + assert isinstance(row[5], float), f"Expected float for extendedprice, got {type(row[5])}" |
| 1845 | + assert isinstance(row[6], float), f"Expected float for discount, got {type(row[6])}" |
| 1846 | + assert isinstance(row[7], float), f"Expected string for tax, got {type(row[7])}" |
| 1847 | + assert isinstance(row[8], str), f"Expected string for returnflag, got {type(row[8])}" |
| 1848 | + assert isinstance(row[9], str), f"Expected string for linestatus, got {type(row[9])}" |
| 1849 | + assert isinstance(row[10], date), f"Expected date for shipdate, got {type(row[10])}" |
| 1850 | + assert isinstance(row[11], date), f"Expected date for commitdate, got {type(row[11])}" |
| 1851 | + assert isinstance(row[12], date), f"Expected date for receiptdate, got {type(row[12])}" |
| 1852 | + assert isinstance(row[13], str), f"Expected string for shipinstruct, got {type(row[13])}" |
1838 | 1853 |
|
1839 | 1854 |
|
1840 | 1855 | def get_cursor(legacy_prepared_statements, run_trino): |
|
0 commit comments