88package org .elasticsearch .xpack .esql .optimizer .rules .logical .local ;
99
1010import org .elasticsearch .common .logging .LoggerMessageFormat ;
11+ import org .elasticsearch .test .junit .annotations .TestLogging ;
1112import org .elasticsearch .xpack .esql .EsqlTestUtils ;
1213import org .elasticsearch .xpack .esql .core .expression .Alias ;
1314import org .elasticsearch .xpack .esql .core .expression .Expression ;
3334import static org .elasticsearch .xpack .esql .EsqlTestUtils .as ;
3435import static org .elasticsearch .xpack .esql .core .type .DataType .DATETIME ;
3536
36- // @TestLogging(value = "org.elasticsearch.xpack.esql:TRACE", reason = "debug")
37+ @ TestLogging (value = "org.elasticsearch.xpack.esql:TRACE" , reason = "debug" )
3738public class LocalSubstituteSurrogateExpressionTests extends LocalLogicalPlanOptimizerTests {
3839
3940 // Key is the predicate,
@@ -58,10 +59,11 @@ public class LocalSubstituteSurrogateExpressionTests extends LocalLogicalPlanOpt
5859
5960 private static final Map <String , Integer > evalRenamePredicatesWithDateTruncBucket = new HashMap <>(
6061 Map .ofEntries (
61- // ReplaceAliasingEvalWithProject replaces x with hire_date so that the date_trunc can be transformed to round_to
62+ // ReplaceAliasingEvalWithProject replaces x with hire_date so that the DateTrunc can be transformed to RoundTo
6263 Map .entry (" | eval x = hire_date " , 4 ),
6364 // DateTrunc cannot be transformed to RoundTo if it references an expression
6465 Map .entry (" | eval x = hire_date + 1 year " , -1 ),
66+ // PushDownEval replaces the reference(x) in DateTrunc with the corresponding field hire_date
6567 Map .entry (" | rename hire_date as x " , 4 ),
6668 Map .entry (" | rename hire_date as a, a as x " , 4 ),
6769 Map .entry (" | rename hire_date as x, x as hire_date " , 4 ),
0 commit comments