Skip to content

Commit

Permalink
feat(partitions): add identity, list, range partition.py
Browse files Browse the repository at this point in the history
  • Loading branch information
unknowntpo committed Dec 31, 2024
1 parent f08ba54 commit cf8f399
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

from abc import abstractmethod
from typing import List, Any

from .partition import Partition
from ..literals.literal import Literal


class IdentityPartition(Partition):
"""
Expand All @@ -41,9 +44,9 @@ def field_names(self) -> List[List[str]]:
pass

@abstractmethod
def values(self) -> List[Any]:
def values(self) -> List[Literal[Any]]:
"""
Returns:
List[Any]: The values of the identity partition.
List[Literal[Any]]: The values of the identity partition.
"""
pass
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
from abc import abstractmethod
from typing import List, Any

from gravitino.api.expressions.literals.literal import Literal
from gravitino.api.expressions.partitions.partition import Partition


class ListPartition(Partition):
"""
A list partition represents a result of list partitioning. For example, for list partition
Expand All @@ -35,9 +37,9 @@ class ListPartition(Partition):
"""

@abstractmethod
def lists(self) -> List[List[Any]]:
def lists(self) -> List[List[Literal[Any]]]:
"""
Returns:
List[List[Any]]: The values of the list partition.
List[List[Literal[Any]]]: The values of the list partition.
"""
pass
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from abc import ABC, abstractmethod
from typing import Dict


class Partition(ABC):
"""
A partition represents a result of partitioning a table. The partition can be either a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from gravitino.api.expressions.literals.literal import Literal
from gravitino.api.expressions.partitions.partition import Partition


class RangePartition(Partition):
"""
A range partition represents a result of range partitioning. For example, for range partition
Expand Down

0 comments on commit cf8f399

Please sign in to comment.