Fix the bug of explicit makeNullLiteral for UDT fields#4475
Fix the bug of explicit makeNullLiteral for UDT fields#4475yuancu merged 1 commit intoopensearch-project:mainfrom
Conversation
Signed-off-by: Songkan Tang <songkant@amazon.com>
|
Thanks for the fix! I think for #4383, it's more like an issue for long-term goals for |
| Content-Type: 'application/json' | ||
| ppl: | ||
| body: | ||
| query: source=log-test1 | append [ source=log-test2 ] |
There was a problem hiding this comment.
will source=log-test1 | append [ source=log-test2 ] | fields timestamp return - match: { datarows: [["2025-09-04 16:15:00"], [null]] }?
There was a problem hiding this comment.
Synced offline. It will append unique name in case of type conflicts and select fields are also successful
Is |
|
@ahkcs Makes sense. It's a short-term bug fix to not fail the query. 4383 wants to resolve another issue. I can create another report bug issue to avoid confusion |
|
@LantaoJin Tried the |
Signed-off-by: Songkan Tang <songkant@amazon.com> (cherry picked from commit 7d6357d) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…oject#4475) Signed-off-by: Songkan Tang <songkant@amazon.com>
(cherry picked from commit 7d6357d) Signed-off-by: Songkan Tang <songkant@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…oject#4475) Signed-off-by: Songkan Tang <songkant@amazon.com> Signed-off-by: Asif Bashar <asif.bashar@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Simeon Widdis <sawiddis@amazon.com> Co-authored-by: Manasvini B S <manasvis@amazon.com> Co-authored-by: opensearch-ci-bot <opensearch-infra@amazon.com> Co-authored-by: Louis Chu <clingzhi@amazon.com> Co-authored-by: Chen Dai <daichen@amazon.com> Co-authored-by: Mebsina <cnoramut@gmail.com> Co-authored-by: Yuanchun Shen <yuanchu@amazon.com> Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Co-authored-by: Kai Huang <105710027+ahkcs@users.noreply.github.com> Co-authored-by: Peng Huo <penghuo@gmail.com> Co-authored-by: Alexey Temnikov <alexey.temnikov@improving.com> Co-authored-by: Riley Jerger <214163063+RileyJergerAmazon@users.noreply.github.com> Co-authored-by: Tomoyuki MORITA <moritato@amazon.com> Co-authored-by: Lantao Jin <ltjin@amazon.com> Co-authored-by: Songkan Tang <songkant@amazon.com> Co-authored-by: qianheng <qianheng@amazon.com> Co-authored-by: Simeon Widdis <sawiddis@gmail.com> Co-authored-by: Xinyuan Lu <xinyual@amazon.com> Co-authored-by: Jialiang Liang <jiallian@amazon.com> Co-authored-by: Peter Zhu <zhujiaxi@amazon.com> Co-authored-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com> Co-authored-by: expani <anijainc@amazon.com> Co-authored-by: expani1729 <110471048+expani@users.noreply.github.com> Co-authored-by: Vamsi Manohar <reddyvam@amazon.com> Co-authored-by: ritvibhatt <53196324+ritvibhatt@users.noreply.github.com> Co-authored-by: Xinyu Hao <75524174+ishaoxy@users.noreply.github.com> Co-authored-by: Marc Handalian <marc.handalian@gmail.com> Co-authored-by: Marc Handalian <handalm@amazon.com> Fix join type ambiguous issue when specify the join type with sql-like join criteria (opensearch-project#4474) Fix issue 4441 (opensearch-project#4449) Fix missing keywordsCanBeId (opensearch-project#4491) Fix the bug of explicit makeNullLiteral for UDT fields (opensearch-project#4475) Fix mapping after aggregation push down (opensearch-project#4500) Fix percentile bug (opensearch-project#4539) Fix JsonExtractAllFunctionIT failure (opensearch-project#4556) Fix sort push down into agg after project already pushed (opensearch-project#4546) Fix push down failure for min/max on derived field (opensearch-project#4572) Fix compile issue in main (opensearch-project#4608) Fix filter parsing failure on date fields with non-default format (opensearch-project#4616) Fix bin nested fields issue (opensearch-project#4606) Fix: Support Alias Fields in MIN, MAX, FIRST, LAST, and TAKE Aggregations (opensearch-project#4621) fix rename issue (opensearch-project#4670) Fixes for `Multisearch` and `Append` command (opensearch-project#4512) Fix asc/desc keyword behavior for sort command (opensearch-project#4651) Fix] Fix unexpected shift of extraction for `rex` with nested capture groups in named groups (opensearch-project#4641) Fix CVE-2025-48924 (opensearch-project#4665) Fix sub-fields accessing of generated structs (opensearch-project#4683) Fix] Incorrect Field Index Mapping in AVG to SUM/COUNT Conversion (opensearch-project#15)
Description
Fix the bug that Calcite will error out when CalciteRelBuilder explicitly calling
makeNullLiteralfor UDT type fields.UDT type cast is handled by UDF. It's totally fine for
CASTfunction, regardless whether the field value is NULL or non NULL. But for some cases in building RelNode, it has the problem of explicitly casting NULL to UDT type byRexBuilder.makeNullLiteralmethod. UDT cast is a RexCall of calling UDF, butmakeNullLiteralinternally expects the returned node to be RexLiteral of NULL. Thus, Calcite throws a hard error due to Java class casting failure.This PR fixes this issue by adding a simple check and calling super method in case the RexNode to be cast is literally NULL.
Related Issues
Resolves #4383
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.