ESQL: Fix function registry concurrency issues on constructor#123492
ESQL: Fix function registry concurrency issues on constructor#123492ivancea merged 5 commits intoelastic:mainfrom
Conversation
|
Hi @ivancea, I've created a changelog YAML for you. |
There was a problem hiding this comment.
Is there a reason for this class to not be "static", and the instance getter to not always return the corresponding registry (snapshot or non-snapshot)?
Could be a fairly simple improvement, avoiding recreating those maps again and again
| ); | ||
| } | ||
|
|
||
| protected void buildDataTypesForStringLiteralConversion(FunctionDefinition[]... groupFunctions) { |
There was a problem hiding this comment.
This was just moved, as it's now protected, with the "register()" functions
| public class Delay extends UnaryScalarFunction { | ||
| public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(Expression.class, "Delay", Delay::new); | ||
|
|
||
| @FunctionInfo(returnType = { "boolean" }, description = "Sleeps for a duration for every row. For debug purposes only.") |
There was a problem hiding this comment.
This is needed within the buildDataTypesForStringLiteralConversion() -> description() chain.
It won't be used for anything, as this function has no documentation, but I'd rather have it here than changing the registry code for this case
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
| private final Map<String, FunctionDefinition> defs = new LinkedHashMap<>(); | ||
| private final Map<String, String> aliases = new HashMap<>(); | ||
| private final Map<Class<? extends Function>, String> names = new HashMap<>(); | ||
| private final Map<Class<? extends Function>, List<DataType>> dataTypesForStringLiteralConversions = new LinkedHashMap<>(); |
fang-xing-esql
left a comment
There was a problem hiding this comment.
LGTM, thank you @ivancea ! Just to be extra cautious, perhaps add test-releases label, as a call to snapshotRegistry is added.
…c#123492) Fixes elastic#123430 There were 2 problems here: - We were filling a static field (used to auto-cast string literals) within a constructor, which is also called in multiple places - The field was only filled with non-snapshot functions, so snapshot function auto-casting wasn't possible Fixed both bugs by making the field non-static instead, and a fix to use the snapshot registry (if available) in the string casting rule.
…c#123492) Fixes elastic#123430 There were 2 problems here: - We were filling a static field (used to auto-cast string literals) within a constructor, which is also called in multiple places - The field was only filled with non-snapshot functions, so snapshot function auto-casting wasn't possible Fixed both bugs by making the field non-static instead, and a fix to use the snapshot registry (if available) in the string casting rule.
… (#123584) Fixes #123430 There were 2 problems here: - We were filling a static field (used to auto-cast string literals) within a constructor, which is also called in multiple places - The field was only filled with non-snapshot functions, so snapshot function auto-casting wasn't possible Fixed both bugs by making the field non-static instead, and a fix to use the snapshot registry (if available) in the string casting rule.
… (#123583) Fixes #123430 There were 2 problems here: - We were filling a static field (used to auto-cast string literals) within a constructor, which is also called in multiple places - The field was only filled with non-snapshot functions, so snapshot function auto-casting wasn't possible Fixed both bugs by making the field non-static instead, and a fix to use the snapshot registry (if available) in the string casting rule.
Fixes #123430
There were 2 problems here:
Fixed both bugs by making the field non-static instead, and a fix to use the snapshot registry (if available) in the string casting rule.