Skip to content

Commit

Permalink
Avoid conversion to wide if no rows since that throws errors. (#73)
Browse files Browse the repository at this point in the history
* Avoid conversion to wide if no rows since that throws errors.

Signed-off-by: Taras Priadka <[email protected]>
  • Loading branch information
TarasPriadka authored Jul 12, 2022
1 parent cc697a0 commit 907b1ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/pixie_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,14 @@ func (qp PixieQueryProcessor) queryScript(

// Add the frames to the response.
for _, tablePrinter := range tm.pxTablePrinterLst {
// If time series schema long && time_ column, convert to wide. Otherwise
// If time series schema long && time_ column && table not empty, convert to wide. Otherwise
// proceed as normal.
tsSchema := tablePrinter.frame.TimeSeriesSchema()
if tablePrinter.FormatGrafanaTimeFrame() && tsSchema.Type == data.TimeSeriesTypeLong {
numRows, err := tablePrinter.frame.RowLen()
if err != nil {
return nil, err
}
if numRows != 0 && tablePrinter.FormatGrafanaTimeFrame() && tsSchema.Type == data.TimeSeriesTypeLong {
wideFrame, err := data.LongToWide(tablePrinter.frame,
&data.FillMissing{Mode: data.FillModeNull})
if err != nil {
Expand Down

0 comments on commit 907b1ed

Please sign in to comment.