From 0efcf68d9296cd01380537af240420246ef6fad6 Mon Sep 17 00:00:00 2001 From: darshan jani Date: Fri, 16 Oct 2026 17:24:34 +0530 Subject: [PATCH 1/2] Darshan Jani | fix: support INTERVAL_DAY_SECOND in Python connector --- e6data_python_connector/datainputstream.py | 11 +++++++++ e6data_python_connector/e6x_vector/ttypes.py | 3 +++ e6x_vector.thrift | 3 ++- test/unit/test_binary_decoder_contract.py | 24 +++++++++++++++++++- test/unit/test_vector_wire_contract.py | 2 +- 5 files changed, 40 insertions(+), 3 deletions(-) diff --git a/e6data_python_connector/datainputstream.py b/e6data_python_connector/datainputstream.py index 494fb04..3f94f3d 100644 --- a/e6data_python_connector/datainputstream.py +++ b/e6data_python_connector/datainputstream.py @@ -478,6 +478,8 @@ def read_values_from_array(query_columns_description: list, dis: DataInputStream try: if dtype == "LONG": value_array.append(dis.read_long()) + elif dtype == "INTERVAL_DAY_SECOND": + value_array.append(timedelta(microseconds=dis.read_long())) elif dtype == "DATE": value_array.append(format_iso_date_from_epoch_micros(dis.read_long())) elif dtype == "DATETIME": @@ -582,6 +584,15 @@ def get_column_from_chunk(vector: Vector, strict=False) -> list: continue value_array.append(vector.data.int64Data.data[ row] if not vector.isConstantVector else vector.data.numericConstantData.data) + elif d_type == VectorType.INTERVAL_DAY_SECOND: + for row in range(vector.size): + if get_null(vector, row): + value_array.append(None) + continue + microseconds = (vector.data.int64Data.data[row] + if not vector.isConstantVector + else vector.data.numericConstantData.data) + value_array.append(timedelta(microseconds=microseconds)) elif d_type == VectorType.DATE: # Use the JDBC-parity formatter so years > 9999 emit "+YYYYY-MM-DD" # instead of raising. Per-row try/except keeps a single bad value diff --git a/e6data_python_connector/e6x_vector/ttypes.py b/e6data_python_connector/e6x_vector/ttypes.py index 77afba0..a195d43 100644 --- a/e6data_python_connector/e6x_vector/ttypes.py +++ b/e6data_python_connector/e6x_vector/ttypes.py @@ -35,6 +35,7 @@ class VectorType(object): NULL = 14 TIMESTAMP_TZ = 15 DECIMAL128 = 16 + INTERVAL_DAY_SECOND = 17 _VALUES_TO_NAMES = { 0: "BINARY", @@ -54,6 +55,7 @@ class VectorType(object): 14: "NULL", 15: "TIMESTAMP_TZ", 16: "DECIMAL128", + 17: "INTERVAL_DAY_SECOND", } _NAMES_TO_VALUES = { @@ -74,6 +76,7 @@ class VectorType(object): "NULL": 14, "TIMESTAMP_TZ": 15, "DECIMAL128": 16, + "INTERVAL_DAY_SECOND": 17, } diff --git a/e6x_vector.thrift b/e6x_vector.thrift index b2c85a0..ae225b5 100644 --- a/e6x_vector.thrift +++ b/e6x_vector.thrift @@ -18,7 +18,8 @@ enum VectorType ARRAY, NULL, TIMESTAMP_TZ, - DECIMAL128 + DECIMAL128, + INTERVAL_DAY_SECOND } struct Vector diff --git a/test/unit/test_binary_decoder_contract.py b/test/unit/test_binary_decoder_contract.py index 1f56252..d87a432 100644 --- a/test/unit/test_binary_decoder_contract.py +++ b/test/unit/test_binary_decoder_contract.py @@ -1,7 +1,7 @@ """Binary decoding contracts using real bytes, Thrift structs and protocols.""" import io import struct -from datetime import datetime +from datetime import datetime, timedelta from decimal import Decimal, localcontext import pytest @@ -87,6 +87,28 @@ def test_int96_row_encoding_uses_julian_day_and_nanoseconds(): assert decoder.read_values_from_array([field],decoder.DataInputStream(io.BytesIO(payload)))==[expected] +def test_interval_day_second_row_and_vector_decoding(): + assert getattr(wire.VectorType, 'INTERVAL_DAY_SECOND', None) == 17 + + field=decoder.FieldInfo('elapsed','INTERVAL_DAY_SECOND','','') + payload=b'\x01'+struct.pack('>q',86_400_000_001) + assert decoder.read_values_from_array([field],decoder.DataInputStream(io.BytesIO(payload)))==[ + timedelta(days=1,microseconds=1)] + + vector=wire.Vector(3,wire.VectorType.INTERVAL_DAY_SECOND,[False,False,True], + wire.Data(int64Data=wire.Int64Data([86_400_000_001,-1,0])),False) + assert decoder.get_column_from_chunk(vector)==[ + timedelta(days=1,microseconds=1),timedelta(microseconds=-1),None] + + constant=wire.Vector(2,wire.VectorType.INTERVAL_DAY_SECOND,[False], + wire.Data(numericConstantData=wire.NumericConstantData(-10_000)),True) + assert decoder.get_column_from_chunk(constant)==[timedelta(microseconds=-10_000)]*2 + + zero=wire.Vector(1,wire.VectorType.INTERVAL_DAY_SECOND,[False], + wire.Data(numericConstantData=wire.NumericConstantData(0)),True) + assert decoder.get_column_from_chunk(zero)==[timedelta(0)] + + VECTOR_CASES=[ (wire.VectorType.LONG,'int64Data',wire.Int64Data,'numericConstantData',wire.NumericConstantData,42,42), (wire.VectorType.INTEGER,'int32Data',wire.Int32Data,'numericConstantData',wire.NumericConstantData,-2,-2), diff --git a/test/unit/test_vector_wire_contract.py b/test/unit/test_vector_wire_contract.py index 8765aee..ded082a 100644 --- a/test/unit/test_vector_wire_contract.py +++ b/test/unit/test_vector_wire_contract.py @@ -129,6 +129,6 @@ def test_truncated_thrift_struct_is_rejected(protocol): def test_vector_enum_name_mapping_is_bijective(): - assert len(wire.VectorType._VALUES_TO_NAMES) == 17 + assert len(wire.VectorType._VALUES_TO_NAMES) == 18 for value, name in wire.VectorType._VALUES_TO_NAMES.items(): assert wire.VectorType._NAMES_TO_VALUES[name] == value From 0ad26134c3bcd98ec947a0988ef0f4b759b99b03 Mon Sep 17 00:00:00 2001 From: Vishal Anand <101251245+vishale6x@users.noreply.github.com> Date: Sat, 17 Oct 2026 18:15:47 +0530 Subject: [PATCH 2/2] Bump Python connector release version to 3.0.2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 68326b2..ec1e373 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ import setuptools -VERSION = (3, 0, 1,) +VERSION = (3, 0, 2,) def get_long_desc():