Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
0bc67b03
Unverified
Commit
0bc67b03
authored
Sep 01, 2020
by
Ryan McKinley
Committed by
GitHub
Sep 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InfluxDB: return a table rather than an error when timeseries is missing time (#27320)
parent
ff1149ac
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
26 deletions
+56
-26
pkg/tsdb/influxdb/flux/builder.go
+28
-26
pkg/tsdb/influxdb/flux/executor_test.go
+7
-0
pkg/tsdb/influxdb/flux/testdata/single.csv
+5
-0
pkg/tsdb/influxdb/flux/testdata/single.golden.txt
+16
-0
No files found.
pkg/tsdb/influxdb/flux/builder.go
View file @
0bc67b03
...
...
@@ -119,40 +119,42 @@ func (fb *frameBuilder) Init(metadata *query.FluxTableMetadata) error {
}
}
// Timeseries has a "_value" and a time
if
fb
.
isTimeSeries
{
col
:=
getTimeSeriesTimeColumn
(
columns
)
if
col
==
nil
{
return
fmt
.
Errorf
(
"no time column in timeSeries"
)
if
col
!=
nil
{
fb
.
timeColumn
=
col
.
Name
()
fb
.
timeDisplay
=
"Time"
if
"_time"
!=
fb
.
timeColumn
{
fb
.
timeDisplay
=
col
.
Name
()
}
return
nil
}
}
fb
.
timeColumn
=
col
.
Name
()
fb
.
timeDisplay
=
"Time"
if
"_time"
!=
fb
.
timeColumn
{
fb
.
timeDisplay
=
col
.
Name
()
// reset any timeseries properties
fb
.
value
=
nil
fb
.
isTimeSeries
=
false
fb
.
labels
=
make
([]
string
,
0
)
for
_
,
col
:=
range
columns
{
// Skip the result column
if
col
.
Index
()
==
0
&&
col
.
Name
()
==
"result"
&&
col
.
DataType
()
==
stringDatatype
{
continue
}
if
col
.
Index
()
==
1
&&
col
.
Name
()
==
"table"
&&
col
.
DataType
()
==
longDatatype
{
continue
}
}
else
{
fb
.
labels
=
make
([]
string
,
0
)
for
_
,
col
:=
range
columns
{
// Skip the result column
if
col
.
Index
()
==
0
&&
col
.
Name
()
==
"result"
&&
col
.
DataType
()
==
stringDatatype
{
continue
}
if
col
.
Index
()
==
1
&&
col
.
Name
()
==
"table"
&&
col
.
DataType
()
==
longDatatype
{
continue
}
converter
,
err
:=
getConverter
(
col
.
DataType
())
if
err
!=
nil
{
return
err
}
fb
.
columns
=
append
(
fb
.
columns
,
columnInfo
{
name
:
col
.
Name
(),
converter
:
converter
,
})
converter
,
err
:=
getConverter
(
col
.
DataType
())
if
err
!=
nil
{
return
err
}
}
fb
.
columns
=
append
(
fb
.
columns
,
columnInfo
{
name
:
col
.
Name
(),
converter
:
converter
,
})
}
return
nil
}
...
...
pkg/tsdb/influxdb/flux/executor_test.go
View file @
0bc67b03
...
...
@@ -87,6 +87,13 @@ func TestExecuteSimple(t *testing.T) {
})
}
func
TestExecuteSingle
(
t
*
testing
.
T
)
{
t
.
Run
(
"Single value"
,
func
(
t
*
testing
.
T
)
{
dr
:=
verifyGoldenResponse
(
t
,
"single"
)
require
.
Len
(
t
,
dr
.
Frames
,
1
)
})
}
func
TestExecuteMultiple
(
t
*
testing
.
T
)
{
t
.
Run
(
"Multiple Test"
,
func
(
t
*
testing
.
T
)
{
dr
:=
verifyGoldenResponse
(
t
,
"multiple"
)
...
...
pkg/tsdb/influxdb/flux/testdata/single.csv
0 → 100644
View file @
0bc67b03
#group,false,false,true,false
#datatype,string,long,string,long
#default,_result,,,
,result,table,_field,_value
,,0,summary_serial_number,6
pkg/tsdb/influxdb/flux/testdata/single.golden.txt
0 → 100644
View file @
0bc67b03
🌟 This was machine generated. Do not edit. 🌟
Frame[0] {}
Name:
Dimensions: 2 Fields by 1 Rows
+-----------------------+----------------+
| Name: _field | Name: _value |
| Labels: | Labels: |
| Type: []*string | Type: []*int64 |
+-----------------------+----------------+
| summary_serial_number | 6 |
+-----------------------+----------------+
====== TEST DATA RESPONSE (arrow base64) ======
FRAME=QVJST1cxAAD/////kAEAABAAAAAAAAoADgAMAAsABAAKAAAAFAAAAAAAAAEDAAoADAAAAAgABAAKAAAACAAAAHQAAAADAAAATAAAACgAAAAEAAAA+P7//wgAAAAMAAAAAAAAAAAAAAAFAAAAcmVmSWQAAAAY////CAAAAAwAAAAAAAAAAAAAAAQAAABuYW1lAAAAADj///8IAAAADAAAAAIAAAB7fQAABAAAAG1ldGEAAAAAAgAAAIQAAAAEAAAAlv///xQAAAA8AAAARAAAAAAAAgFIAAAAAQAAAAQAAACE////CAAAABAAAAAGAAAAX3ZhbHVlAAAEAAAAbmFtZQAAAAAAAAAACAAMAAgABwAIAAAAAAAAAUAAAAAGAAAAX3ZhbHVlAAAAABIAGAAUABMAEgAMAAAACAAEABIAAAAUAAAARAAAAEgAAAAAAAUBRAAAAAEAAAAMAAAACAAMAAgABAAIAAAACAAAABAAAAAGAAAAX2ZpZWxkAAAEAAAAbmFtZQAAAAAAAAAABAAEAAQAAAAGAAAAX2ZpZWxkAAD/////yAAAABQAAAAAAAAADAAWABQAEwAMAAQADAAAACgAAAAAAAAAFAAAAAAAAAMDAAoAGAAMAAgABAAKAAAAFAAAAGgAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAAAAAAABgAAAAAAAAAIAAAAAAAAAAAAAAAAAAAACAAAAAAAAAACAAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABUAAABzdW1tYXJ5X3NlcmlhbF9udW1iZXIAAAAGAAAAAAAAABAAAAAMABQAEgAMAAgABAAMAAAAEAAAACwAAAA8AAAAAAADAAEAAACgAQAAAAAAANAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoADAAAAAgABAAKAAAACAAAAHQAAAADAAAATAAAACgAAAAEAAAA+P7//wgAAAAMAAAAAAAAAAAAAAAFAAAAcmVmSWQAAAAY////CAAAAAwAAAAAAAAAAAAAAAQAAABuYW1lAAAAADj///8IAAAADAAAAAIAAAB7fQAABAAAAG1ldGEAAAAAAgAAAIQAAAAEAAAAlv///xQAAAA8AAAARAAAAAAAAgFIAAAAAQAAAAQAAACE////CAAAABAAAAAGAAAAX3ZhbHVlAAAEAAAAbmFtZQAAAAAAAAAACAAMAAgABwAIAAAAAAAAAUAAAAAGAAAAX3ZhbHVlAAAAABIAGAAUABMAEgAMAAAACAAEABIAAAAUAAAARAAAAEgAAAAAAAUBRAAAAAEAAAAMAAAACAAMAAgABAAIAAAACAAAABAAAAAGAAAAX2ZpZWxkAAAEAAAAbmFtZQAAAAAAAAAABAAEAAQAAAAGAAAAX2ZpZWxkAADAAQAAQVJST1cx
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment