github-actions[bot] commented on code in PR #60779:
URL: https://github.com/apache/doris/pull/60779#discussion_r2943078929
##########
extension/dbt-doris/dbt/adapters/doris/impl.py:
##########
@@ -20,38 +20,33 @@
from dbt.adapters.sql import SQLAdapter
-from concurrent.futures import Future
from enum import Enum
from typing import (
Any,
- Callable,
Dict,
- Iterable,
- Iterator,
List,
- Mapping,
Optional,
Set,
- Tuple,
- Type,
- Union,
+ Tuple
)
import agate
import dbt.exceptions
-from dbt.adapters.base.impl import _expect_row_value, catch_as_completed
from dbt.adapters.base.relation import InformationSchema, BaseRelation
from dbt.adapters.doris.column import DorisColumn
from dbt.adapters.doris.connections import DorisConnectionManager
from dbt.adapters.doris.relation import DorisRelation
from dbt.adapters.protocol import AdapterConfig
from dbt.adapters.sql.impl import LIST_RELATIONS_MACRO_NAME,
LIST_SCHEMAS_MACRO_NAME
-from dbt_common.clients.agate_helper import table_from_rows
from dbt.contracts.graph.manifest import Manifest
from dbt.adapters.contracts.relation import RelationType
-from dbt_common.utils import executor
from dbt.adapters.doris.doris_column_item import DorisColumnItem
+from dbt_common.exceptions import CompilationError
+from dbt.adapters.events.logging import AdapterLogger
+
Review Comment:
Nit: `AdapterLogger` is imported and `logger` is assigned (line 49) but
never used anywhere in this file. Consider removing both the import and the
`logger` variable to keep the code clean.
##########
extension/dbt-doris/dbt/adapters/doris/impl.py:
##########
@@ -139,56 +134,14 @@ def list_relations_without_caching(self, schema_relation:
DorisRelation) -> List
return relations
- def get_catalog(self, manifest):
- schema_map = self._get_catalog_schemas(manifest)
-
- with executor(self.config) as tpe:
- futures: List[Future[agate.Table]] = []
- for info, schemas in schema_map.items():
- for schema in schemas:
- futures.append(
- tpe.submit_connected(
- self,
- schema,
- self._get_one_catalog,
- info,
- [schema],
- manifest,
- )
- )
- catalogs, exceptions = catch_as_completed(futures)
- return catalogs, exceptions
-
- @classmethod
- def _catalog_filter_schemas(cls, manifest: Manifest) ->
Callable[[agate.Row], bool]:
- schemas = frozenset((None, s.lower()) for d, s in
manifest.get_used_schemas())
-
- def _(row: agate.Row) -> bool:
- table_database = _expect_row_value("table_database", row)
- table_schema = _expect_row_value("table_schema", row)
- if table_schema is None:
- return False
- return (table_database, table_schema.lower()) in schemas
-
- return _
-
- @classmethod
- def _catalog_filter_table(cls, table: agate.Table, manifest: Manifest) ->
agate.Table:
- table = table_from_rows(
- table.rows,
- table.column_names,
- text_only_columns=["table_schema", "table_name"],
- )
- return table.where(cls._catalog_filter_schemas(manifest))
-
def _get_one_catalog(
self,
information_schema: InformationSchema,
schemas: Set[str],
manifest: Manifest,
) -> agate.Table:
if len(schemas) != 1:
- dbt.exceptions.raise_compiler_error(
+ CompilationError(
f"Expected only one schema in Doris _get_one_catalog, found "
f"{schemas}"
Review Comment:
Bug: Missing `raise` keyword. This line constructs a `CompilationError`
object but does not raise it. The error condition will be silently ignored and
execution will fall through to `super()._get_one_catalog(...)` even when
`len(schemas) != 1`.
The original code used `dbt.exceptions.raise_compiler_error(...)` which is a
function that raises internally. The replacement needs an explicit `raise`:
```python
raise CompilationError(
f"Expected only one schema in Doris _get_one_catalog, found
" f"{schemas}"
)
```
--
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]