generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 181
Open
Labels
PPLPiped processing languagePiped processing languagebugSomething isn't workingSomething isn't working
Description
Query Information
PPL Command/Query:
source=people | eval array = array(1, -2, 3), result = transform(array, x -> x + 2) | fields result
Expected Result:
[3,0,5] of type INTEGER ARRAY
Actual Result:
[3,0,5] of type ANY ARRAY
Dataset Information
Dataset/Schema Type
- OpenTelemetry (OTEL)
- Simple Schema for Observability (SS4O)
- Open Cybersecurity Schema Framework (OCSF)
- Custom (details below)
Index Mapping
Mapping not relevant
Bug Description
Before #4892, the types are injected at runtime:
Line 183 in d19ba53
| transferLambdaOutputToTargetType(lambdaFunction.apply(candidate), returnType)); |
Lines 190 to 191 in d19ba53
| org.apache.calcite.linq4j.function.Function2 lambdaFunction = | |
| (org.apache.calcite.linq4j.function.Function2) args[1]; |
However, the standard SQL requires the return type to be inferrable before executing the query. Currently, the argument is of type ANY, making the result also typed ANY. Therefore, the result array is an ANY array. For this case, it is indeed inferrable -- the array is an INTEGER ARRAY, meaning that x should be of type INTEGER instead of ANY.
Impact:
doctest in collections.md
Environment Information
OpenSearch Version: 3.4 (with PR #4892 )
Screenshots
File "/Users/yuanchu/src/sql/doctest/../docs/user/ppl/functions/collection.md", line 167, in /Users/yuanchu/src/sql/doctest/../docs/user/ppl/functions/collection.md
Failed example:
ppl_cmd.process('source=people | eval array = array(1, -2, 3), result = transform(array, x -> x + 2) | fields result | head 1')
Expected:
fetched rows / total rows = 1/1
+---------+
| result |
|---------|
| [3,0,5] |
+---------+
Got:
fetched rows / total rows = 1/1
+---------------+
| result |
|---------------|
| [3.0,0.0,5.0] |
+---------------+
coderabbitai
Metadata
Metadata
Assignees
Labels
PPLPiped processing languagePiped processing languagebugSomething isn't workingSomething isn't working
Type
Projects
Status
Not Started