-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: Mark new signatures in MIN and MAX #132980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -99,6 +99,8 @@ | |||||||||||||||||
| * and partially re-written to satisfy the above requirements. | ||||||||||||||||||
| */ | ||||||||||||||||||
| public abstract class DocsV3Support { | ||||||||||||||||||
| public record Param(DataType dataType, List<FunctionAppliesTo> appliesTo) {} | ||||||||||||||||||
|
|
||||||||||||||||||
| private static final Logger logger = LogManager.getLogger(DocsV3Support.class); | ||||||||||||||||||
|
|
||||||||||||||||||
| private static final String DOCS_WARNING_JSON = | ||||||||||||||||||
|
|
@@ -372,15 +374,15 @@ public License.OperationMode invoke(List<DataType> fieldTypes) throws Exception | |||||||||||||||||
| protected final String category; | ||||||||||||||||||
| protected final String name; | ||||||||||||||||||
| protected final FunctionDefinition definition; | ||||||||||||||||||
| protected final Supplier<Map<List<DataType>, DataType>> signatures; | ||||||||||||||||||
| protected final Supplier<Map<List<Param>, DataType>> signatures; | ||||||||||||||||||
| protected final Callbacks callbacks; | ||||||||||||||||||
| private final LicenseRequirementChecker licenseChecker; | ||||||||||||||||||
|
|
||||||||||||||||||
| protected DocsV3Support( | ||||||||||||||||||
| String category, | ||||||||||||||||||
| String name, | ||||||||||||||||||
| Class<?> testClass, | ||||||||||||||||||
| Supplier<Map<List<DataType>, DataType>> signatures, | ||||||||||||||||||
| Supplier<Map<List<Param>, DataType>> signatures, | ||||||||||||||||||
| Callbacks callbacks | ||||||||||||||||||
| ) { | ||||||||||||||||||
| this(category, name, null, testClass, signatures, callbacks); | ||||||||||||||||||
|
|
@@ -391,7 +393,7 @@ private DocsV3Support( | |||||||||||||||||
| String name, | ||||||||||||||||||
| FunctionDefinition definition, | ||||||||||||||||||
| Class<?> testClass, | ||||||||||||||||||
| Supplier<Map<List<DataType>, DataType>> signatures, | ||||||||||||||||||
| Supplier<Map<List<Param>, DataType>> signatures, | ||||||||||||||||||
| Callbacks callbacks | ||||||||||||||||||
| ) { | ||||||||||||||||||
| this.category = category; | ||||||||||||||||||
|
|
@@ -571,7 +573,7 @@ private FunctionDocsSupport(String name, Class<?> testClass, Callbacks callbacks | |||||||||||||||||
| String name, | ||||||||||||||||||
| Class<?> testClass, | ||||||||||||||||||
| FunctionDefinition definition, | ||||||||||||||||||
| Supplier<Map<List<DataType>, DataType>> signatures, | ||||||||||||||||||
| Supplier<Map<List<Param>, DataType>> signatures, | ||||||||||||||||||
| Callbacks callbacks | ||||||||||||||||||
| ) { | ||||||||||||||||||
| super("functions", name, definition, testClass, signatures, callbacks); | ||||||||||||||||||
|
|
@@ -662,10 +664,21 @@ private void renderFunctionNamedParams(EsqlFunctionRegistry.MapArgSignature mapA | |||||||||||||||||
| writeToTempSnippetsDir("functionNamedParams", rendered.toString()); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| private String makeAppliesToText(FunctionAppliesTo[] functionAppliesTos, boolean preview) { | ||||||||||||||||||
| /** | ||||||||||||||||||
| * Build the {@code {applies_to}} annotation for the docs to tell users which version of | ||||||||||||||||||
| * Elasticsearch first supported this function/operator/signature. | ||||||||||||||||||
| * @param functionAppliesTos The version information for stateful Elasticsearch | ||||||||||||||||||
| * @param preview Is this tech preview? Effectively just generates the | ||||||||||||||||||
| * {@code serverless: preview} annotation if true and nothing if false. | ||||||||||||||||||
| * @param oneLine Should we generate a single line variant of the {@code {applies_to}} | ||||||||||||||||||
| * annotation compatible with tables (true) or the more readable | ||||||||||||||||||
| * multi-line variant (false)? | ||||||||||||||||||
| * @return Text of the {@code {applies_to}} annotation | ||||||||||||||||||
| */ | ||||||||||||||||||
| private static String makeAppliesToText(List<FunctionAppliesTo> functionAppliesTos, boolean preview, boolean oneLine) { | ||||||||||||||||||
| StringBuilder appliesToText = new StringBuilder(); | ||||||||||||||||||
| if (functionAppliesTos.length > 0) { | ||||||||||||||||||
| appliesToText.append("```{applies_to}\n"); | ||||||||||||||||||
| if (false == functionAppliesTos.isEmpty()) { | ||||||||||||||||||
| appliesToText.append(oneLine ? "{applies_to}`" : "```{applies_to}\n"); | ||||||||||||||||||
|
||||||||||||||||||
| appliesToText.append(oneLine ? "{applies_to}`" : "```{applies_to}\n"); | |
| if (oneLine) { | |
| appliesToText.append("{applies_to}"); | |
| appliesToText.append("`"); | |
| } else { | |
| appliesToText.append("```"); | |
| appliesToText.append("{applies_to}"); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it makes it easier for you to read, I'm happy to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these
s/DataType/DocsV3Support.Param/exist so I can plumbFunctionAppliesToinformation through the test case instead of an annotation. That's because we generate the type signatures entirely from test cases - no annotation to scan.