-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ESQL: make cidr_match foldable (#105403)
Fixes #105376 Creates two new ESQL specific base classes for functions, eliminating boilerplate code from many concrete function implementations.
- Loading branch information
Showing
43 changed files
with
148 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pr: 105403 | ||
summary: "ESQL: make `cidr_match` foldable" | ||
area: ES|QL | ||
type: bug | ||
issues: | ||
- 105376 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...va/org/elasticsearch/xpack/esql/expression/function/scalar/EsqlConfigurationFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.esql.expression.function.scalar; | ||
|
||
import org.elasticsearch.xpack.ql.expression.Expression; | ||
import org.elasticsearch.xpack.ql.session.Configuration; | ||
import org.elasticsearch.xpack.ql.tree.Source; | ||
|
||
import java.util.List; | ||
|
||
public abstract class EsqlConfigurationFunction extends EsqlScalarFunction { | ||
|
||
private final Configuration configuration; | ||
|
||
protected EsqlConfigurationFunction(Source source, List<Expression> fields, Configuration configuration) { | ||
super(source, fields); | ||
this.configuration = configuration; | ||
} | ||
|
||
public Configuration configuration() { | ||
return configuration; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...main/java/org/elasticsearch/xpack/esql/expression/function/scalar/EsqlScalarFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.esql.expression.function.scalar; | ||
|
||
import org.elasticsearch.xpack.esql.evaluator.mapper.EvaluatorMapper; | ||
import org.elasticsearch.xpack.ql.expression.Expression; | ||
import org.elasticsearch.xpack.ql.expression.function.scalar.ScalarFunction; | ||
import org.elasticsearch.xpack.ql.expression.gen.script.ScriptTemplate; | ||
import org.elasticsearch.xpack.ql.tree.Source; | ||
|
||
import java.util.List; | ||
|
||
public abstract class EsqlScalarFunction extends ScalarFunction implements EvaluatorMapper { | ||
|
||
protected EsqlScalarFunction(Source source) { | ||
super(source); | ||
} | ||
|
||
protected EsqlScalarFunction(Source source, List<Expression> fields) { | ||
super(source, fields); | ||
} | ||
|
||
@Override | ||
public Object fold() { | ||
return EvaluatorMapper.super.fold(); | ||
} | ||
|
||
@Override | ||
public final ScriptTemplate asScript() { | ||
throw new UnsupportedOperationException("functions do not support scripting"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.