Skip to content

Commit 9d07c38

Browse files
authored
feat: Allow to use 128 bits integers (#6862)
1 parent 45b003f commit 9d07c38

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

snuba/migrations/parse_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
basic_type = "DateTime" / "Date" / "IPv4" / "IPv6" / "String" / "UUID"
3939
uint = "UInt" uint_size
4040
int = "Int" uint_size
41-
uint_size = "8" / "16" / "32" / "64"
41+
uint_size = "8" / "16" / "32" / "64" / "128"
4242
float = "Float" float_size
4343
float_size = "32" / "64"
4444
fixedstring = "FixedString" open_paren space* fixedstring_size space* close_paren

snuba/utils/schemas.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ def for_schema(self) -> str:
175175

176176
@staticmethod
177177
def to_columns(
178-
columns: Sequence[Union[Column[TModifiers], tuple[str, ColumnType[TModifiers]]]]
178+
columns: Sequence[
179+
Union[Column[TModifiers], tuple[str, ColumnType[TModifiers]]]
180+
],
179181
) -> Sequence[Column[TModifiers]]:
180182
return [Column(*col) if not isinstance(col, Column) else col for col in columns]
181183

@@ -582,7 +584,7 @@ def get_raw(self) -> FixedString[TModifiers]:
582584
class UInt(ColumnType[TModifiers]):
583585
def __init__(self, size: int, modifiers: Optional[TModifiers] = None) -> None:
584586
super().__init__(modifiers)
585-
assert size in (8, 16, 32, 64)
587+
assert size in (8, 16, 32, 64, 128)
586588
self.size = size
587589

588590
def _repr_content(self) -> str:
@@ -608,7 +610,7 @@ def get_raw(self) -> UInt[TModifiers]:
608610
class Int(ColumnType[TModifiers]):
609611
def __init__(self, size: int, modifiers: Optional[TModifiers] = None) -> None:
610612
super().__init__(modifiers)
611-
assert size in (8, 16, 32, 64)
613+
assert size in (8, 16, 32, 64, 128)
612614
self.size = size
613615

614616
def _repr_content(self) -> str:

tests/migrations/test_parse_schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
(("IPv6", "", "", ""), IPv6()),
3737
(("String", "", "", ""), String()),
3838
(("UInt32", "", "", ""), UInt(32)),
39+
(("UInt128", "", "", ""), UInt(128)),
3940
(("UUID", "", "", ""), UUID()),
4041
# Aggregate functions
4142
(

0 commit comments

Comments
 (0)