[fix] pydruid export_pandas (#9006)

* [fix] pydruid export_pandas

* Update models.py
This commit is contained in:
John Bodley 2020-01-23 15:38:28 -08:00 committed by GitHub
parent 04be1d4b42
commit 4b5d141f20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -1264,6 +1264,8 @@ class DruidDatasource(Model, BaseDatasource):
return query_str
query_str += "// Phase 2 (built based on phase one's results)\n"
df = client.export_pandas()
if df is None:
df = pd.DataFrame()
qry["filter"] = self._add_filter_from_pre_query_data(
df, [pre_qry["dimension"]], filters
)
@ -1332,6 +1334,8 @@ class DruidDatasource(Model, BaseDatasource):
return query_str
query_str += "// Phase 2 (built based on phase one's results)\n"
df = client.export_pandas()
if df is None:
df = pd.DataFrame()
qry["filter"] = self._add_filter_from_pre_query_data(
df, pre_qry["dimensions"], filters
)
@ -1376,6 +1380,8 @@ class DruidDatasource(Model, BaseDatasource):
client = self.cluster.get_pydruid_client()
query_str = self.get_query_str(client=client, query_obj=query_obj, phase=2)
df = client.export_pandas()
if df is None:
df = pd.DataFrame()
if df.empty:
return QueryResult(