bito-code-review[bot] commented on code in PR #38174: URL: https://github.com/apache/superset/pull/38174#discussion_r2839048770
########## requirements/base.in: ########## @@ -48,3 +48,6 @@ openapi-schema-validator>=0.6.3 # Known affected packages: Preset's 'clients' package # See docs/docs/contributing/pkg-resources-migration.md for details setuptools<81 + +# ODPS (MaxCompute) data source support +pyodps>=0.12.2 Review Comment: <div> <div id="suggestion"> <div id="issue"><b>Dependency Versioning Inconsistency</b></div> <div id="fix"> The new pyodps dependency uses only a lower bound (>=0.12.2), which differs from the pattern in this file where other dependencies include upper bounds to avoid breakage (e.g., async_timeout>=4.0.0,<5.0.0). Consider adding an upper bound like <0.13.0 to maintain consistency and reduce risk of future incompatibilities. </div> </div> <small><i>Code Review Run #3ebe85</i></small> </div> --- Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>) - [ ] Yes, avoid them ########## superset/db_engine_specs/odps.py: ########## @@ -0,0 +1,191 @@ +# 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. +from __future__ import annotations + +import logging +from typing import Any, Optional, TYPE_CHECKING + +from sqlalchemy import select, text +from sqlalchemy.engine.base import Engine + +from superset.databases.schemas import ( + TableMetadataColumnsResponse, + TableMetadataResponse, +) +from superset.databases.utils import ( + get_col_type, + get_foreign_keys_metadata, + get_indexes_metadata, +) +from superset.db_engine_specs.base import BaseEngineSpec, BasicParametersMixin +from superset.sql.parse import Partition, SQLScript +from superset.sql_parse import Table +from superset.superset_typing import ResultSetColumnType + +if TYPE_CHECKING: + from superset.models.core import Database + +logger = logging.getLogger(__name__) + + +class OdpsBaseEngineSpec(BaseEngineSpec): + @classmethod + def get_table_metadata( + cls, + database: Database, + table: Table, + partition: Optional[Partition] = None, + ) -> TableMetadataResponse: + """ + Returns basic table metadata + :param database: Database instance + :param table: A Table instance + :param partition: A Table partition info + :return: Basic table metadata + """ + return cls.get_table_metadata(database, table, partition) Review Comment: <div> <div id="suggestion"> <div id="issue"><b>Infinite Recursion Bug</b></div> <div id="fix"> The method calls itself recursively, leading to infinite recursion. It should call the base implementation from utils instead. </div> <details> <summary> <b>Code suggestion</b> </summary> <blockquote>Check the AI-generated fix before applying</blockquote> <div id="code"> ``` - from superset.databases.utils import ( - get_col_type, - get_foreign_keys_metadata, - get_indexes_metadata, - ) + from superset.databases.utils import ( + get_col_type, + get_foreign_keys_metadata, + get_indexes_metadata, + get_table_metadata, + ) @@ -60,1 +60,1 @@ - return cls.get_table_metadata(database, table, partition) + return get_table_metadata(database, table) ``` </div> </details> </div> <small><i>Code Review Run #3ebe85</i></small> </div> --- Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>) - [ ] Yes, avoid them -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
