Skip to content

Commit 7761e3f

Browse files
Fix merge error
1 parent 98cbca7 commit 7761e3f

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -672,65 +672,66 @@ public void testReplaceStatsFilteredAggWithEvalFilterFalseAndNull() {
672672
var source = as(aggregate.child(), EsRelation.class);
673673
}
674674

675-
/**
676-
* <pre>{@code
675+
/*
677676
* Limit[1000[INTEGER]]
678677
* \_LocalRelation[[count(salary) where false{r}#3],[LongVectorBlock[vector=ConstantLongVector[positions=1, value=0]]]]
679-
* }</pre>
680678
*/
681-
public void testReplaceStatsFilteredAggWithEvalCount() {
679+
public void testReplaceStatsFilteredAggWithEvalNotTrue() {
682680
var plan = plan("""
683681
from test
684-
| stats count(salary) where false
682+
| stats count(salary) where not true
685683
""");
686684

687685
var limit = as(plan, Limit.class);
688686
var source = as(limit.child(), LocalRelation.class);
689-
assertThat(Expressions.names(source.output()), contains("count(salary) where false"));
687+
assertThat(Expressions.names(source.output()), contains("count(salary) where not true"));
690688
Block[] blocks = source.supplier().get();
691689
assertThat(blocks.length, is(1));
692690
var block = as(blocks[0], LongVectorBlock.class);
693691
assertThat(block.getPositionCount(), is(1));
694692
assertThat(block.asVector().getLong(0), is(0L));
695693
}
696694

695+
/*
696+
* Limit[1000[INTEGER],false]
697+
* \_Aggregate[[],[COUNT(salary{f}#10,true[BOOLEAN]) AS m1#4]]
698+
* \_EsRelation[test][_meta_field{f}#11, emp_no{f}#5, first_name{f}#6, ge..]
699+
*/
700+
public void testReplaceStatsFilteredAggWithEvalNotFalse() {
701+
var plan = plan("""
702+
from test
703+
| stats m1 = count(salary) where not false
704+
""");
705+
var limit = as(plan, Limit.class);
706+
var aggregate = as(limit.child(), Aggregate.class);
707+
assertThat(Expressions.names(aggregate.aggregates()), contains("m1"));
708+
var source = as(aggregate.child(), EsRelation.class);
709+
}
710+
697711
/**
712+
* <pre>{@code
698713
* Limit[1000[INTEGER]]
699714
* \_LocalRelation[[count(salary) where false{r}#3],[LongVectorBlock[vector=ConstantLongVector[positions=1, value=0]]]]
715+
* }</pre>
700716
*/
701-
public void testReplaceStatsFilteredAggWithEvalNotTrue() {
717+
public void testReplaceStatsFilteredAggWithEvalCount() {
702718
var plan = plan("""
703719
from test
704-
| stats count(salary) where not true
720+
| stats count(salary) where false
705721
""");
706722

707723
var limit = as(plan, Limit.class);
708724
var source = as(limit.child(), LocalRelation.class);
709-
assertThat(Expressions.names(source.output()), contains("count(salary) where not true"));
725+
assertThat(Expressions.names(source.output()), contains("count(salary) where false"));
710726
Block[] blocks = source.supplier().get();
711727
assertThat(blocks.length, is(1));
712728
var block = as(blocks[0], LongVectorBlock.class);
713729
assertThat(block.getPositionCount(), is(1));
714730
assertThat(block.asVector().getLong(0), is(0L));
715731
}
716732

717-
/*
718-
* Limit[1000[INTEGER],false]
719-
* \_Aggregate[[],[COUNT(salary{f}#10,true[BOOLEAN]) AS m1#4]]
720-
* \_EsRelation[test][_meta_field{f}#11, emp_no{f}#5, first_name{f}#6, ge..]
721-
*/
722-
public void testReplaceStatsFilteredAggWithEvalNotFalse() {
723-
var plan = plan("""
724-
from test
725-
| stats m1 = count(salary) where not false
726-
""");
727-
var limit = as(plan, Limit.class);
728-
var aggregate = as(limit.child(), Aggregate.class);
729-
assertThat(Expressions.names(aggregate.aggregates()), contains("m1"));
730-
var source = as(aggregate.child(), EsRelation.class);
731-
}
732-
733-
/*
733+
/**
734+
* <pre>{@code
734735
* Project[[count_distinct(salary + 2) + 3 where false{r}#3]]
735736
* \_Eval[[$$COUNTDISTINCT$count_distinct(>$0{r$}#15 + 3[INTEGER] AS count_distinct(salary + 2) + 3 where false]]
736737
* \_Limit[1000[INTEGER]]
@@ -6718,7 +6719,7 @@ public void testReplaceStringCasingWithInsensitiveEqualsLowerTrue() {
67186719
public void testReplaceStringCasingWithInsensitiveEqualsEquals() {
67196720
for (var fn : List.of("TO_LOWER", "TO_UPPER")) {
67206721
var value = fn.equals("TO_LOWER") ? fn.toLowerCase(Locale.ROOT) : fn.toUpperCase(Locale.ROOT);
6721-
value += "�✈��"; // these should not cause folding, they're not in the upper/lower char class
6722+
value += "🐔✈🔥🎉"; // these should not cause folding, they're not in the upper/lower char class
67226723
var plan = optimizedPlan("FROM test | WHERE " + fn + "(first_name) == \"" + value + "\"");
67236724
var limit = as(plan, Limit.class);
67246725
var filter = as(limit.child(), Filter.class);
@@ -6733,7 +6734,7 @@ public void testReplaceStringCasingWithInsensitiveEqualsEquals() {
67336734
public void testReplaceStringCasingWithInsensitiveEqualsNotEquals() {
67346735
for (var fn : List.of("TO_LOWER", "TO_UPPER")) {
67356736
var value = fn.equals("TO_LOWER") ? fn.toLowerCase(Locale.ROOT) : fn.toUpperCase(Locale.ROOT);
6736-
value += "�✈��"; // these should not cause folding, they're not in the upper/lower char class
6737+
value += "🐔✈🔥🎉"; // these should not cause folding, they're not in the upper/lower char class
67376738
var plan = optimizedPlan("FROM test | WHERE " + fn + "(first_name) != \"" + value + "\"");
67386739
var limit = as(plan, Limit.class);
67396740
var filter = as(limit.child(), Filter.class);

0 commit comments

Comments
 (0)