diff --git a/influxql/ast.go b/influxql/ast.go index 160d1db2b5..7e0447f1ba 100644 --- a/influxql/ast.go +++ b/influxql/ast.go @@ -12,23 +12,23 @@ import ( ) // DataType represents the primitive data types available in InfluxQL. -type DataType string +type DataType int const ( // Unknown primitive data type. - Unknown = DataType("") + Unknown DataType = 0 // Float means the data type is a float - Float = DataType("float") + Float = 1 // Integer means the data type is a integer - Integer = DataType("integer") + Integer = 2 // Boolean means the data type is a boolean. - Boolean = DataType("boolean") + Boolean = 3 // String means the data type is a string of text. - String = DataType("string") + String = 4 // Time means the data type is a time. - Time = DataType("time") + Time = 5 // Duration means the data type is a duration of time. - Duration = DataType("duration") + Duration = 6 ) // InspectDataType returns the data type of a given value. diff --git a/tsdb/internal/meta.pb.go b/tsdb/internal/meta.pb.go index b338b9dc7d..43d3eb3bf0 100644 --- a/tsdb/internal/meta.pb.go +++ b/tsdb/internal/meta.pb.go @@ -1,12 +1,12 @@ -// Code generated by protoc-gen-gogo. -// source: internal/meta.proto +// Code generated by protoc-gen-go. +// source: meta.proto // DO NOT EDIT! /* Package internal is a generated protocol buffer package. It is generated from these files: - internal/meta.proto + meta.proto It has these top-level messages: Series @@ -16,7 +16,7 @@ It has these top-level messages: */ package internal -import proto "github.com/gogo/protobuf/proto" +import proto "github.com/golang/protobuf/proto" import math "math" // Reference imports to suppress errors if they are not otherwise used. @@ -90,7 +90,7 @@ func (m *MeasurementFields) GetFields() []*Field { type Field struct { ID *int32 `protobuf:"varint,1,req" json:"ID,omitempty"` Name *string `protobuf:"bytes,2,req" json:"Name,omitempty"` - Type *string `protobuf:"bytes,3,req" json:"Type,omitempty"` + Type *int32 `protobuf:"varint,3,req" json:"Type,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -112,11 +112,11 @@ func (m *Field) GetName() string { return "" } -func (m *Field) GetType() string { +func (m *Field) GetType() int32 { if m != nil && m.Type != nil { return *m.Type } - return "" + return 0 } func init() { diff --git a/tsdb/internal/meta.proto b/tsdb/internal/meta.proto index eea1f1073d..d1deff6c5a 100644 --- a/tsdb/internal/meta.proto +++ b/tsdb/internal/meta.proto @@ -23,5 +23,5 @@ message MeasurementFields { message Field { required int32 ID = 1; required string Name = 2; - required string Type = 3; + required int32 Type = 3; } \ No newline at end of file diff --git a/tsdb/shard.go b/tsdb/shard.go index 96180298f9..8c415db806 100644 --- a/tsdb/shard.go +++ b/tsdb/shard.go @@ -426,7 +426,7 @@ func (m *measurementFields) MarshalBinary() ([]byte, error) { for _, f := range m.Fields { id := int32(f.ID) name := f.Name - t := string(f.Type) + t := int32(f.Type) pb.Fields = append(pb.Fields, &internal.Field{ID: &id, Name: &name, Type: &t}) } return proto.Marshal(&pb)