Skip to content

Commit 14072dc

Browse files
committed
csv test for reusing column names
1 parent cddcfab commit 14072dc

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/ChangePointOperator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ public void addInput(Page page) {
6666

6767
@Override
6868
public void finish() {
69-
finished = true;
70-
createOutputPages();
69+
if (finished == false) {
70+
finished = true;
71+
createOutputPages();
72+
}
7173
}
7274

7375
@Override
@@ -135,7 +137,6 @@ private void createOutputPages() {
135137
changePvalueBlock = blockFactory.newConstantNullBlock(inputPage.getPositionCount());
136138
}
137139

138-
// TODO: what about duplicate names??
139140
Page outputPage = inputPage.appendBlocks(new Block[] { changeTypeBlock, changePvalueBlock });
140141
outputPages.add(outputPage);
141142
pageStartIndex += inputPage.getPositionCount();

x-pack/plugin/esql/qa/testFixtures/src/main/resources/change_point.csv-spec

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,39 @@ height:double | salary:double | type:text | pvalue:double
170170
2.09 | 38645.0 | null | null
171171
2.1 | 0.0 | dip | 9.590143836835097E-6
172172
;
173+
174+
175+
reuse column names
176+
// TODO: required_capability: change_point
177+
178+
FROM k8s
179+
| STATS count=COUNT() BY @timestamp=BUCKET(@timestamp, 1 MINUTE)
180+
| EVAL count=count+CASE(@timestamp=="2024-05-10T00:08:00.000Z", 100, 0)
181+
| CHANGE_POINT count ON @timestamp AS @timestamp, count
182+
;
183+
184+
@timestamp:text | count:double
185+
null | null
186+
null | null
187+
null | null
188+
null | null
189+
null | null
190+
null | null
191+
null | null
192+
null | null
193+
spike | 1.7502597878858522E-193
194+
null | null
195+
null | null
196+
null | null
197+
null | null
198+
null | null
199+
null | null
200+
null | null
201+
null | null
202+
null | null
203+
null | null
204+
null | null
205+
null | null
206+
null | null
207+
null | null
208+
;

0 commit comments

Comments
 (0)