Skip to content
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

[BugFix] Fix FunctionParams NPE #55885

Merged
merged 2 commits into from
Feb 19, 2025
Merged

[BugFix] Fix FunctionParams NPE #55885

merged 2 commits into from
Feb 19, 2025

Conversation

banmoy
Copy link
Contributor

@banmoy banmoy commented Feb 13, 2025

Why I'm doing:

In stream load columns header, using now() to set column value throws the following NPE

java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because "exprs" is null
        at com.starrocks.analysis.FunctionParams.<init>(FunctionParams.java:64) ~[starrocks-fe.jar:?]
        at com.starrocks.analysis.FunctionParams.<init>(FunctionParams.java:86) ~[starrocks-fe.jar:?]
        at com.starrocks.load.Load.transformHadoopFunctionExpr(Load.java:1059) ~[starrocks-fe.jar:?]
        at com.starrocks.load.Load.initColumns(Load.java:526) ~[starrocks-fe.jar:?]
        at com.starrocks.planner.StreamLoadScanNode.initColumns(StreamLoadScanNode.java:258) ~[starrocks-fe.jar:?]
        at com.starrocks.planner.StreamLoadScanNode.initParams(StreamLoadScanNode.java:252) ~[starrocks-fe.jar:?]
        at com.starrocks.planner.StreamLoadScanNode.init(StreamLoadScanNode.java:207) ~[starrocks-fe.jar:?]
        at com.starrocks.planner.StreamLoadPlanner.plan(StreamLoadPlanner.java:194) ~[starrocks-fe.jar:?]
        at com.starrocks.service.FrontendServiceImpl.streamLoadPutImpl(FrontendServiceImpl.java:1739) ~[starrocks-fe.jar:?]
        at com.starrocks.service.FrontendServiceImpl.streamLoadPut(FrontendServiceImpl.java:1676) ~[starrocks-fe.jar:?]
        at com.starrocks.thrift.FrontendService$Processor$streamLoadPut.getResult(FrontendService.java:5785) ~[starrocks-fe.jar:?]
        at com.starrocks.thrift.FrontendService$Processor$streamLoadPut.getResult(FrontendService.java:5762) ~[starrocks-fe.jar:?]
        at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:40) ~[libthrift-0.20.0.jar:0.20.0]
        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:40) ~[libthrift-0.20.0.jar:0.20.0]
        at com.starrocks.common.SRTThreadPoolServer$WorkerProcess.run(SRTThreadPoolServer.java:311) ~[starrocks-fe.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]

Reproduce

CREATE TABLE `test_npe` (
   `channel_type` int(11) NOT NULL,
   `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
 ) ENGINE=OLAP
 PROPERTIES (
    "replication_num" = "1"
 );
curl --location-trusted -u root: \
    -H "Expect:100-continue"  \
    -H "columns:channel_type,create_time=now()" \
    -d "1" \
    -XPUT http://127.0.0.1:8030/api/test/test_npe/_stream_load

What I'm doing:

Introduced by #36596 since 3.3. Should check the null arguments in FunctionParams constructor

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.4
    • 3.3
    • 3.2
    • 3.1
    • 3.0

@banmoy banmoy requested review from a team as code owners February 13, 2025 13:12
@CLAassistant
Copy link

CLAassistant commented Feb 13, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 13, 2025
@mergify mergify bot assigned banmoy Feb 13, 2025
@banmoy banmoy requested a review from a team as a code owner February 13, 2025 13:15
@github-actions github-actions bot added 3.4 3.3 and removed documentation Improvements or additions to documentation labels Feb 13, 2025
@kevincai kevincai removed request for a team February 13, 2025 13:35
Signed-off-by: PengFei Li <[email protected]>
Signed-off-by: PengFei Li <[email protected]>
Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

pass : 1 / 1 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/analysis/FunctionParams.java 1 1 100.00% []

kevincai pushed a commit that referenced this pull request Feb 19, 2025
@kevincai kevincai merged commit 76b6132 into StarRocks:main Feb 19, 2025
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants