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

Ability to select result format is missing. #34

Closed
yesoreyeram opened this issue Sep 9, 2022 · 4 comments
Closed

Ability to select result format is missing. #34

yesoreyeram opened this issue Sep 9, 2022 · 4 comments

Comments

@yesoreyeram
Copy link
Contributor

Some query results failed to display in explore mode due to incorrect "data.FrameMeta.PreferredVisualization" settings. Also looks like we don't have format selector in the frontend.

image

@yesoreyeram
Copy link
Contributor Author

@scottlepp - I see the following code

const format = sql.toLowerCase().includes('as time') ? Format.TIMESERIES : Format.TABLE;
onChange({ ...query, rawCql: sql, format }, true);
is doing automatic format computation based on query string. This is problematic when you want to visualise a table with time field. Also this is problematic when user want to visualise the data as logs.

Also I see we defaults to timeseries, where most cases user receive tabular data. WDYT?

@scottlepp
Copy link
Contributor

hmm doesn't it default to table if they don't have an "as time" alias?

const format = sql.toLowerCase().includes('as time') ? Format.TIMESERIES : Format.TABLE; 

@yesoreyeram
Copy link
Contributor Author

no. Default format is not set anywhere.. so the go code fallback to 0 (timeseries).

Format sqlds.FormatQueryOption
and the following fallsback to timeseries
frame.Meta = &data.FrameMeta{
ExecutedQueryString: qm.ActualCql,
PreferredVisualization: data.VisTypeGraph,
Notices: notices,
}
if qm.Format == sqlds.FormatOptionTable {
frame.Meta.PreferredVisualization = data.VisTypeTable
return frame, nil
}
if qm.Format == sqlds.FormatOptionLogs {
frame.Meta.PreferredVisualization = data.VisTypeLogs
return frame, nil
}
if frame.TimeSeriesSchema().Type == data.TimeSeriesTypeLong {
fillMode := &data.FillMissing{Mode: data.FillModeNull}
if shouldSort(qm.RawCql) {
sortByTime(frame)
}
frame, err := data.LongToWide(frame, fillMode)
if err != nil {
return nil, err
}
return frame, nil
}
return frame, nil

@yesoreyeram
Copy link
Contributor Author

also sql.toLowerCase().includes('as time') doesn't makes sense when user have time field in table.

select server_name, restarted_time as time from servers doesn't qualify timeseries. WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants