Skip to content

Commit

Permalink
Merge branch 'master' into gg-DashboardTimeoutWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo committed Jun 6, 2017
2 parents 4e907a0 + 65f25a1 commit 0196c5f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
8 changes: 8 additions & 0 deletions superset/connectors/druid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,9 @@ def sync_to_db(cls, name, cluster, merge):
logging.error("Failed at fetching the latest segment")
return
for col in cols:
# Skip the time column
if col == "__time":
continue
col_obj = (
session
.query(DruidColumn)
Expand All @@ -618,6 +621,11 @@ def sync_to_db(cls, name, cluster, merge):
col_obj.filterable = True
if datatype == "hyperUnique" or datatype == "thetaSketch":
col_obj.count_distinct = True
# If long or double, allow sum/min/max
if datatype == "LONG" or datatype == "DOUBLE":
col_obj.sum = True
col_obj.min = True
col_obj.max = True
if col_obj:
col_obj.type = cols[col]['type']
session.flush()
Expand Down
33 changes: 17 additions & 16 deletions superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,22 +477,23 @@ def get_sqla_query( # sqla
if op == 'not in':
cond = ~cond
where_clause_and.append(cond)
if col_obj.is_num:
eq = utils.string_to_num(flt['val'])
if op == '==':
where_clause_and.append(col_obj.sqla_col == eq)
elif op == '!=':
where_clause_and.append(col_obj.sqla_col != eq)
elif op == '>':
where_clause_and.append(col_obj.sqla_col > eq)
elif op == '<':
where_clause_and.append(col_obj.sqla_col < eq)
elif op == '>=':
where_clause_and.append(col_obj.sqla_col >= eq)
elif op == '<=':
where_clause_and.append(col_obj.sqla_col <= eq)
elif op == 'LIKE':
where_clause_and.append(col_obj.sqla_col.like(eq))
else:
if col_obj.is_num:
eq = utils.string_to_num(flt['val'])
if op == '==':
where_clause_and.append(col_obj.sqla_col == eq)
elif op == '!=':
where_clause_and.append(col_obj.sqla_col != eq)
elif op == '>':
where_clause_and.append(col_obj.sqla_col > eq)
elif op == '<':
where_clause_and.append(col_obj.sqla_col < eq)
elif op == '>=':
where_clause_and.append(col_obj.sqla_col >= eq)
elif op == '<=':
where_clause_and.append(col_obj.sqla_col <= eq)
elif op == 'LIKE':
where_clause_and.append(col_obj.sqla_col.like(eq))
if extras:
where = extras.get('where')
if where:
Expand Down

0 comments on commit 0196c5f

Please sign in to comment.