Skip to content

Commit 119275a

Browse files
authored
chore(engine): Column naming conventions (#19396)
In the new engine, we need fully qualified column names, since columns from different sources can have the same name. Right now, the distinction between columns with the same name is implemented using the `Metadata` field on the `arrow.Field`. However, it is quite cumbersome to parse the column type and data type from this generic map. This PR introduces package with naming conventions for columns, defined by name, data type, and column type. So, this information can be encoded into the `Name` field of the `arrow.Field`. The convention is defined as ``` [DATA_TYPE].[COLUMN_TYPE].[COLUMN_NAME] ``` #### Examples: * `utf8.label.service_name` * `timestamp_ns.builtin.timestamp` The column type can easily be converted into a `Scope`, which is defined by an origin and type. The mapping is as follows: ``` ColumnTypeBuiltin -> Scope{Record, Attribute} ColumnTypeMetadata -> Scope{Record, Builtin} ColumnTypeLabel -> Scope{Resource, Attribute} ColumnTypeParsed -> Scope{Generated, Attribute} ColumnTypeGenerated -> Scope{Generated, Builtin} ColumnTypeAmbiguous -> Scope{Unscoped, Attribute} ``` --- Signed-off-by: Christian Haudum <[email protected]>
1 parent 3e415ac commit 119275a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+530
-271
lines changed

pkg/engine/compat.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/prometheus/prometheus/model/labels"
1010
"github.com/prometheus/prometheus/promql"
1111

12-
"github.com/grafana/loki/v3/pkg/engine/internal/datatype"
1312
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1413
"github.com/grafana/loki/v3/pkg/logproto"
1514
"github.com/grafana/loki/v3/pkg/logqlmodel"
@@ -311,7 +310,7 @@ func collectSamplesFromRow(builder *labels.Builder, rec arrow.Record, i int) (pr
311310
sample.F = col.Value(i)
312311
default:
313312
// allow any string columns
314-
if colDataType == datatype.Loki.String.String() {
313+
if colDataType == types.Loki.String.String() {
315314
builder.Set(colName, col.(*array.String).Value(i))
316315
}
317316
}

pkg/engine/compat_test.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/prometheus/prometheus/model/labels"
1111
"github.com/stretchr/testify/require"
1212

13-
"github.com/grafana/loki/v3/pkg/engine/internal/datatype"
1413
"github.com/grafana/loki/v3/pkg/engine/internal/executor"
1514
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1615
"github.com/grafana/loki/v3/pkg/logproto"
@@ -28,8 +27,8 @@ func TestStreamsResultBuilder(t *testing.T) {
2827
alloc := memory.NewCheckedAllocator(memory.DefaultAllocator)
2928
defer alloc.AssertSize(t, 0)
3029

31-
mdTypeLabel := datatype.ColumnMetadata(types.ColumnTypeLabel, datatype.Loki.String)
32-
mdTypeMetadata := datatype.ColumnMetadata(types.ColumnTypeMetadata, datatype.Loki.String)
30+
mdTypeLabel := types.ColumnMetadata(types.ColumnTypeLabel, types.Loki.String)
31+
mdTypeMetadata := types.ColumnMetadata(types.ColumnTypeMetadata, types.Loki.String)
3332

3433
t.Run("empty builder returns non-nil result", func(t *testing.T) {
3534
builder := newStreamsResultBuilder()
@@ -40,8 +39,8 @@ func TestStreamsResultBuilder(t *testing.T) {
4039
t.Run("rows without log line, timestamp, or labels are ignored", func(t *testing.T) {
4140
schema := arrow.NewSchema(
4241
[]arrow.Field{
43-
{Name: types.ColumnNameBuiltinTimestamp, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: datatype.ColumnMetadataBuiltinTimestamp},
44-
{Name: types.ColumnNameBuiltinMessage, Type: arrow.BinaryTypes.String, Metadata: datatype.ColumnMetadataBuiltinMessage},
42+
{Name: types.ColumnNameBuiltinTimestamp, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: types.ColumnMetadataBuiltinTimestamp},
43+
{Name: types.ColumnNameBuiltinMessage, Type: arrow.BinaryTypes.String, Metadata: types.ColumnMetadataBuiltinMessage},
4544
{Name: "env", Type: arrow.BinaryTypes.String, Metadata: mdTypeLabel},
4645
},
4746
nil,
@@ -97,8 +96,8 @@ func TestStreamsResultBuilder(t *testing.T) {
9796
t.Run("successful conversion of labels, log line, timestamp, and structured metadata ", func(t *testing.T) {
9897
schema := arrow.NewSchema(
9998
[]arrow.Field{
100-
{Name: types.ColumnNameBuiltinTimestamp, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: datatype.ColumnMetadataBuiltinTimestamp},
101-
{Name: types.ColumnNameBuiltinMessage, Type: arrow.BinaryTypes.String, Metadata: datatype.ColumnMetadataBuiltinMessage},
99+
{Name: types.ColumnNameBuiltinTimestamp, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: types.ColumnMetadataBuiltinTimestamp},
100+
{Name: types.ColumnNameBuiltinMessage, Type: arrow.BinaryTypes.String, Metadata: types.ColumnMetadataBuiltinMessage},
102101
{Name: "env", Type: arrow.BinaryTypes.String, Metadata: mdTypeLabel},
103102
{Name: "namespace", Type: arrow.BinaryTypes.String, Metadata: mdTypeLabel},
104103
{Name: "traceID", Type: arrow.BinaryTypes.String, Metadata: mdTypeMetadata},
@@ -167,7 +166,7 @@ func TestStreamsResultBuilder(t *testing.T) {
167166
}
168167

169168
func TestVectorResultBuilder(t *testing.T) {
170-
mdTypeString := datatype.ColumnMetadata(types.ColumnTypeAmbiguous, datatype.Loki.String)
169+
mdTypeString := types.ColumnMetadata(types.ColumnTypeAmbiguous, types.Loki.String)
171170
alloc := memory.NewCheckedAllocator(memory.DefaultAllocator)
172171
defer alloc.AssertSize(t, 0)
173172

@@ -180,8 +179,8 @@ func TestVectorResultBuilder(t *testing.T) {
180179
t.Run("successful conversion of vector data", func(t *testing.T) {
181180
schema := arrow.NewSchema(
182181
[]arrow.Field{
183-
{Name: types.ColumnNameBuiltinTimestamp, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: datatype.ColumnMetadataBuiltinTimestamp},
184-
{Name: types.ColumnNameGeneratedValue, Type: arrow.PrimitiveTypes.Float64, Metadata: datatype.ColumnMetadata(types.ColumnTypeGenerated, datatype.Loki.Float)},
182+
{Name: types.ColumnNameBuiltinTimestamp, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: types.ColumnMetadataBuiltinTimestamp},
183+
{Name: types.ColumnNameGeneratedValue, Type: arrow.PrimitiveTypes.Float64, Metadata: types.ColumnMetadata(types.ColumnTypeGenerated, types.Loki.Float)},
185184
{Name: "instance", Type: arrow.BinaryTypes.String, Metadata: mdTypeString},
186185
{Name: "job", Type: arrow.BinaryTypes.String, Metadata: mdTypeString},
187186
},
@@ -235,8 +234,8 @@ func TestVectorResultBuilder(t *testing.T) {
235234
t.Run("rows without timestamp or value are ignored", func(t *testing.T) {
236235
schema := arrow.NewSchema(
237236
[]arrow.Field{
238-
{Name: types.ColumnNameBuiltinTimestamp, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: datatype.ColumnMetadataBuiltinTimestamp},
239-
{Name: types.ColumnNameGeneratedValue, Type: arrow.PrimitiveTypes.Float64, Metadata: datatype.ColumnMetadata(types.ColumnTypeGenerated, datatype.Loki.Float)},
237+
{Name: types.ColumnNameBuiltinTimestamp, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: types.ColumnMetadataBuiltinTimestamp},
238+
{Name: types.ColumnNameGeneratedValue, Type: arrow.PrimitiveTypes.Float64, Metadata: types.ColumnMetadata(types.ColumnTypeGenerated, types.Loki.Float)},
240239
{Name: "instance", Type: arrow.BinaryTypes.String, Metadata: mdTypeString},
241240
},
242241
nil,
@@ -262,7 +261,7 @@ func TestVectorResultBuilder(t *testing.T) {
262261
}
263262

264263
func TestMatrixResultBuilder(t *testing.T) {
265-
mdTypeString := datatype.ColumnMetadata(types.ColumnTypeAmbiguous, datatype.Loki.String)
264+
mdTypeString := types.ColumnMetadata(types.ColumnTypeAmbiguous, types.Loki.String)
266265
alloc := memory.NewCheckedAllocator(memory.DefaultAllocator)
267266
defer alloc.AssertSize(t, 0)
268267

@@ -275,8 +274,8 @@ func TestMatrixResultBuilder(t *testing.T) {
275274
t.Run("successful conversion of matrix data", func(t *testing.T) {
276275
schema := arrow.NewSchema(
277276
[]arrow.Field{
278-
{Name: types.ColumnNameBuiltinTimestamp, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: datatype.ColumnMetadataBuiltinTimestamp},
279-
{Name: types.ColumnNameGeneratedValue, Type: arrow.PrimitiveTypes.Float64, Metadata: datatype.ColumnMetadata(types.ColumnTypeGenerated, datatype.Loki.Float)},
277+
{Name: types.ColumnNameBuiltinTimestamp, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: types.ColumnMetadataBuiltinTimestamp},
278+
{Name: types.ColumnNameGeneratedValue, Type: arrow.PrimitiveTypes.Float64, Metadata: types.ColumnMetadata(types.ColumnTypeGenerated, types.Loki.Float)},
280279
{Name: "instance", Type: arrow.BinaryTypes.String, Metadata: mdTypeString},
281280
{Name: "job", Type: arrow.BinaryTypes.String, Metadata: mdTypeString},
282281
},

pkg/engine/internal/datatype/util.go

Lines changed: 0 additions & 19 deletions
This file was deleted.

pkg/engine/internal/executor/aggregator.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ import (
1212
"github.com/apache/arrow-go/v18/arrow/memory"
1313
"github.com/cespare/xxhash/v2"
1414

15-
"github.com/grafana/loki/v3/pkg/engine/internal/datatype"
16-
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1715
"github.com/grafana/loki/v3/pkg/engine/internal/planner/physical"
16+
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1817
)
1918

2019
type groupState struct {
@@ -125,15 +124,15 @@ func (a *aggregator) BuildRecord() (arrow.Record, error) {
125124
fields = append(fields,
126125
arrow.Field{
127126
Name: types.ColumnNameBuiltinTimestamp,
128-
Type: datatype.Arrow.Timestamp,
127+
Type: types.Arrow.Timestamp,
129128
Nullable: false,
130-
Metadata: datatype.ColumnMetadataBuiltinTimestamp,
129+
Metadata: types.ColumnMetadataBuiltinTimestamp,
131130
},
132131
arrow.Field{
133132
Name: types.ColumnNameGeneratedValue,
134-
Type: datatype.Arrow.Float,
133+
Type: types.Arrow.Float,
135134
Nullable: false,
136-
Metadata: datatype.ColumnMetadata(types.ColumnTypeGenerated, datatype.Loki.Float),
135+
Metadata: types.ColumnMetadata(types.ColumnTypeGenerated, types.Loki.Float),
137136
},
138137
)
139138

@@ -145,9 +144,9 @@ func (a *aggregator) BuildRecord() (arrow.Record, error) {
145144

146145
fields = append(fields, arrow.Field{
147146
Name: colExpr.Ref.Column,
148-
Type: datatype.Arrow.String,
147+
Type: types.Arrow.String,
149148
Nullable: true,
150-
Metadata: datatype.ColumnMetadata(colExpr.Ref.Type, datatype.Loki.String),
149+
Metadata: types.ColumnMetadata(colExpr.Ref.Type, types.Loki.String),
151150
})
152151
}
153152

pkg/engine/internal/executor/aggregator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"github.com/apache/arrow-go/v18/arrow/memory"
88
"github.com/stretchr/testify/require"
99

10-
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1110
"github.com/grafana/loki/v3/pkg/engine/internal/planner/physical"
11+
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1212
"github.com/grafana/loki/v3/pkg/util/arrowtest"
1313
)
1414

pkg/engine/internal/executor/dataobjscan.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ import (
1616

1717
"github.com/grafana/loki/v3/pkg/dataobj/sections/logs"
1818
"github.com/grafana/loki/v3/pkg/dataobj/sections/streams"
19-
"github.com/grafana/loki/v3/pkg/engine/internal/datatype"
20-
"github.com/grafana/loki/v3/pkg/engine/internal/types"
2119
"github.com/grafana/loki/v3/pkg/engine/internal/planner/physical"
20+
"github.com/grafana/loki/v3/pkg/engine/internal/types"
2221
)
2322

2423
type dataobjScanOptions struct {
@@ -258,25 +257,25 @@ func logsColumnToEngineField(col *logs.Column) (arrow.Field, error) {
258257
case logs.ColumnTypeTimestamp:
259258
return arrow.Field{
260259
Name: types.ColumnNameBuiltinTimestamp,
261-
Type: datatype.Arrow.Timestamp,
260+
Type: types.Arrow.Timestamp,
262261
Nullable: true,
263-
Metadata: datatype.ColumnMetadata(types.ColumnTypeBuiltin, datatype.Loki.Timestamp),
262+
Metadata: types.ColumnMetadata(types.ColumnTypeBuiltin, types.Loki.Timestamp),
264263
}, nil
265264

266265
case logs.ColumnTypeMessage:
267266
return arrow.Field{
268267
Name: types.ColumnNameBuiltinMessage,
269-
Type: datatype.Arrow.String,
268+
Type: types.Arrow.String,
270269
Nullable: true,
271-
Metadata: datatype.ColumnMetadata(types.ColumnTypeBuiltin, datatype.Loki.String),
270+
Metadata: types.ColumnMetadata(types.ColumnTypeBuiltin, types.Loki.String),
272271
}, nil
273272

274273
case logs.ColumnTypeMetadata:
275274
return arrow.Field{
276275
Name: col.Name,
277-
Type: datatype.Arrow.String,
276+
Type: types.Arrow.String,
278277
Nullable: true,
279-
Metadata: datatype.ColumnMetadata(types.ColumnTypeMetadata, datatype.Loki.String),
278+
Metadata: types.ColumnMetadata(types.ColumnTypeMetadata, types.Loki.String),
280279
}, nil
281280
}
282281

pkg/engine/internal/executor/dataobjscan_predicate.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import (
1010
"github.com/apache/arrow-go/v18/arrow/scalar"
1111

1212
"github.com/grafana/loki/v3/pkg/dataobj/sections/logs"
13-
"github.com/grafana/loki/v3/pkg/engine/internal/datatype"
14-
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1513
"github.com/grafana/loki/v3/pkg/engine/internal/planner/physical"
14+
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1615
)
1716

1817
// buildLogsPredicate builds a [logs.Predicate] from an expr. The columns slice
@@ -38,8 +37,8 @@ func buildLogsPredicate(expr physical.Expression, columns []*logs.Column) (logs.
3837
return buildLogsBinaryPredicate(expr, columns)
3938

4039
case *physical.LiteralExpr:
41-
if expr.Literal.Type() == datatype.Loki.Bool {
42-
val := expr.Literal.(datatype.TypedLiteral[bool]).Value()
40+
if expr.Literal.Type() == types.Loki.Bool {
41+
val := expr.Literal.(types.TypedLiteral[bool]).Value()
4342
if val {
4443
return logs.TruePredicate{}, nil
4544
}
@@ -265,12 +264,12 @@ func findColumn(ref types.ColumnRef, columns []*logs.Column) (*logs.Column, erro
265264
}
266265

267266
// buildDataobjScalar builds a dataobj-compatible [scalar.Scalar] from a
268-
// [datatype.Literal].
269-
func buildDataobjScalar(lit datatype.Literal) (scalar.Scalar, error) {
267+
// [types.Literal].
268+
func buildDataobjScalar(lit types.Literal) (scalar.Scalar, error) {
270269
// [logs.ReaderOptions.Validate] specifies that all scalars must be one of
271270
// the given types:
272271
//
273-
// * [scalar.Null] (of any datatype)
272+
// * [scalar.Null] (of any types)
274273
// * [scalar.Int64]
275274
// * [scalar.Uint64]
276275
// * [scalar.Timestamp] (nanosecond precision)
@@ -279,18 +278,18 @@ func buildDataobjScalar(lit datatype.Literal) (scalar.Scalar, error) {
279278
// All of our mappings below evaluate to one of the above types.
280279

281280
switch lit := lit.(type) {
282-
case datatype.NullLiteral:
281+
case types.NullLiteral:
283282
return scalar.ScalarNull, nil
284-
case datatype.IntegerLiteral:
283+
case types.IntegerLiteral:
285284
return scalar.NewInt64Scalar(lit.Value()), nil
286-
case datatype.BytesLiteral:
287-
// [datatype.BytesLiteral] refers to byte sizes, not binary data.
285+
case types.BytesLiteral:
286+
// [types.BytesLiteral] refers to byte sizes, not binary data.
288287
return scalar.NewInt64Scalar(int64(lit.Value())), nil
289-
case datatype.TimestampLiteral:
288+
case types.TimestampLiteral:
290289
ts := arrow.Timestamp(lit.Value())
291290
tsType := arrow.FixedWidthTypes.Timestamp_ns
292291
return scalar.NewTimestampScalar(ts, tsType), nil
293-
case datatype.StringLiteral:
292+
case types.StringLiteral:
294293
buf := memory.NewBufferBytes([]byte(lit.Value()))
295294
return scalar.NewBinaryScalar(buf, arrow.BinaryTypes.Binary), nil
296295
}

pkg/engine/internal/executor/dataobjscan_predicate_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ import (
99
"github.com/stretchr/testify/require"
1010

1111
"github.com/grafana/loki/v3/pkg/dataobj/sections/logs"
12-
"github.com/grafana/loki/v3/pkg/engine/internal/datatype"
13-
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1412
"github.com/grafana/loki/v3/pkg/engine/internal/planner/physical"
13+
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1514
)
1615

1716
func Test_buildLogsPredicate(t *testing.T) {
@@ -156,7 +155,7 @@ func Test_buildLogsPredicate(t *testing.T) {
156155
expr: &physical.BinaryExpr{
157156
Op: types.BinaryOpEq,
158157
Left: columnRef(types.ColumnTypeBuiltin, types.ColumnNameBuiltinTimestamp),
159-
Right: physical.NewLiteral(datatype.Bytes(1024)),
158+
Right: physical.NewLiteral(types.Bytes(1024)),
160159
},
161160
expect: logs.EqualPredicate{
162161
Column: timestampColumn,
@@ -168,7 +167,7 @@ func Test_buildLogsPredicate(t *testing.T) {
168167
expr: &physical.BinaryExpr{
169168
Op: types.BinaryOpEq,
170169
Left: columnRef(types.ColumnTypeBuiltin, types.ColumnNameBuiltinTimestamp),
171-
Right: physical.NewLiteral(datatype.Timestamp(1609459200000000000)), // 2021-01-01 00:00:00 UTC in nanoseconds
170+
Right: physical.NewLiteral(types.Timestamp(1609459200000000000)), // 2021-01-01 00:00:00 UTC in nanoseconds
172171
},
173172
expect: logs.EqualPredicate{
174173
Column: timestampColumn,

pkg/engine/internal/executor/dataobjscan_test.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,16 @@ import (
1313
"github.com/grafana/loki/v3/pkg/dataobj/consumer/logsobj"
1414
"github.com/grafana/loki/v3/pkg/dataobj/sections/logs"
1515
"github.com/grafana/loki/v3/pkg/dataobj/sections/streams"
16-
"github.com/grafana/loki/v3/pkg/engine/internal/datatype"
17-
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1816
"github.com/grafana/loki/v3/pkg/engine/internal/planner/physical"
17+
"github.com/grafana/loki/v3/pkg/engine/internal/types"
1918
"github.com/grafana/loki/v3/pkg/logproto"
2019

2120
"github.com/grafana/loki/pkg/push"
2221
)
2322

2423
var (
25-
labelMD = datatype.ColumnMetadata(types.ColumnTypeLabel, datatype.Loki.String)
26-
metadataMD = datatype.ColumnMetadata(types.ColumnTypeMetadata, datatype.Loki.String)
24+
labelMD = types.ColumnMetadata(types.ColumnTypeLabel, types.Loki.String)
25+
metadataMD = types.ColumnMetadata(types.ColumnTypeMetadata, types.Loki.String)
2726
)
2827

2928
func Test_dataobjScan(t *testing.T) {
@@ -94,8 +93,8 @@ func Test_dataobjScan(t *testing.T) {
9493
{Name: "service", Type: arrow.BinaryTypes.String, Metadata: labelMD, Nullable: true},
9594
{Name: "guid", Type: arrow.BinaryTypes.String, Metadata: metadataMD, Nullable: true},
9695
{Name: "pod", Type: arrow.BinaryTypes.String, Metadata: metadataMD, Nullable: true},
97-
{Name: "timestamp", Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: datatype.ColumnMetadataBuiltinTimestamp, Nullable: true},
98-
{Name: "message", Type: arrow.BinaryTypes.String, Metadata: datatype.ColumnMetadataBuiltinMessage, Nullable: true},
96+
{Name: "timestamp", Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: types.ColumnMetadataBuiltinTimestamp, Nullable: true},
97+
{Name: "message", Type: arrow.BinaryTypes.String, Metadata: types.ColumnMetadataBuiltinMessage, Nullable: true},
9998
}
10099

101100
expectCSV := `prod,loki,eeee-ffff-aaaa-bbbb,NULL,1970-01-01 00:00:10,goodbye world
@@ -125,7 +124,7 @@ prod,notloki,NULL,notloki-pod-1,1970-01-01 00:00:02,hello world`
125124

126125
expectFields := []arrow.Field{
127126
{Name: "env", Type: arrow.BinaryTypes.String, Metadata: labelMD, Nullable: true},
128-
{Name: "timestamp", Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: datatype.ColumnMetadataBuiltinTimestamp, Nullable: true},
127+
{Name: "timestamp", Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: types.ColumnMetadataBuiltinTimestamp, Nullable: true},
129128
}
130129

131130
expectCSV := `prod,1970-01-01 00:00:10
@@ -155,8 +154,8 @@ prod,1970-01-01 00:00:02`
155154
{Name: "service", Type: arrow.BinaryTypes.String, Metadata: labelMD, Nullable: true},
156155
{Name: "guid", Type: arrow.BinaryTypes.String, Metadata: metadataMD, Nullable: true},
157156
{Name: "pod", Type: arrow.BinaryTypes.String, Metadata: metadataMD, Nullable: true},
158-
{Name: "timestamp", Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: datatype.ColumnMetadataBuiltinTimestamp, Nullable: true},
159-
{Name: "message", Type: arrow.BinaryTypes.String, Metadata: datatype.ColumnMetadataBuiltinMessage, Nullable: true},
157+
{Name: "timestamp", Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: types.ColumnMetadataBuiltinTimestamp, Nullable: true},
158+
{Name: "message", Type: arrow.BinaryTypes.String, Metadata: types.ColumnMetadataBuiltinMessage, Nullable: true},
160159
}
161160

162161
expectCSV := `prod,notloki,NULL,notloki-pod-1,1970-01-01 00:00:03,goodbye world
@@ -271,8 +270,8 @@ func Test_dataobjScan_DuplicateColumns(t *testing.T) {
271270
{Name: "namespace", Type: arrow.BinaryTypes.String, Metadata: metadataMD, Nullable: true},
272271
{Name: "pod", Type: arrow.BinaryTypes.String, Metadata: metadataMD, Nullable: true},
273272

274-
{Name: "timestamp", Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: datatype.ColumnMetadataBuiltinTimestamp, Nullable: true},
275-
{Name: "message", Type: arrow.BinaryTypes.String, Metadata: datatype.ColumnMetadataBuiltinMessage, Nullable: true},
273+
{Name: "timestamp", Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: types.ColumnMetadataBuiltinTimestamp, Nullable: true},
274+
{Name: "message", Type: arrow.BinaryTypes.String, Metadata: types.ColumnMetadataBuiltinMessage, Nullable: true},
276275
}
277276

278277
expectCSV := `prod,namespace-2,NULL,loki,NULL,NULL,1970-01-01 00:00:03,message 3

pkg/engine/internal/executor/executor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"github.com/grafana/loki/v3/pkg/dataobj"
1818
"github.com/grafana/loki/v3/pkg/dataobj/sections/logs"
1919
"github.com/grafana/loki/v3/pkg/dataobj/sections/streams"
20-
"github.com/grafana/loki/v3/pkg/engine/internal/types"
2120
"github.com/grafana/loki/v3/pkg/engine/internal/planner/physical"
21+
"github.com/grafana/loki/v3/pkg/engine/internal/types"
2222
)
2323

2424
var tracer = otel.Tracer("pkg/engine/internal/executor")

0 commit comments

Comments
 (0)