Skip to content

Commit e2f6ebf

Browse files
committed
chore: cleanup from rebase/merge
1 parent d40706d commit e2f6ebf

File tree

6 files changed

+4
-216
lines changed

6 files changed

+4
-216
lines changed

pkg/engine/internal/executor/executor_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ func TestExecutor_Projection(t *testing.T) {
7272

7373
t.Run("missing column expression results in error", func(t *testing.T) {
7474
ctx := t.Context()
75+
cols := []physical.Expression{}
7576
c := &Context{}
76-
pipeline := c.executeProjection(ctx, &physical.Projection{Expressions: []physical.Expression{}}, []Pipeline{emptyPipeline()})
77+
pipeline := c.executeProjection(ctx, &physical.Projection{Expressions: cols}, []Pipeline{emptyPipeline()})
7778
_, err := pipeline.Read(ctx)
7879
require.ErrorContains(t, err, "projection expects at least one column, got 0")
7980
})

pkg/engine/internal/executor/sortmerge_test.go

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

pkg/engine/internal/planner/logical/builder.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (b *Builder) Unwrap(identifier string, operation string) *Builder {
6363

6464
return &Builder{
6565
val: &Projection{
66-
Table: b.val,
66+
Relation: b.val,
6767
Expressions: []Value{
6868
&UnaryOp{
6969
Op: op,
@@ -75,6 +75,7 @@ func (b *Builder) Unwrap(identifier string, operation string) *Builder {
7575
},
7676
},
7777
},
78+
All: true,
7879
Expand: true,
7980
},
8081
}

pkg/engine/internal/planner/logical/builder_convert.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ func (b *ssaBuilder) process(value Value) (Value, error) {
5959
return b.processLiteral(value)
6060
case *LogQLCompat:
6161
return b.processCompat(value)
62-
case *Projection:
63-
return b.processProjection(value)
6462

6563
default:
6664
return nil, fmt.Errorf("unsupported value type %T", value)
@@ -221,19 +219,6 @@ func (b *ssaBuilder) processBinOp(expr *BinOp) (Value, error) {
221219
return expr, nil
222220
}
223221

224-
func (b *ssaBuilder) processProjection(value *Projection) (Value, error) {
225-
if _, err := b.process(value.Table); err != nil {
226-
return nil, err
227-
}
228-
229-
// Only append the first time we see this.
230-
if value.id == "" {
231-
value.id = fmt.Sprintf("%%%d", b.getID())
232-
b.instructions = append(b.instructions, value)
233-
}
234-
return value, nil
235-
}
236-
237222
func (b *ssaBuilder) processColumnRef(value *ColumnRef) (Value, error) {
238223
// Nothing to do.
239224
return value, nil

pkg/engine/internal/planner/physical/planner.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -458,33 +458,6 @@ func (p *Planner) Optimize(plan *Plan) (*Plan, error) {
458458
return plan, nil
459459
}
460460

461-
func (p *Planner) processProjection(inst *logical.Projection, ctx *Context) ([]Node, error) {
462-
exprs := make([]Expression, len(inst.Expressions))
463-
for i, expr := range inst.Expressions {
464-
exprs[i] = p.convertPredicate(expr)
465-
}
466-
467-
node := &Projection{
468-
Expressions: exprs,
469-
Expand: false,
470-
}
471-
472-
p.plan.graph.Add(node)
473-
474-
children, err := p.process(inst.Table, ctx)
475-
if err != nil {
476-
return nil, err
477-
}
478-
479-
for i := range children {
480-
if err := p.plan.graph.AddEdge(dag.Edge[Node]{Parent: node, Child: children[i]}); err != nil {
481-
return nil, err
482-
}
483-
}
484-
485-
return []Node{node}, nil
486-
}
487-
488461
func convertParserKind(kind logical.ParserKind) ParserKind {
489462
switch kind {
490463
case logical.ParserLogfmt:

pkg/engine/internal/planner/planner_test.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,11 @@ func TestFullQueryPlanning(t *testing.T) {
155155
Limit offset=0 limit=1000
156156
└── TopK sort_by=builtin.timestamp ascending=false nulls_first=false k=1000
157157
└── Parallelize
158-
<<<<<<< HEAD
159158
└── TopK sort_by=builtin.timestamp ascending=false nulls_first=false k=1000
160159
└── Compat src=metadata dst=metadata collision=label
161160
└── ScanSet num_targets=2 predicate[0]=GTE(builtin.timestamp, 2025-01-01T00:00:00Z) predicate[1]=LT(builtin.timestamp, 2025-01-01T01:00:00Z)
162161
├── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=1 projections=()
163162
└── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=0 projections=()
164-
=======
165-
└── Compat src=metadata dst=metadata collision=label
166-
└── ScanSet num_targets=2 predicate[0]=GTE(builtin.timestamp, 2025-01-01T00:00:00Z) predicate[1]=LT(builtin.timestamp, 2025-01-01T01:00:00Z)
167-
├── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=1 projections=()
168-
└── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=0 projections=()
169-
>>>>>>> twhitney/thor-unwrap
170163
`,
171164
},
172165
{
@@ -175,7 +168,6 @@ Limit offset=0 limit=1000
175168
expected: `
176169
Limit offset=0 limit=1000
177170
└── TopK sort_by=builtin.timestamp ascending=false nulls_first=false k=1000
178-
<<<<<<< HEAD
179171
└── Parallelize
180172
└── TopK sort_by=builtin.timestamp ascending=false nulls_first=false k=1000
181173
└── Filter predicate[0]=EQ(ambiguous.label_foo, "bar")
@@ -184,38 +176,20 @@ Limit offset=0 limit=1000
184176
├── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=1 projections=()
185177
└── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=0 projections=()
186178
`,
187-
=======
188-
└── Filter predicate[0]=EQ(ambiguous.label_foo, "bar")
189-
└── Parallelize
190-
└── Compat src=metadata dst=metadata collision=label
191-
└── ScanSet num_targets=2 predicate[0]=GTE(builtin.timestamp, 2025-01-01T00:00:00Z) predicate[1]=LT(builtin.timestamp, 2025-01-01T01:00:00Z) predicate[2]=MATCH_STR(builtin.message, "baz")
192-
├── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=1 projections=()
193-
└── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=0 projections=()
194-
`,
195-
>>>>>>> twhitney/thor-unwrap
196179
},
197180
{
198181
comment: "drop columns",
199182
query: `{app="foo"} | drop service_name,__error__`,
200183
expected: `
201184
Limit offset=0 limit=1000
202185
└── TopK sort_by=builtin.timestamp ascending=false nulls_first=false k=1000
203-
<<<<<<< HEAD
204186
└── Parallelize
205187
└── TopK sort_by=builtin.timestamp ascending=false nulls_first=false k=1000
206188
└── Projection all=true drop=(ambiguous.service_name, ambiguous.__error__)
207189
└── Compat src=metadata dst=metadata collision=label
208190
└── ScanSet num_targets=2 predicate[0]=GTE(builtin.timestamp, 2025-01-01T00:00:00Z) predicate[1]=LT(builtin.timestamp, 2025-01-01T01:00:00Z)
209191
├── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=1 projections=()
210192
└── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=0 projections=()
211-
=======
212-
└── Projection all=true drop=(ambiguous.service_name, ambiguous.__error__)
213-
└── Parallelize
214-
└── Compat src=metadata dst=metadata collision=label
215-
└── ScanSet num_targets=2 predicate[0]=GTE(builtin.timestamp, 2025-01-01T00:00:00Z) predicate[1]=LT(builtin.timestamp, 2025-01-01T01:00:00Z)
216-
├── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=1 projections=()
217-
└── @target type=ScanTypeDataObject location=objects/00/0000000000.dataobj streams=5 section_id=0 projections=()
218-
>>>>>>> twhitney/thor-unwrap
219193
`,
220194
},
221195
}

0 commit comments

Comments
 (0)