← Back to Pull requests

[BugFix] Accept single values in mvindex and date/time values in split (#5948) #5955

Closed
unknown closed this pull request without merging on Nov 30, 2026 01:24 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 05:36 UTC
Author

Description


mvindex rejected a plain (single-value) field with MVINDEX function expects {[ARRAY,INTEGER]|[ARRAY,INTEGER,INTEGER]}, but got [STRING,INTEGER], and split rejected date/time values with SPLIT function expects {[STRING,STRING]}, but got [TIMESTAMP,STRING]. SPL treats single-value and multi-value fields interchangeably, so these queries fail when migrated.

This follows the fix proposed in the issue:

  • mvindex now also accepts a non-array first argument and treats it as a one-element array (MVIndexFunctionImp, plus a second ANY signature in PPLFuncImpTable; array arguments keep the existing path).

  • - mvindex(value, 0) and mvindex(value, -1) return the value; any other index returns null. The value keeps its own type (string, number, timestamp, ...).
    - mvindex(value, start, end) wraps the value with array(value) and slices it as before, so a covering range returns a one-element array.
    - A null value returns null, not a one-element array holding null, so isnull(mvindex(field, 0)) keeps working.
  • split now also accepts DATE, TIME and TIMESTAMP input. The value is cast to its string form the same way cast(value as string) is, so split(ts, "-") returns the same result as split(cast(ts as string), "-"). Other non-string types (for example numbers) are still rejected.
  • The issue mentions the other mv functions may want the same treatment; I kept this PR to the two functions in the report and can follow up on the others if wanted.

    Docs for mvindex and split in docs/user/ppl/functions/collection.md are updated.

    Related Issues


    Resolves #5948

    Check List


  • New functionality includes testing.

  • - Unit tests in CalcitePPLArrayFunctionTest (string, number, null and computed-index single values, ranges, split on a date and the explicit-cast equivalent, and the existing type errors for non-integer indexes and numeric split input). 7 of them fail without the fix.
    - Integration tests in CalciteArrayFunctionIT (also run through CalciteNoPushdownIT).
    - YAML REST test issues/5948.yml using the reproduction from the issue.
  • New functionality has been documented.

  • - [x] New functionality has javadoc added.
    - [x] New functionality has a user manual doc added.
  • New PPL command checklist all confirmed.

  • API changes companion pull request created.

  • Commits are signed per the DCO using --signoff or -s.

  • Public documentation issue/PR created.
  • Tested locally with ./gradlew spotlessCheck :core:test :ppl:test :opensearch:test :sql:test, ./gradlew :integ-test:integTest -Dtests.class="CalciteArrayFunctionIT" and ./gradlew :integ-test:yamlRestTest -Dtests.method="test {yaml=issues/5948/*}".

    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.

    Diff: 418 lines (+313 / -105) across 5 files Reviewer: Swiddis Review duration: 18467m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.45) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 418 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.361
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5955"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.0% (MEDIUM) · Higher = larger blast radius
    45.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.4% · Safe to merge
    19.4%