Skip to content

Commit

Permalink
Fix python syntax 'Self' keyword and module qualifier (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzelin authored Aug 16, 2024
1 parent 56bcb5e commit 974f8aa
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ dependency-reduced-pom.xml

# Python building & testing
.tox/
.DS_Store
__pycache__
build/
dev/.conda
dev/.stage.txt
Expand Down
9 changes: 4 additions & 5 deletions java_based_implementation/api_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
write_builder, table_write, commit_message, table_commit)
from pyarrow import RecordBatchReader, RecordBatch
from typing import List
from typing_extensions import Self


class Catalog(catalog.Catalog):
Expand All @@ -37,7 +36,7 @@ def create(catalog_context: dict) -> 'Catalog':
j_catalog = gateway.jvm.CatalogFactory.createCatalog(j_catalog_context)
return Catalog(j_catalog)

def get_table(self, identifier: tuple) -> 'Table':
def get_table(self, identifier: str) -> 'Table':
gateway = get_gateway()
j_identifier = gateway.jvm.Identifier.fromString(identifier)
j_table = self._j_catalog.getTable(j_identifier)
Expand All @@ -63,11 +62,11 @@ class ReadBuilder(read_builder.ReadBuilder):
def __init__(self, j_read_builder):
self._j_read_builder = j_read_builder

def with_projection(self, projection: List[List[int]]) -> Self:
def with_projection(self, projection: List[List[int]]) -> 'ReadBuilder':
self._j_read_builder.withProjection(projection)
return self

def with_limit(self, limit: int) -> Self:
def with_limit(self, limit: int) -> 'ReadBuilder':
self._j_read_builder.withLimit(limit)
return self

Expand Down Expand Up @@ -121,7 +120,7 @@ class BatchWriteBuilder(write_builder.BatchWriteBuilder):
def __init__(self, j_batch_write_builder):
self._j_batch_write_builder = j_batch_write_builder

def with_overwrite(self, static_partition: dict) -> Self:
def with_overwrite(self, static_partition: dict) -> 'BatchWriteBuilder':
self._j_batch_write_builder.withOverwrite(static_partition)
return self

Expand Down
2 changes: 1 addition & 1 deletion paimon_python_api/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#################################################################################

from abc import ABC, abstractmethod
from table import Table
from paimon_python_api.table import Table


class Catalog(ABC):
Expand Down
9 changes: 4 additions & 5 deletions paimon_python_api/read_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,20 @@
#################################################################################

from abc import ABC, abstractmethod
from table_read import TableRead
from table_scan import TableScan
from paimon_python_api.table_read import TableRead
from paimon_python_api.table_scan import TableScan
from typing import List
from typing_extensions import Self


class ReadBuilder(ABC):
"""An interface for building the TableScan and TableRead."""

@abstractmethod
def with_projection(self, projection: List[List[int]]) -> Self:
def with_projection(self, projection: List[List[int]]) -> 'ReadBuilder':
"""Push nested projection."""

@abstractmethod
def with_limit(self, limit: int) -> Self:
def with_limit(self, limit: int) -> 'ReadBuilder':
"""Push row number."""

@abstractmethod
Expand Down
4 changes: 2 additions & 2 deletions paimon_python_api/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#################################################################################

from abc import ABC, abstractmethod
from read_builder import ReadBuilder
from write_builder import BatchWriteBuilder
from paimon_python_api.read_builder import ReadBuilder
from paimon_python_api.write_builder import BatchWriteBuilder


class Table(ABC):
Expand Down
2 changes: 1 addition & 1 deletion paimon_python_api/table_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#################################################################################

from abc import ABC, abstractmethod
from commit_message import CommitMessage
from paimon_python_api.commit_message import CommitMessage
from typing import List


Expand Down
2 changes: 1 addition & 1 deletion paimon_python_api/table_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from abc import ABC, abstractmethod
from pyarrow import RecordBatchReader
from split import Split
from paimon_python_api.split import Split


class TableRead(ABC):
Expand Down
3 changes: 1 addition & 2 deletions paimon_python_api/table_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

from abc import ABC, abstractmethod
from typing import List

from split import Split
from paimon_python_api.split import Split


class TableScan(ABC):
Expand Down
2 changes: 1 addition & 1 deletion paimon_python_api/table_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#################################################################################

from abc import ABC, abstractmethod
from commit_message import CommitMessage
from paimon_python_api.commit_message import CommitMessage
from pyarrow import RecordBatch
from typing import List

Expand Down
7 changes: 3 additions & 4 deletions paimon_python_api/write_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@
#################################################################################

from abc import ABC, abstractmethod
from table_commit import BatchTableCommit
from table_write import BatchTableWrite
from typing_extensions import Self
from paimon_python_api.table_commit import BatchTableCommit
from paimon_python_api.table_write import BatchTableWrite


class BatchWriteBuilder(ABC):
"""An interface for building the TableScan and TableRead."""

@abstractmethod
def with_overwrite(self, static_partition: dict) -> Self:
def with_overwrite(self, static_partition: dict) -> 'BatchWriteBuilder':
"""
Overwrite writing, same as the 'INSERT OVERWRITE T PARTITION (...)' semantics of SQL.
If you pass an empty dict, it means OVERWRITE whole table.
Expand Down

0 comments on commit 974f8aa

Please sign in to comment.