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

Timestamp from Kylin become 1970/01/01... #4356

Closed
3 tasks
lexrf opened this issue Feb 6, 2018 · 2 comments
Closed
3 tasks

Timestamp from Kylin become 1970/01/01... #4356

lexrf opened this issue Feb 6, 2018 · 2 comments
Labels
inactive Inactive for >= 30 days

Comments

@lexrf
Copy link

lexrf commented Feb 6, 2018

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if any
  • I have reproduced the issue with at least the latest released version of superset
  • I have checked the issue tracker for the same issue and I haven't found one similar

Superset version

0.22.1

Expected results

Time series chat display correctly
In json format data, timestamp is correct unix timestamp format

Actual results

All time in time series become 1970
In json format data, timestamp become something like1517.2956000000001
At the same time, if use query tool execute raw query, time stamp is
1517295600.0

Steps to reproduce

Config kylin datasource
select table
build time with hour as timecolumn
select Timeseries-linechart
View the x ais
dowload the json format

@lexrf
Copy link
Author

lexrf commented Feb 7, 2018

I debugged the code and found the problem happens in viz.py 114-122

        if DTTM_ALIAS in df.columns:
            if timestamp_format in ('epoch_s', 'epoch_ms'):
                df[DTTM_ALIAS] = pd.to_datetime(df[DTTM_ALIAS], utc=False)
            else:
                df[DTTM_ALIAS] = pd.to_datetime(
                    df[DTTM_ALIAS], utc=False, format=timestamp_format)
            if self.datasource.offset:
                df[DTTM_ALIAS] += timedelta(hours=self.datasource.offset)

it use pandas.to_datetime to convert the timestamp value to datetime format. However, by default the to_datetime function us ns as original time unit. And the query result is in second. This make time value * 10e-9 after convert.

Surperset should use some code to determine the timestamp unit.

@stale
Copy link

stale bot commented Apr 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Apr 11, 2019
@stale stale bot closed this as completed Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Inactive for >= 30 days
Projects
None yet
Development

No branches or pull requests

1 participant