|
29 | 29 | import trino
|
30 | 30 | from tests.integration.conftest import trino_version
|
31 | 31 | from trino import constants
|
| 32 | +from trino.client import InlineSegment |
32 | 33 | from trino.client import SegmentIterator
|
| 34 | +from trino.client import SpooledSegment |
33 | 35 | from trino.dbapi import Cursor
|
34 | 36 | from trino.dbapi import DescribeOutput
|
35 | 37 | from trino.dbapi import TimeBoundLRUCache
|
@@ -1883,9 +1885,17 @@ def test_segments_cursor(trino_connection):
|
1883 | 1885 | row_mapper = RowMapperFactory().create(columns=cur._query.columns, legacy_primitive_types=False)
|
1884 | 1886 | total = 0
|
1885 | 1887 | for segment in segments:
|
| 1888 | + assert isinstance(segment.segment, (InlineSegment, SpooledSegment)), ( |
| 1889 | + f"Expected InlineSegment or SpooledSegment, got {type(segment.segment)}" |
| 1890 | + ) |
1886 | 1891 | assert segment.encoding == trino_connection._client_session.encoding
|
1887 |
| - assert isinstance(segment.segment.uri, str), f"Expected string for uri, got {segment.segment.uri}" |
1888 |
| - assert isinstance(segment.segment.ack_uri, str), f"Expected string for ack_uri, got {segment.segment.ack_uri}" |
| 1892 | + if isinstance(segment.segment, SpooledSegment): |
| 1893 | + assert isinstance(segment.segment.uri, str), ( |
| 1894 | + f"Expected string for uri, got {type(segment.segment.uri)}" |
| 1895 | + ) |
| 1896 | + assert isinstance(segment.segment.ack_uri, str), ( |
| 1897 | + f"Expected string for ack_uri, got {type(segment.segment.ack_uri)}" |
| 1898 | + ) |
1889 | 1899 | total += len(list(SegmentIterator(segment, row_mapper)))
|
1890 | 1900 | assert total == 300875, f"Expected total rows 300875, got {total}"
|
1891 | 1901 |
|
|
0 commit comments