|
100 | 100 | import org.elasticsearch.xpack.esql.optimizer.rules.logical.OptimizerRules; |
101 | 101 | import org.elasticsearch.xpack.esql.optimizer.rules.logical.PruneRedundantOrderBy; |
102 | 102 | import org.elasticsearch.xpack.esql.optimizer.rules.logical.PushDownAndCombineLimits; |
| 103 | +import org.elasticsearch.xpack.esql.optimizer.rules.logical.PushDownCompletion; |
103 | 104 | import org.elasticsearch.xpack.esql.optimizer.rules.logical.PushDownEnrich; |
104 | 105 | import org.elasticsearch.xpack.esql.optimizer.rules.logical.PushDownEval; |
105 | 106 | import org.elasticsearch.xpack.esql.optimizer.rules.logical.PushDownRegexExtract; |
|
123 | 124 | import org.elasticsearch.xpack.esql.plan.logical.TimeSeriesAggregate; |
124 | 125 | import org.elasticsearch.xpack.esql.plan.logical.TopN; |
125 | 126 | import org.elasticsearch.xpack.esql.plan.logical.UnaryPlan; |
| 127 | +import org.elasticsearch.xpack.esql.plan.logical.inference.Completion; |
126 | 128 | import org.elasticsearch.xpack.esql.plan.logical.join.InlineJoin; |
127 | 129 | import org.elasticsearch.xpack.esql.plan.logical.join.Join; |
128 | 130 | import org.elasticsearch.xpack.esql.plan.logical.join.JoinConfig; |
|
162 | 164 | import static org.elasticsearch.xpack.esql.EsqlTestUtils.getFieldAttribute; |
163 | 165 | import static org.elasticsearch.xpack.esql.EsqlTestUtils.loadMapping; |
164 | 166 | import static org.elasticsearch.xpack.esql.EsqlTestUtils.localSource; |
| 167 | +import static org.elasticsearch.xpack.esql.EsqlTestUtils.randomLiteral; |
165 | 168 | import static org.elasticsearch.xpack.esql.EsqlTestUtils.referenceAttribute; |
166 | 169 | import static org.elasticsearch.xpack.esql.EsqlTestUtils.singleValue; |
167 | 170 | import static org.elasticsearch.xpack.esql.EsqlTestUtils.unboundLogicalOptimizerContext; |
|
176 | 179 | import static org.elasticsearch.xpack.esql.core.type.DataType.INTEGER; |
177 | 180 | import static org.elasticsearch.xpack.esql.core.type.DataType.KEYWORD; |
178 | 181 | import static org.elasticsearch.xpack.esql.core.type.DataType.LONG; |
| 182 | +import static org.elasticsearch.xpack.esql.core.type.DataType.TEXT; |
179 | 183 | import static org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.EsqlBinaryComparison.BinaryComparisonOperation.EQ; |
180 | 184 | import static org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.EsqlBinaryComparison.BinaryComparisonOperation.GT; |
181 | 185 | import static org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.EsqlBinaryComparison.BinaryComparisonOperation.GTE; |
@@ -5556,7 +5560,18 @@ record PushdownShadowingGeneratingPlanTestCase( |
5556 | 5560 | ) |
5557 | 5561 | ), |
5558 | 5562 | new PushDownEnrich() |
5559 | | - ) }; |
| 5563 | + ), |
| 5564 | + // | COMPLETION CONCAT(some text, x) WITH inferenceID AS y |
| 5565 | + new PushdownShadowingGeneratingPlanTestCase( |
| 5566 | + (plan, attr) -> new Completion( |
| 5567 | + EMPTY, |
| 5568 | + plan, |
| 5569 | + randomLiteral(TEXT), |
| 5570 | + new Concat(EMPTY, randomLiteral(TEXT), List.of(attr)), |
| 5571 | + new ReferenceAttribute(EMPTY, "y", KEYWORD) |
| 5572 | + ), |
| 5573 | + new PushDownCompletion() |
| 5574 | + )}; |
5560 | 5575 |
|
5561 | 5576 | /** |
5562 | 5577 | * Consider |
|
0 commit comments