Skip to content

Commit

Permalink
fix: add complex type to pydruid (#20834)
Browse files Browse the repository at this point in the history
* fix: add complex type to pydruid

* Kick jobs
  • Loading branch information
betodealmeida committed Jul 25, 2022
1 parent c4564a9 commit 672266c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion superset/db_engine_specs/druid.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
import json
import logging
from datetime import datetime
from typing import Any, Dict, Optional, TYPE_CHECKING
from typing import Any, Dict, List, Optional, TYPE_CHECKING

from sqlalchemy import types
from sqlalchemy.engine.reflection import Inspector

from superset import is_feature_enabled
from superset.db_engine_specs.base import BaseEngineSpec
Expand Down Expand Up @@ -119,3 +122,17 @@ def epoch_ms_to_dttm(cls) -> str:
Convert from number of milliseconds since the epoch to a timestamp.
"""
return "MILLIS_TO_TIMESTAMP({col})"

@classmethod
def get_columns(
cls, inspector: Inspector, table_name: str, schema: Optional[str]
) -> List[Dict[str, Any]]:
"""
Update the Druid type map.
"""
# pylint: disable=import-outside-toplevel
from pydruid.db.sqlalchemy import type_map

type_map["complex<hllsketch>"] = types.BLOB

return super().get_columns(inspector, table_name, schema)

0 comments on commit 672266c

Please sign in to comment.