World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#10339] fix(python-client): Add missing __init__.py for package discovery (#10341)
Yuhui71f9b71b4e4e
diff --git a/.github/PULL_REQUEST_TEMPLATE b/.github/PULL_REQUEST_TEMPLATEindex 82a375ac34..40407e970d 100644--- a/.github/PULL_REQUEST_TEMPLATE+++ b/.github/PULL_REQUEST_TEMPLATE@@ -1,11 +1,11 @@<!--1. Title: [#<issue>] <type>(<scope>): <subject>Examples:- - "[#123] feat(operator): support xxx"- - "[#233] fix: check null before access result in xxx"- - "[MINOR] refactor: fix typo in variable name"- - "[MINOR] docs: fix typo in README"- - "[#255] test: fix flaky test NameOfTheTest"+ - "[#123] feat(operator): Support xxx"+ - "[#233] fix: Check null before access result in xxx"+ - "[MINOR] refactor: Fix typo in variable name"+ - "[MINOR] docs: Fix typo in README"+ - "[#255] test: Fix flaky test NameOfTheTest"Reference: https://www.conventionalcommits.org/en/v1.0.0/2. If the PR is unfinished, please mark this PR as draft.-->diff --git a/AGENTS.md b/AGENTS.mdindex cf0c820047..1f3c67d945 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -39,7 +39,8 @@4. Constructors.5. Methods (Group by visibility, putting `private` methods at the end).-## Issue and PR Guidelines+## Create Issue and PR Guidelines+[IMPORTANT] Before creating an issue or PR using the gh command or the GitHub MCP server, please show a preview of the PR/issue first. Submit it only after I confirm. The issue/PR format should follow the reference and keep the content concise and clear.- **Issue Templates**: Use the appropriate template from `.github/ISSUE_TEMPLATE/`- **PR Description**: Follow the template in `.github/PULL_REQUEST_TEMPLATE`diff --git a/clients/client-python/gravitino/api/rel/expressions/distributions/__init__.py b/clients/client-python/gravitino/api/rel/expressions/distributions/__init__.pynew file mode 100644index 0000000000..13a83393a9--- /dev/null+++ b/clients/client-python/gravitino/api/rel/expressions/distributions/__init__.py@@ -0,0 +1,16 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.diff --git a/clients/client-python/gravitino/api/rel/expressions/distributions/strategy.py b/clients/client-python/gravitino/api/rel/expressions/distributions/strategy.pyindex 0ac03a1c29..f70d2504c1 100644--- a/clients/client-python/gravitino/api/rel/expressions/distributions/strategy.py+++ b/clients/client-python/gravitino/api/rel/expressions/distributions/strategy.py@@ -40,13 +40,12 @@ class Strategy(Enum):upper_name = name.upper()if upper_name == "NONE":return Strategy.NONE- elif upper_name == "HASH":+ if upper_name == "HASH":return Strategy.HASH- elif upper_name == "RANGE":+ if upper_name == "RANGE":return Strategy.RANGE- elif upper_name in {"EVEN", "RANDOM"}:+ if upper_name in {"EVEN", "RANDOM"}:return Strategy.EVEN- else:- raise ValueError(- f"Invalid distribution strategy: {name}. Valid values are: {[s.value for s in Strategy]}"- )+ raise ValueError(+ f"Invalid distribution strategy: {name}. Valid values are: {[s.value for s in Strategy]}"+ )diff --git a/clients/client-python/gravitino/api/rel/partitions/__init__.py b/clients/client-python/gravitino/api/rel/partitions/__init__.pynew file mode 100644index 0000000000..13a83393a9--- /dev/null+++ b/clients/client-python/gravitino/api/rel/partitions/__init__.py@@ -0,0 +1,16 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.diff --git a/clients/client-python/gravitino/api/rel/partitions/identity_partition.py b/clients/client-python/gravitino/api/rel/partitions/identity_partition.pyindex 93cb8aa12b..76e9f5e562 100644--- a/clients/client-python/gravitino/api/rel/partitions/identity_partition.py+++ b/clients/client-python/gravitino/api/rel/partitions/identity_partition.py@@ -34,7 +34,8 @@ class IdentityPartition(Partition):its partition name is "dt=2008-08-08/country=us", field names are [["dt"], ["country"]] andvalues are ["2008-08-08", "us"].- APIs that are still evolving towards becoming stable APIs, and can change from one feature release to another (0.5.0 to 0.6.0).+ APIs that are still evolving towards becoming stable APIs, and can change from one feature+ release to another (0.5.0 to 0.6.0)."""@abstractmethoddiff --git a/clients/client-python/gravitino/api/rel/partitions/list_partition.py b/clients/client-python/gravitino/api/rel/partitions/list_partition.pyindex 1b1dda422a..bc74da56a4 100644--- a/clients/client-python/gravitino/api/rel/partitions/list_partition.py+++ b/clients/client-python/gravitino/api/rel/partitions/list_partition.py@@ -35,7 +35,8 @@ class ListPartition(Partition):its name is "p202204_California" and lists are [["2022-04-01","Los Angeles"], ["2022-04-01", "San Francisco"]].- APIs that are still evolving towards becoming stable APIs, and can change from one feature release to another (0.5.0 to 0.6.0).+ APIs that are still evolving towards becoming stable APIs, and can change from one feature+ release to another (0.5.0 to 0.6.0)."""@abstractmethoddiff --git a/clients/client-python/gravitino/api/rel/partitions/partition.py b/clients/client-python/gravitino/api/rel/partitions/partition.pyindex 7f9a0b8733..6d18c28df1 100644--- a/clients/client-python/gravitino/api/rel/partitions/partition.py+++ b/clients/client-python/gravitino/api/rel/partitions/partition.py@@ -24,7 +24,8 @@ class Partition(ABC):A partition represents a result of partitioning a table. The partition can be either a`IdentityPartition`, `ListPartition`, or `RangePartition`. It depends on the `Table.partitioning()`.- APIs that are still evolving towards becoming stable APIs, and can change from one feature release to another (0.5.0 to 0.6.0).+ APIs that are still evolving towards becoming stable APIs, and can change from one feature+ release to another (0.5.0 to 0.6.0)."""@abstractmethoddiff --git a/clients/client-python/gravitino/api/rel/partitions/range_partition.py b/clients/client-python/gravitino/api/rel/partitions/range_partition.pyindex 8f3180191a..549f130554 100644--- a/clients/client-python/gravitino/api/rel/partitions/range_partition.py+++ b/clients/client-python/gravitino/api/rel/partitions/range_partition.py@@ -32,7 +32,8 @@ class RangePartition(Partition):its upper bound is "2020-03-22" and its lower bound is null.- APIs that are still evolving towards becoming stable APIs, and can change from one feature release to another (0.5.0 to 0.6.0).+ APIs that are still evolving towards becoming stable APIs, and can change from one feature+ release to another (0.5.0 to 0.6.0)."""@abstractmethoddiff --git a/clients/client-python/gravitino/api/rel/types/json_serdes/_helper/__init__.py b/clients/client-python/gravitino/api/rel/types/json_serdes/_helper/__init__.pynew file mode 100644index 0000000000..13a83393a9--- /dev/null+++ b/clients/client-python/gravitino/api/rel/types/json_serdes/_helper/__init__.py@@ -0,0 +1,16 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.diff --git a/clients/client-python/gravitino/api/rel/types/json_serdes/base.py b/clients/client-python/gravitino/api/rel/types/json_serdes/base.pyindex c04f4f23ed..caba4fbe10 100644--- a/clients/client-python/gravitino/api/rel/types/json_serdes/base.py+++ b/clients/client-python/gravitino/api/rel/types/json_serdes/base.py@@ -41,7 +41,7 @@ class JsonSerializable(ABC, Generic[_GravitinoTypeT]):@classmethod@abstractmethod- def serialize(cls, data_type: _GravitinoTypeT) -> Json:+ def serialize(cls, value: _GravitinoTypeT) -> Json:"""To serialize the given `data`.Args:diff --git a/clients/client-python/gravitino/api/rel/types/json_serdes/type_serdes.py b/clients/client-python/gravitino/api/rel/types/json_serdes/type_serdes.pyindex 8e97c54b75..8d60cba0d2 100644--- a/clients/client-python/gravitino/api/rel/types/json_serdes/type_serdes.py+++ b/clients/client-python/gravitino/api/rel/types/json_serdes/type_serdes.py@@ -27,7 +27,7 @@ class TypeSerdes(JsonSerializable[Type]):"""Custom JSON serializer for Gravitino Type objects."""@classmethod- def serialize(cls, data_type: Type) -> Json:+ def serialize(cls, value: Type) -> Json:"""Serialize the given Gravitino Type.Args:@@ -37,7 +37,7 @@ class TypeSerdes(JsonSerializable[Type]):Json: The serialized data corresponding to the given Gravitino Type."""- return SerdesUtils.write_data_type(data_type)+ return SerdesUtils.write_data_type(value)@classmethoddef deserialize(cls, data: Json) -> Type:diff --git a/clients/client-python/gravitino/dto/rel/expressions/json_serdes/__init__.py b/clients/client-python/gravitino/dto/rel/expressions/json_serdes/__init__.pynew file mode 100644index 0000000000..13a83393a9--- /dev/null+++ b/clients/client-python/gravitino/dto/rel/expressions/json_serdes/__init__.py@@ -0,0 +1,16 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.diff --git a/clients/client-python/gravitino/dto/rel/expressions/json_serdes/_helper/__init__.py b/clients/client-python/gravitino/dto/rel/expressions/json_serdes/_helper/__init__.pynew file mode 100644index 0000000000..13a83393a9--- /dev/null+++ b/clients/client-python/gravitino/dto/rel/expressions/json_serdes/_helper/__init__.py@@ -0,0 +1,16 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.diff --git a/clients/client-python/gravitino/dto/rel/expressions/json_serdes/_helper/serdes_utils.py b/clients/client-python/gravitino/dto/rel/expressions/json_serdes/_helper/serdes_utils.pyindex 53a9ec9b63..95f2252b29 100644--- a/clients/client-python/gravitino/dto/rel/expressions/json_serdes/_helper/serdes_utils.py+++ b/clients/client-python/gravitino/dto/rel/expressions/json_serdes/_helper/serdes_utils.py@@ -73,10 +73,10 @@ class SerdesUtils(SerdesUtilsBase):)try:arg_type = FunctionArg.ArgType(data[cls.EXPRESSION_TYPE].lower())- except ValueError:+ except ValueError as exc:raise IllegalArgumentException(f"Unknown function argument type: {data[cls.EXPRESSION_TYPE]}"- )+ ) from excif arg_type is FunctionArg.ArgType.LITERAL:Precondition.check_argument(@@ -124,9 +124,12 @@ class SerdesUtils(SerdesUtilsBase):.build())- if arg_type is FunctionArg.ArgType.UNPARSED:- Precondition.check_argument(- isinstance(data.get(cls.UNPARSED_EXPRESSION), str),- f"Cannot parse unparsed expression from missing string field unparsedExpression: {data}",- )- return UnparsedExpressionDTO(data[cls.UNPARSED_EXPRESSION])+ Precondition.check_argument(+ arg_type is FunctionArg.ArgType.UNPARSED,+ f"Unknown function argument type: {arg_type}",+ )+ Precondition.check_argument(+ isinstance(data.get(cls.UNPARSED_EXPRESSION), str),+ f"Cannot parse unparsed expression from missing string field unparsedExpression: {data}",+ )+ return UnparsedExpressionDTO(data[cls.UNPARSED_EXPRESSION])diff --git a/clients/client-python/gravitino/dto/rel/indexes/json_serdes/index_serdes.py b/clients/client-python/gravitino/dto/rel/indexes/json_serdes/index_serdes.pyindex 5aa004eb21..6110a09409 100644--- a/clients/client-python/gravitino/dto/rel/indexes/json_serdes/index_serdes.py+++ b/clients/client-python/gravitino/dto/rel/indexes/json_serdes/index_serdes.py@@ -26,11 +26,11 @@ from gravitino.utils.serdes import SerdesUtilsBaseclass IndexSerdes(SerdesUtilsBase, JsonSerializable[Index]):@classmethod- def serialize(cls, data_type: Index) -> dict[str, Any]:- result: dict[str, Any] = {cls.INDEX_TYPE: data_type.type().name.upper()}- if data_type.name() is not None:- result[cls.INDEX_NAME] = data_type.name()- result[cls.INDEX_FIELD_NAMES] = data_type.field_names()+ def serialize(cls, value: Index) -> dict[str, Any]:+ result: dict[str, Any] = {cls.INDEX_TYPE: value.type().name.upper()}+ if value.name() is not None:+ result[cls.INDEX_NAME] = value.name()+ result[cls.INDEX_FIELD_NAMES] = value.field_names()return resultdiff --git a/clients/client-python/gravitino/dto/rel/json_serdes/distribution_serdes.py b/clients/client-python/gravitino/dto/rel/json_serdes/distribution_serdes.pyindex 196d5bfe1e..94158a9c08 100644--- a/clients/client-python/gravitino/dto/rel/json_serdes/distribution_serdes.py+++ b/clients/client-python/gravitino/dto/rel/json_serdes/distribution_serdes.py@@ -30,12 +30,12 @@ class DistributionSerDes(SerdesUtilsBase, JsonSerializable[DistributionDTO]):"""Custom JSON deserializer for DistributionDTO objects."""@classmethod- def serialize(cls, data_type: DistributionDTO) -> dict[str, Any]:+ def serialize(cls, value: DistributionDTO) -> dict[str, Any]:return {- cls.STRATEGY: data_type.strategy().name.lower(),- cls.NUMBER: data_type.number(),+ cls.STRATEGY: value.strategy().name.lower(),+ cls.NUMBER: value.number(),cls.FUNCTION_ARGS: [- SerdesUtils.write_function_arg(arg) for arg in data_type.args()+ SerdesUtils.write_function_arg(arg) for arg in value.args()],}diff --git a/clients/client-python/gravitino/dto/rel/json_serdes/sort_order_serdes.py b/clients/client-python/gravitino/dto/rel/json_serdes/sort_order_serdes.pyindex 29d956c1bd..39a9aab2ef 100644--- a/clients/client-python/gravitino/dto/rel/json_serdes/sort_order_serdes.py+++ b/clients/client-python/gravitino/dto/rel/json_serdes/sort_order_serdes.py@@ -30,7 +30,7 @@ class SortOrderSerdes(SerdesUtilsBase, JsonSerializable[SortOrderDTO]):"""Custom JSON serializer/deserializer for SortOrderDTO objects."""@classmethod- def serialize(cls, data_type: SortOrderDTO) -> dict[str, Any]:+ def serialize(cls, value: SortOrderDTO) -> dict[str, Any]:"""Serialize the given data into a dictionary.@@ -42,9 +42,9 @@ class SortOrderSerdes(SerdesUtilsBase, JsonSerializable[SortOrderDTO]):"""return {- cls.SORT_TERM: SerdesUtils.write_function_arg(data_type.sort_term()),- cls.DIRECTION: str(data_type.direction()),- cls.NULL_ORDERING: str(data_type.null_ordering()),+ cls.SORT_TERM: SerdesUtils.write_function_arg(value.sort_term()),+ cls.DIRECTION: str(value.direction()),+ cls.NULL_ORDERING: str(value.null_ordering()),}@classmethoddiff --git a/clients/client-python/gravitino/dto/rel/partitioning/json_serdes/partitioning_serdes.py b/clients/client-python/gravitino/dto/rel/partitioning/json_serdes/partitioning_serdes.pyindex da9e95701b..de2cc58c58 100644--- a/clients/client-python/gravitino/dto/rel/partitioning/json_serdes/partitioning_serdes.py+++ b/clients/client-python/gravitino/dto/rel/partitioning/json_serdes/partitioning_serdes.py@@ -68,7 +68,7 @@ class PartitioningSerdes(SerdesUtilsBase, JsonSerializable[Partitioning]):)@classmethod- def serialize(cls, data_type: Partitioning) -> Dict[str, Any]:+ def serialize(cls, value: Partitioning) -> Dict[str, Any]:"""Serialize the given PartitionDTO object.Args:@@ -81,28 +81,28 @@ class PartitioningSerdes(SerdesUtilsBase, JsonSerializable[Partitioning]):IOError: If partitioning strategy is unknown."""- strategy = data_type.strategy()+ strategy = value.strategy()result = {cls.STRATEGY: strategy.name.lower()}if strategy in cls._SINGLE_FIELD_PARTITIONING:- dto = cast(SingleFieldPartitioning, data_type)+ dto = cast(SingleFieldPartitioning, value)return {**result, cls.FIELD_NAME: dto.field_name()}if strategy is Partitioning.Strategy.BUCKET:- dto = cast(BucketPartitioningDTO, data_type)+ dto = cast(BucketPartitioningDTO, value)return {**result,cls.NUM_BUCKETS: dto.num_buckets(),cls.FIELD_NAMES: dto.field_names(),}if strategy is Partitioning.Strategy.TRUNCATE:- dto = cast(TruncatePartitioningDTO, data_type)+ dto = cast(TruncatePartitioningDTO, value)return {**result,cls.WIDTH: dto.width(),cls.FIELD_NAME: dto.field_name(),}if strategy is Partitioning.Strategy.LIST:- dto = cast(ListPartitioningDTO, data_type)+ dto = cast(ListPartitioningDTO, value)return {**result,cls.FIELD_NAMES: dto.field_names(),@@ -112,7 +112,7 @@ class PartitioningSerdes(SerdesUtilsBase, JsonSerializable[Partitioning]):],}if strategy is Partitioning.Strategy.RANGE:- dto = cast(RangePartitioningDTO, data_type)+ dto = cast(RangePartitioningDTO, value)return {**result,cls.FIELD_NAME: dto.field_name(),@@ -122,7 +122,7 @@ class PartitioningSerdes(SerdesUtilsBase, JsonSerializable[Partitioning]):],}if strategy is Partitioning.Strategy.FUNCTION:- dto = cast(FunctionPartitioningDTO, data_type)+ dto = cast(FunctionPartitioningDTO, value)return {**result,cls.FUNCTION_NAME: dto.function_name(),diff --git a/clients/client-python/gravitino/dto/rel/partitions/json_serdes/partition_dto_serdes.py b/clients/client-python/gravitino/dto/rel/partitions/json_serdes/partition_dto_serdes.pyindex 030ffb5e24..e81d4d3b14 100644--- a/clients/client-python/gravitino/dto/rel/partitions/json_serdes/partition_dto_serdes.py+++ b/clients/client-python/gravitino/dto/rel/partitions/json_serdes/partition_dto_serdes.py@@ -24,8 +24,8 @@ from gravitino.dto.rel.partitions.partition_dto import PartitionDTOclass PartitionDTOSerdes(JsonSerializable[PartitionDTO]):@classmethod- def serialize(cls, data_type: PartitionDTO) -> Dict[str, Any]:- return SerdesUtils.write_partition(data_type)+ def serialize(cls, value: PartitionDTO) -> Dict[str, Any]:+ return SerdesUtils.write_partition(value)@classmethoddef deserialize(cls, data: Dict[str, Any]) -> PartitionDTO:diff --git a/clients/client-python/pylintrc b/clients/client-python/pylintrcindex 6977c28efd..4adb711856 100644--- a/clients/client-python/pylintrc+++ b/clients/client-python/pylintrc@@ -94,3 +94,8 @@ variable-naming-style=snake_case# Naming Style for Modulemodule-naming-style=snake_case++[DESIGN]++# Maximum number of return / yield for a function / method body.+max-returns=10