Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return __time in Druid scan #4504

Merged
merged 3 commits into from
Mar 9, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 2 additions & 1 deletion superset/connectors/druid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ 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 +1114,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 @@ -2040,7 +2040,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('__timestamp') or d.get('__time'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a constant in scope that you can use: DTTM_ALIAS : d.get(DTTM_ALIAS) or d.get('__time'),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could introduce a DRUID_DTTM_ALIAS constant but may be out of scope for this PR

}

def get_data(self, df):
Expand Down