|
13 | 13 | import org.elasticsearch.xpack.sql.expression.Expression; |
14 | 14 | import org.elasticsearch.xpack.sql.expression.Expressions; |
15 | 15 | import org.elasticsearch.xpack.sql.expression.FieldAttribute; |
| 16 | +import org.elasticsearch.xpack.sql.expression.NamedExpression; |
16 | 17 | import org.elasticsearch.xpack.sql.expression.UnresolvedAttribute; |
17 | 18 | import org.elasticsearch.xpack.sql.expression.function.Function; |
18 | 19 | import org.elasticsearch.xpack.sql.expression.function.FunctionAttribute; |
|
27 | 28 | import org.elasticsearch.xpack.sql.expression.function.grouping.GroupingFunctionAttribute; |
28 | 29 | import org.elasticsearch.xpack.sql.expression.function.scalar.ScalarFunction; |
29 | 30 | import org.elasticsearch.xpack.sql.expression.predicate.conditional.ConditionalFunction; |
| 31 | +import org.elasticsearch.xpack.sql.expression.predicate.fulltext.FullTextPredicate; |
30 | 32 | import org.elasticsearch.xpack.sql.expression.predicate.operator.comparison.In; |
31 | 33 | import org.elasticsearch.xpack.sql.plan.logical.Aggregate; |
32 | 34 | import org.elasticsearch.xpack.sql.plan.logical.Distinct; |
@@ -231,6 +233,8 @@ Collection<Failure> verify(LogicalPlan plan) { |
231 | 233 | validateInExpression(p, localFailures); |
232 | 234 | validateConditional(p, localFailures); |
233 | 235 |
|
| 236 | + checkFullTextSearchInSelect(plan, localFailures); |
| 237 | + |
234 | 238 | checkGroupingFunctionInGroupBy(p, localFailures); |
235 | 239 | checkFilterOnAggs(p, localFailures); |
236 | 240 | checkFilterOnGrouping(p, localFailures); |
@@ -282,6 +286,17 @@ Collection<Failure> verify(LogicalPlan plan) { |
282 | 286 | return failures; |
283 | 287 | } |
284 | 288 |
|
| 289 | + private void checkFullTextSearchInSelect(LogicalPlan plan, Set<Failure> localFailures) { |
| 290 | + plan.forEachUp(p -> { |
| 291 | + for (NamedExpression ne : p.projections()) { |
| 292 | + ne.forEachUp((e) -> |
| 293 | + localFailures.add(fail(e, "Cannot use MATCH() or QUERY() full-text search " + |
| 294 | + "functions in the SELECT clause")), |
| 295 | + FullTextPredicate.class); |
| 296 | + } |
| 297 | + }, Project.class); |
| 298 | + } |
| 299 | + |
285 | 300 | /** |
286 | 301 | * Check validity of Aggregate/GroupBy. |
287 | 302 | * This rule is needed for multiple reasons: |
|
0 commit comments