From e7271f20f9764061fd17ca7e21896413cfec1650 Mon Sep 17 00:00:00 2001 From: emptyOVO Date: Mon, 30 Dec 2024 15:54:08 +0800 Subject: [PATCH] fix: add NP checks in parse() --- .../function/arithmetic/FibonacciFunction.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/arithmetic/FibonacciFunction.java b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/arithmetic/FibonacciFunction.java index e05ed1d066..3c2ba9d1ed 100644 --- a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/arithmetic/FibonacciFunction.java +++ b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/arithmetic/FibonacciFunction.java @@ -57,9 +57,15 @@ public FibonacciFunction(Function expr) { @Override public Object parse(SourceData sourceData, int rowIndex, Context context) { - Object numberObj = numberParser.parse(sourceData, rowIndex, context); - BigDecimal numberValue = OperatorTools.parseBigDecimal(numberObj); - return fibonacci(numberValue.intValue()); + if (numberParser != null) { + Object valueObj = numberParser.parse(sourceData, rowIndex, context); + if (valueObj == null) { + return null; + } + BigDecimal numberValue = OperatorTools.parseBigDecimal(valueObj); + return fibonacci(numberValue.intValue()); + } + return null; } private long fibonacci(int n) {