Skip to content

Commit

Permalink
fix: druid fetcher config bug
Browse files Browse the repository at this point in the history
Signed-off-by: nkoppisetty <nandita.iitkgp@gmail.com>
  • Loading branch information
nkoppisetty committed Aug 23, 2023
1 parent ca76f85 commit e50e354
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion udf/anomaly-detection/src/connectors/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ class Pivot:
class DruidFetcherConf:
datasource: str
dimensions: list[str] = field(default_factory=list)
aggregations: dict = field(default_factory=lambda: {"count": doublesum("count")})
aggregations: dict = field(default_factory=lambda: dict)
group_by: list[str] = field(default_factory=list)
pivot: Pivot = field(default_factory=lambda: Pivot())
granularity: str = "minute"

def __post_init__(self):
if not self.aggregations:
self.aggregations = {"count": doublesum("count")}
2 changes: 1 addition & 1 deletion udf/anomaly-detection/src/connectors/druid.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def fetch_data(
if group_by:
df = df.groupby(by=group_by).sum().reset_index()

if pivot:
if pivot.columns:
df = df.pivot(
index=pivot.index,
columns=pivot.columns,
Expand Down

0 comments on commit e50e354

Please sign in to comment.