Skip to content

Commit

Permalink
Return __time in Druid scan (apache#4504)
Browse files Browse the repository at this point in the history
* Return __time in Druid scan

* use constant instead of __timestamp

* Fix lint
  • Loading branch information
betodealmeida authored and mistercrunch committed Mar 9, 2018
1 parent c6af488 commit 1647004
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion superset/assets/visualizations/deckgl/layers/scatter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { unitToRadius } from '../../../javascripts/modules/geo';
import sandboxedEval from '../../../javascripts/modules/sandbox';

function getStep(timeGrain) {
// grain in microseconds
// grain in milliseconds
const MINUTE = 60 * 1000;
const HOUR = 60 * MINUTE;
const DAY = 24 * HOUR;
Expand Down
4 changes: 3 additions & 1 deletion superset/connectors/druid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ def get_datasources(self):
return json.loads(requests.get(endpoint).text)

def get_druid_version(self):
endpoint = self.get_base_coordinator_url() + '/status'
endpoint = self.get_base_url(
self.coordinator_host, self.coordinator_port) + '/status'
return json.loads(requests.get(endpoint).text)['version']

def refresh_datasources(
Expand Down Expand Up @@ -1114,6 +1115,7 @@ def run_query( # noqa / druid
order_direction = 'descending' if order_desc else 'ascending'

if columns:
columns.append('__time')
del qry['post_aggregations']
del qry['aggregations']
qry['dimensions'] = columns
Expand Down
2 changes: 1 addition & 1 deletion superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,7 @@ def get_properties(self, d):
'radius': self.fixed_value if self.fixed_value else d.get(self.metric),
'cat_color': d.get(self.dim) if self.dim else None,
'position': d.get('spatial'),
'__timestamp': d.get('__timestamp'),
'__timestamp': d.get(DTTM_ALIAS) or d.get('__time'),
}

def get_data(self, df):
Expand Down

0 comments on commit 1647004

Please sign in to comment.