Skip to content

Commit

Permalink
fix: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar committed Oct 11, 2023
1 parent a113fee commit 27158c4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions influxdb3/query_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ func (i *QueryIterator) Next() bool {
return true
}

func (i *QueryIterator) ValueAsPoint() *Point {
// AsPoints return data from InfluxDB IOx into PointValues structure.
func (i *QueryIterator) AsPoints() *PointValues {
readerSchema := i.reader.Schema()
p := NewPointWithMeasurement("__empty__")
p := NewPointValues("")

for ci, col := range i.record.Columns() {
schema := readerSchema.Field(ci)
Expand All @@ -113,15 +114,15 @@ func (i *QueryIterator) ValueAsPoint() *Point {
metadataType, hasmetadataType := schema.Metadata.GetValue("iox::column::type")

if stringValue, isString := value.(string); ((name == "measurement") || (name == "iox::measurement")) && isString {
p.Measurement = stringValue
p.SetMeasurement(stringValue)
continue

Check warning on line 118 in influxdb3/query_iterator.go

View check run for this annotation

Codecov / codecov/patch

influxdb3/query_iterator.go#L114-L118

Added lines #L114 - L118 were not covered by tests
}

if !hasmetadataType {
if timestampValue, isTimestamp := value.(arrow.Timestamp); isTimestamp && name == "time" {
p.SetTimestamp(timestampValue.ToTime(arrow.Nanosecond))
} else {
p.AddField(name, value)
p.SetField(name, value)
}
continue

Check warning on line 127 in influxdb3/query_iterator.go

View check run for this annotation

Codecov / codecov/patch

influxdb3/query_iterator.go#L121-L127

Added lines #L121 - L127 were not covered by tests
}
Expand All @@ -134,9 +135,9 @@ func (i *QueryIterator) ValueAsPoint() *Point {
// }

if valueType == "field" {
p.AddField(name, value)
p.SetField(name, value)
} else if stringValue, isString := value.(string); isString && valueType == "tag" {
p.AddTag(name, stringValue)
p.SetField(name, stringValue)
} else if timestampValue, isTimestamp := value.(arrow.Timestamp); isTimestamp && valueType == "timestamp" {
p.SetTimestamp(timestampValue.ToTime(arrow.Nanosecond))
}

Check warning on line 143 in influxdb3/query_iterator.go

View check run for this annotation

Codecov / codecov/patch

influxdb3/query_iterator.go#L130-L143

Added lines #L130 - L143 were not covered by tests
Expand Down

0 comments on commit 27158c4

Please sign in to comment.