diff --git a/src/datachain/sql/types.py b/src/datachain/sql/types.py index f085ef288..14fec9502 100644 --- a/src/datachain/sql/types.py +++ b/src/datachain/sql/types.py @@ -187,6 +187,22 @@ def on_read_convert(self, value, dialect): return read_converter(dialect).int32(value) +class UInt32(Int): + def load_dialect_impl(self, dialect): + return converter(dialect).uint32() + + @staticmethod + def default_value(dialect): + return type_defaults(dialect).uint32() + + @staticmethod + def db_default_value(dialect): + return db_defaults(dialect).uint32() + + def on_read_convert(self, value, dialect): + return read_converter(dialect).uint32(value) + + class Int64(Int): def load_dialect_impl(self, dialect): return converter(dialect).int64() @@ -395,6 +411,9 @@ def int(self, value): def int32(self, value): return value + def uint32(self, value): + return value + def int64(self, value): return value @@ -446,6 +465,9 @@ def int(self): def int32(self): return self.int() + def uint32(self): + return self.int() + def int64(self): return self.int() @@ -487,6 +509,9 @@ def int(self): def int32(self): return None + def uint32(self): + return None + def int64(self): return None @@ -528,6 +553,9 @@ def int(self): def int32(self): return self.int() + def uint32(self): + return self.int() + def int64(self): return self.int() @@ -561,6 +589,7 @@ def binary(self): Boolean, Int, Int32, + UInt32, Int64, UInt64, Float, diff --git a/tests/unit/lib/test_signal_schema.py b/tests/unit/lib/test_signal_schema.py index 3f4a32a60..d3464a87c 100644 --- a/tests/unit/lib/test_signal_schema.py +++ b/tests/unit/lib/test_signal_schema.py @@ -27,6 +27,7 @@ Int32, Int64, String, + UInt32, UInt64, ) @@ -721,6 +722,7 @@ def test_mutate_change_type(): [Boolean, bool], [Int, int], [Int32, int], + [UInt32, int], [Int64, int], [UInt64, int], [Float, float], diff --git a/tests/unit/test_data_storage.py b/tests/unit/test_data_storage.py index 19f408245..a126c3051 100644 --- a/tests/unit/test_data_storage.py +++ b/tests/unit/test_data_storage.py @@ -18,6 +18,7 @@ Int32, Int64, String, + UInt32, UInt64, ) from tests.utils import ( @@ -173,6 +174,7 @@ def run_convert_type(value, sql_type): [Boolean(), False], [Int(), 0], [Int32(), 0], + [UInt32(), 0], [Int64(), 0], [UInt64(), 0], [Float(), lambda val: math.isnan(val)],