You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2026/01/28 01:48:49 UTC
(iotdb) branch jexlDel created (now f72edaf2f00)
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a change to branch jexlDel
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at f72edaf2f00 Remove built-in jexl function in tree mode
This branch includes the following new commits:
new f72edaf2f00 Remove built-in jexl function in tree mode
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(iotdb) 01/01: Remove built-in jexl function in tree mode
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch jexlDel
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit f72edaf2f006136d028e0716913e79101a723f70
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Wed Jan 28 09:48:33 2026 +0800
Remove built-in jexl function in tree mode
---
dependencies.json | 1 -
.../BuiltinTimeSeriesGeneratingFunctionEnum.java | 1 -
.../db/it/udf/IoTDBUDTFBuiltinFunctionIT.java | 235 -------------
.../udf/BuiltinTimeSeriesGeneratingFunction.java | 2 -
iotdb-core/node-commons/pom.xml | 4 -
.../apache/iotdb/commons/udf/builtin/UDTFJexl.java | 368 ---------------------
pom.xml | 6 -
7 files changed, 617 deletions(-)
diff --git a/dependencies.json b/dependencies.json
index dd439e372d4..1e88db84e77 100644
--- a/dependencies.json
+++ b/dependencies.json
@@ -99,7 +99,6 @@
"net.minidev:json-smart",
"org.antlr:antlr4-runtime",
"org.apache.commons:commons-csv",
- "org.apache.commons:commons-jexl3",
"org.apache.commons:commons-lang3",
"org.apache.commons:commons-lang3",
"org.apache.commons:commons-math3",
diff --git a/integration-test/src/main/java/org/apache/iotdb/itbase/constant/BuiltinTimeSeriesGeneratingFunctionEnum.java b/integration-test/src/main/java/org/apache/iotdb/itbase/constant/BuiltinTimeSeriesGeneratingFunctionEnum.java
index 5167c52f4d5..8cd11a13f8e 100644
--- a/integration-test/src/main/java/org/apache/iotdb/itbase/constant/BuiltinTimeSeriesGeneratingFunctionEnum.java
+++ b/integration-test/src/main/java/org/apache/iotdb/itbase/constant/BuiltinTimeSeriesGeneratingFunctionEnum.java
@@ -72,7 +72,6 @@ public enum BuiltinTimeSeriesGeneratingFunctionEnum {
EQUAL_SIZE_BUCKET_AGG_SAMPLE("EQUAL_SIZE_BUCKET_AGG_SAMPLE"),
EQUAL_SIZE_BUCKET_M4_SAMPLE("EQUAL_SIZE_BUCKET_M4_SAMPLE"),
EQUAL_SIZE_BUCKET_OUTLIER_SAMPLE("EQUAL_SIZE_BUCKET_OUTLIER_SAMPLE"),
- JEXL("JEXL"),
MASTER_REPAIR("MASTER_REPAIR"),
FORECAST("FORECAST"),
M4("M4");
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java
index 61de72829cc..4bec71586cc 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java
@@ -1490,241 +1490,6 @@ public class IoTDBUDTFBuiltinFunctionIT {
}
}
- @Test
- public void testUDTFJexl() {
- try (Connection connection = EnvFactory.getEnv().getConnection();
- Statement statement = connection.createStatement()) {
- statement.execute("CREATE TIMESERIES root.sg.d7.s1 with datatype=INT32,encoding=PLAIN");
- statement.execute("CREATE TIMESERIES root.sg.d7.s2 with datatype=FLOAT,encoding=PLAIN");
- statement.execute("CREATE TIMESERIES root.sg.d7.s3 with datatype=DOUBLE,encoding=PLAIN");
- statement.execute("CREATE TIMESERIES root.sg.d7.s4 with datatype=TEXT,encoding=PLAIN");
- statement.execute("CREATE TIMESERIES root.sg.d7.s5 with datatype=BOOLEAN,encoding=PLAIN");
- statement.execute("CREATE TIMESERIES root.sg.d7.s6 with datatype=INT64,encoding=PLAIN");
- statement.execute("CREATE TIMESERIES root.sg.d7.s7 with datatype=INT64,encoding=PLAIN");
- statement.execute("CREATE TIMESERIES root.sg.d7.s8 with datatype=FLOAT,encoding=PLAIN");
- statement.execute("CREATE TIMESERIES root.sg.d7.s9 with datatype=TEXT,encoding=PLAIN");
- } catch (SQLException throwable) {
- fail(throwable.getMessage());
- }
- String[] SQL_FOR_SAMPLE_1 = new String[6];
- String[] SQL_FOR_SAMPLE_2 = new String[6];
- String[] SQL_FOR_SAMPLE_3 = new String[6];
- String[] SQL_FOR_SAMPLE_4 = new String[6];
- String[] SQL_FOR_SAMPLE_5 = new String[6];
- String[] SQL_FOR_SAMPLE_6 = new String[6];
- String[] SQL_FOR_SAMPLE_7 = new String[6];
- String[] SQL_FOR_SAMPLE_8 = new String[6];
- String[] SQL_FOR_SAMPLE_9 = new String[6];
- for (int i = 0; i < 5; i++) {
- SQL_FOR_SAMPLE_1[i] =
- String.format(
- Locale.ENGLISH, "insert into root.sg.d7(time, s1) values (%d, %d)", i, i + 1);
- SQL_FOR_SAMPLE_2[i] =
- String.format(
- Locale.ENGLISH, "insert into root.sg.d7(time, s2) values (%d, %f)", i, i + 1.0);
- SQL_FOR_SAMPLE_3[i] =
- String.format(
- Locale.ENGLISH, "insert into root.sg.d7(time, s3) values (%d, %f)", i, i + 1.0);
- SQL_FOR_SAMPLE_4[i] =
- String.format(
- Locale.ENGLISH, "insert into root.sg.d7(time, s4) values (%d, '%s')", i, "string");
- SQL_FOR_SAMPLE_5[i] = String.format("insert into root.sg.d7(time, s5) values (%d, true)", i);
- SQL_FOR_SAMPLE_6[i] =
- String.format(
- Locale.ENGLISH, "insert into root.sg.d7(time, s6) values (%d, %d)", i, i + 8);
- SQL_FOR_SAMPLE_7[i] =
- String.format(
- Locale.ENGLISH, "insert into root.sg.d7(time, s7) values (%d, %d)", i, i + 1);
- SQL_FOR_SAMPLE_8[i] =
- String.format(
- Locale.ENGLISH, "insert into root.sg.d7(time, s8) values (%d, %f)", i, i + 1.0);
- SQL_FOR_SAMPLE_9[i] =
- String.format(
- Locale.ENGLISH, "insert into root.sg.d7(time, s9) values (%d, '%s')", i, "string");
- }
- SQL_FOR_SAMPLE_1[5] =
- String.format(
- Locale.ENGLISH,
- "insert into root.sg.d7(time, s1) values (%d, %d)",
- 10000000000L,
- 5 + 1);
- SQL_FOR_SAMPLE_2[5] =
- String.format(
- Locale.ENGLISH,
- "insert into root.sg.d7(time, s2) values (%d, %f)",
- 10000000000L,
- 5 + 1.0);
- SQL_FOR_SAMPLE_3[5] =
- String.format(
- Locale.ENGLISH,
- "insert into root.sg.d7(time, s3) values (%d, %f)",
- 10000000000L,
- 5 + 1.0);
- SQL_FOR_SAMPLE_4[5] =
- String.format(
- Locale.ENGLISH,
- "insert into root.sg.d7(time, s4) values (%d, '%s')",
- 10000000000L,
- "string");
- SQL_FOR_SAMPLE_5[5] = String.format("insert into root.sg.d7(time, s5) values (%d, true)", 5);
- SQL_FOR_SAMPLE_6[5] =
- String.format(
- Locale.ENGLISH,
- "insert into root.sg.d7(time, s6) values (%d, %d)",
- 10000000000L,
- 5 + 8);
- SQL_FOR_SAMPLE_7[5] =
- String.format(
- Locale.ENGLISH,
- "insert into root.sg.d7(time, s7) values (%d, %d)",
- 10000000000L,
- 5 + 1);
- SQL_FOR_SAMPLE_8[5] =
- String.format(
- Locale.ENGLISH,
- "insert into root.sg.d7(time, s8) values (%d, %f)",
- 10000000000L,
- 5 + 1.0);
- SQL_FOR_SAMPLE_9[5] =
- String.format(
- Locale.ENGLISH,
- "insert into root.sg.d7(time, s9) values (%d, '%s')",
- 10000000000L,
- "string");
- double[] ANSWER1 = new double[] {2, 4, 6, 8, 10, 12};
- double[] ANSWER2 = new double[] {2, 4, 6, 8, 10, 12};
- double[] ANSWER3 = new double[] {4, 7, 10, 13, 16, 19};
- String[] ANSWER4 =
- new String[] {"string2", "string2", "string2", "string2", "string2", "string2"};
- double[] ANSWER7 = new double[] {1, 4, 9, 16, 25, 36};
- String[] ANSWER8 =
- new String[] {"string1", "string4", "string9", "string16", "string25", "string36"};
- double[] ANSWER9 = new double[] {2, 9, 28, 65, 126, 469};
- try (Connection connection = EnvFactory.getEnv().getConnection();
- Statement statement = connection.createStatement()) {
- for (int i = 0; i < 5; i++) {
- statement.execute(SQL_FOR_SAMPLE_1[i]);
- statement.execute(SQL_FOR_SAMPLE_2[i]);
- statement.execute(SQL_FOR_SAMPLE_3[i]);
- statement.execute(SQL_FOR_SAMPLE_4[i]);
- statement.execute(SQL_FOR_SAMPLE_5[i]);
- statement.execute(SQL_FOR_SAMPLE_6[i]);
- statement.execute(SQL_FOR_SAMPLE_7[i]);
- statement.execute(SQL_FOR_SAMPLE_8[i]);
- statement.execute(SQL_FOR_SAMPLE_9[i]);
- }
- } catch (SQLException throwable) {
- fail(throwable.getMessage());
- }
-
- try (Connection connection = EnvFactory.getEnv().getConnection();
- Statement statement = connection.createStatement()) {
- String functionName = "JEXL";
- String expr1 = "x -> {2 * x}";
- String expr2 = "x -> {x + x}";
- String expr3 = "x -> {x * 3 + 1}";
- String expr4 = "x -> {x + 2}";
- String expr5 = "x -> {x == true}";
- String expr6 = "x -> {x == x}";
- String expr7 = "(x, y) -> {x * y}";
- String expr8 = "(x, y, z) -> {x + y * z}";
- String expr9 = "(x, y, z, a) -> {x * y * z + (a ? 1 : -1)}";
- ResultSet resultSet =
- statement.executeQuery(
- String.format(
- "select %s(s1, 'expr'='%s'), "
- + "%s(s2, 'expr'='%s'), "
- + "%s(s3, 'expr'='%s'), "
- + "%s(s4, 'expr'='%s'), "
- + "%s(s5, 'expr'='%s'), "
- + "%s(s6, 'expr'='%s'), "
- + "%s(s7, s8, 'expr'='%s'), "
- + "%s(s4, s7, s1, 'expr'='%s'), "
- + "%s(s1, s7, s8, s5, 'expr'='%s') "
- + "from root.sg.d7",
- functionName,
- expr1,
- functionName,
- expr2,
- functionName,
- expr3,
- functionName,
- expr4,
- functionName,
- expr5,
- functionName,
- expr6,
- functionName,
- expr7,
- functionName,
- expr8,
- functionName,
- expr9));
- int columnCount = resultSet.getMetaData().getColumnCount();
- assertEquals(1 + 9, columnCount);
- for (int i = 0; i < 5; i++) {
- resultSet.next();
- assertEquals(ANSWER1[i], resultSet.getDouble(2), 0.01);
- assertEquals(ANSWER2[i], resultSet.getDouble(3), 0.01);
- assertEquals(ANSWER3[i], resultSet.getDouble(4), 0.01);
- assertEquals(ANSWER4[i], resultSet.getString(5));
- assertTrue(resultSet.getBoolean(6));
- assertTrue(resultSet.getBoolean(7));
- assertEquals(ANSWER7[i], resultSet.getDouble(8), 0.01);
- assertEquals(ANSWER8[i], resultSet.getString(9));
- assertEquals(ANSWER9[i], resultSet.getDouble(10), 0.01);
- }
-
- resultSet =
- statement.executeQuery(
- String.format(
- "select %s(s1, 'expr'='%s'), "
- + "%s(s2, 'expr'='%s'), "
- + "%s(s3, 'expr'='%s'), "
- + "%s(s4, 'expr'='%s'), "
- + "%s(s5, 'expr'='%s'), "
- + "%s(s6, 'expr'='%s'), "
- + "%s(s7, s8, 'expr'='%s'), "
- + "%s(s4, s7, s1, 'expr'='%s'), "
- + "%s(s1, s7, s8, s5, 'expr'='%s') "
- + "from root.sg.d7 align by device",
- functionName,
- expr1,
- functionName,
- expr2,
- functionName,
- expr3,
- functionName,
- expr4,
- functionName,
- expr5,
- functionName,
- expr6,
- functionName,
- expr7,
- functionName,
- expr8,
- functionName,
- expr9));
- columnCount = resultSet.getMetaData().getColumnCount();
- assertEquals(2 + 9, columnCount);
- for (int i = 0; i < 5; i++) {
- resultSet.next();
- assertEquals(ANSWER1[i], resultSet.getDouble(2 + 1), 0.01);
- assertEquals(ANSWER2[i], resultSet.getDouble(3 + 1), 0.01);
- assertEquals(ANSWER3[i], resultSet.getDouble(4 + 1), 0.01);
- assertEquals(ANSWER4[i], resultSet.getString(5 + 1));
- assertTrue(resultSet.getBoolean(6 + 1));
- assertTrue(resultSet.getBoolean(7 + 1));
- assertEquals(ANSWER7[i], resultSet.getDouble(8 + 1), 0.01);
- assertEquals(ANSWER8[i], resultSet.getString(9 + 1));
- assertEquals(ANSWER9[i], resultSet.getDouble(10 + 1), 0.01);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
@Test
public void testStringFunctions() {
String[] createSQLs =
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/udf/BuiltinTimeSeriesGeneratingFunction.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/udf/BuiltinTimeSeriesGeneratingFunction.java
index 67009258bc2..533ab2d97ec 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/udf/BuiltinTimeSeriesGeneratingFunction.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/udf/BuiltinTimeSeriesGeneratingFunction.java
@@ -51,7 +51,6 @@ import org.apache.iotdb.commons.udf.builtin.UDTFEqualSizeBucketRandomSample;
import org.apache.iotdb.commons.udf.builtin.UDTFExp;
import org.apache.iotdb.commons.udf.builtin.UDTFFloor;
import org.apache.iotdb.commons.udf.builtin.UDTFInRange;
-import org.apache.iotdb.commons.udf.builtin.UDTFJexl;
import org.apache.iotdb.commons.udf.builtin.UDTFLog;
import org.apache.iotdb.commons.udf.builtin.UDTFLog10;
import org.apache.iotdb.commons.udf.builtin.UDTFM4;
@@ -136,7 +135,6 @@ public enum BuiltinTimeSeriesGeneratingFunction {
EQUAL_SIZE_BUCKET_M4_SAMPLE("EQUAL_SIZE_BUCKET_M4_SAMPLE", UDTFEqualSizeBucketM4Sample.class),
EQUAL_SIZE_BUCKET_OUTLIER_SAMPLE(
"EQUAL_SIZE_BUCKET_OUTLIER_SAMPLE", UDTFEqualSizeBucketOutlierSample.class),
- JEXL("JEXL", UDTFJexl.class),
MASTER_REPAIR("MASTER_REPAIR", UDTFMasterRepair.class),
M4("M4", UDTFM4.class),
FORECAST("FORECAST", UDTFForecast.class),
diff --git a/iotdb-core/node-commons/pom.xml b/iotdb-core/node-commons/pom.xml
index 6e54c6b0b4c..24f33d0de8b 100644
--- a/iotdb-core/node-commons/pom.xml
+++ b/iotdb-core/node-commons/pom.xml
@@ -157,10 +157,6 @@
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jexl3</artifactId>
- </dependency>
<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/UDTFJexl.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/UDTFJexl.java
deleted file mode 100644
index 0c5ccd73b49..00000000000
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/UDTFJexl.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.commons.udf.builtin;
-
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.udf.utils.UDFDataTypeTransformer;
-import org.apache.iotdb.udf.api.UDTF;
-import org.apache.iotdb.udf.api.access.Row;
-import org.apache.iotdb.udf.api.collector.PointCollector;
-import org.apache.iotdb.udf.api.customizer.config.UDTFConfigurations;
-import org.apache.iotdb.udf.api.customizer.parameter.UDFParameterValidator;
-import org.apache.iotdb.udf.api.customizer.parameter.UDFParameters;
-import org.apache.iotdb.udf.api.customizer.strategy.RowByRowAccessStrategy;
-import org.apache.iotdb.udf.api.exception.UDFException;
-import org.apache.iotdb.udf.api.exception.UDFInputSeriesDataTypeNotValidException;
-import org.apache.iotdb.udf.api.exception.UDFOutputSeriesDataTypeNotValidException;
-import org.apache.iotdb.udf.api.type.Type;
-
-import org.apache.commons.jexl3.JexlBuilder;
-import org.apache.commons.jexl3.JexlEngine;
-import org.apache.commons.jexl3.JexlScript;
-import org.apache.tsfile.enums.TSDataType;
-
-import java.io.IOException;
-import java.util.HashMap;
-
-public class UDTFJexl implements UDTF {
-
- private int inputSeriesNumber;
- private TSDataType[] inputDataType;
- private TSDataType outputDataType;
- private JexlScript script;
- private Evaluator evaluator;
-
- @Override
- public void validate(UDFParameterValidator validator) throws UDFException {
- inputSeriesNumber = validator.getParameters().getChildExpressionsSize();
- for (int i = 0; i < inputSeriesNumber; i++) {
- validator.validateInputSeriesDataType(
- i, Type.INT32, Type.INT64, Type.FLOAT, Type.DOUBLE, Type.TEXT, Type.BOOLEAN);
- }
- validator.validateRequiredAttribute("expr");
- }
-
- @Override
- public void beforeStart(UDFParameters parameters, UDTFConfigurations configurations)
- throws UDFInputSeriesDataTypeNotValidException,
- UDFOutputSeriesDataTypeNotValidException,
- MetadataException {
- String expr = parameters.getString("expr");
- JexlEngine jexl = new JexlBuilder().create();
- script = jexl.createScript(expr);
-
- inputDataType = new TSDataType[inputSeriesNumber];
- for (int i = 0; i < inputSeriesNumber; i++) {
- inputDataType[i] = UDFDataTypeTransformer.transformToTsDataType(parameters.getDataType(i));
- }
- outputDataType = probeOutputDataType();
-
- if (inputSeriesNumber == 1) {
- switch (inputDataType[0]) {
- case INT32:
- evaluator = new EvaluatorIntInput();
- break;
- case INT64:
- evaluator = new EvaluatorLongInput();
- break;
- case FLOAT:
- evaluator = new EvaluatorFloatInput();
- break;
- case DOUBLE:
- evaluator = new EvaluatorDoubleInput();
- break;
- case TEXT:
- evaluator = new EvaluatorStringInput();
- break;
- case BOOLEAN:
- evaluator = new EvaluatorBooleanInput();
- break;
- case STRING:
- case TIMESTAMP:
- case DATE:
- case BLOB:
- case OBJECT:
- default:
- throw new UDFInputSeriesDataTypeNotValidException(
- 0,
- UDFDataTypeTransformer.transformToUDFDataType(inputDataType[0]),
- Type.INT32,
- Type.INT64,
- Type.FLOAT,
- Type.DOUBLE,
- Type.TEXT,
- Type.BOOLEAN);
- }
- } else {
- evaluator = new EvaluatorMulInput();
- }
-
- configurations
- .setAccessStrategy(new RowByRowAccessStrategy())
- .setOutputDataType(UDFDataTypeTransformer.transformToUDFDataType(outputDataType));
- }
-
- // 23, 23L, 23f, 23d, "string", true are hard codes for probing
- private HashMap<TSDataType, Object> initialMap() {
- HashMap<TSDataType, Object> map = new HashMap<>();
- map.put(TSDataType.INT32, 23);
- map.put(TSDataType.INT64, 23L);
- map.put(TSDataType.FLOAT, 23f);
- map.put(TSDataType.DOUBLE, 23d);
- map.put(TSDataType.TEXT, "string");
- map.put(TSDataType.BOOLEAN, true);
- return map;
- }
-
- private TSDataType probeOutputDataType() throws UDFOutputSeriesDataTypeNotValidException {
- // initial inputHardCodes to probe OutputDataType
- HashMap<TSDataType, Object> map = initialMap();
- Object[] inputHardCodes = new Object[inputSeriesNumber];
- for (int i = 0; i < inputSeriesNumber; i++) {
- inputHardCodes[i] = map.get(inputDataType[i]);
- }
-
- Object o = script.execute(null, inputHardCodes);
-
- if (o instanceof Number) {
- return TSDataType.DOUBLE;
- } else if (o instanceof String) {
- return TSDataType.TEXT;
- } else if (o instanceof Boolean) {
- return TSDataType.BOOLEAN;
- } else {
- throw new UDFOutputSeriesDataTypeNotValidException(0, "[Number, String, Boolean]");
- }
- }
-
- @Override
- public void transform(Row row, PointCollector collector)
- throws IOException,
- UDFOutputSeriesDataTypeNotValidException,
- UDFInputSeriesDataTypeNotValidException {
- switch (outputDataType) {
- case DOUBLE:
- evaluator.evaluateDouble(row, collector);
- break;
- case TEXT:
- evaluator.evaluateText(row, collector);
- break;
- case BOOLEAN:
- evaluator.evaluateBoolean(row, collector);
- break;
- case TIMESTAMP:
- case DATE:
- case STRING:
- case BLOB:
- case OBJECT:
- case INT64:
- case INT32:
- case FLOAT:
- default:
- // This will not happen.
- throw new UDFOutputSeriesDataTypeNotValidException(0, "[Number, String, Boolean]");
- }
- }
-
- private interface Evaluator {
- void evaluateDouble(Row row, PointCollector collector)
- throws IOException, UDFInputSeriesDataTypeNotValidException;
-
- void evaluateText(Row row, PointCollector collector)
- throws IOException, UDFInputSeriesDataTypeNotValidException;
-
- void evaluateBoolean(Row row, PointCollector collector)
- throws IOException, UDFInputSeriesDataTypeNotValidException;
- }
-
- private class EvaluatorIntInput implements Evaluator {
- @Override
- public void evaluateDouble(Row row, PointCollector collector) throws IOException {
- collector.putDouble(
- row.getTime(), ((Number) script.execute(null, row.getInt(0))).doubleValue());
- }
-
- @Override
- public void evaluateText(Row row, PointCollector collector) throws IOException {
- collector.putString(row.getTime(), (String) script.execute(null, row.getInt(0)));
- }
-
- @Override
- public void evaluateBoolean(Row row, PointCollector collector) throws IOException {
- collector.putBoolean(row.getTime(), (Boolean) script.execute(null, row.getInt(0)));
- }
- }
-
- private class EvaluatorLongInput implements Evaluator {
- @Override
- public void evaluateDouble(Row row, PointCollector collector) throws IOException {
- collector.putDouble(
- row.getTime(), ((Number) script.execute(null, row.getLong(0))).doubleValue());
- }
-
- @Override
- public void evaluateText(Row row, PointCollector collector) throws IOException {
- collector.putString(row.getTime(), (String) script.execute(null, row.getLong(0)));
- }
-
- @Override
- public void evaluateBoolean(Row row, PointCollector collector) throws IOException {
- collector.putBoolean(row.getTime(), (Boolean) script.execute(null, row.getLong(0)));
- }
- }
-
- private class EvaluatorFloatInput implements Evaluator {
- @Override
- public void evaluateDouble(Row row, PointCollector collector) throws IOException {
- collector.putDouble(
- row.getTime(), ((Number) script.execute(null, row.getFloat(0))).doubleValue());
- }
-
- @Override
- public void evaluateText(Row row, PointCollector collector) throws IOException {
- collector.putString(row.getTime(), (String) script.execute(null, row.getFloat(0)));
- }
-
- @Override
- public void evaluateBoolean(Row row, PointCollector collector) throws IOException {
- collector.putBoolean(row.getTime(), (Boolean) script.execute(null, row.getFloat(0)));
- }
- }
-
- private class EvaluatorDoubleInput implements Evaluator {
- @Override
- public void evaluateDouble(Row row, PointCollector collector) throws IOException {
- collector.putDouble(
- row.getTime(), ((Number) script.execute(null, row.getDouble(0))).doubleValue());
- }
-
- @Override
- public void evaluateText(Row row, PointCollector collector) throws IOException {
- collector.putString(row.getTime(), (String) script.execute(null, row.getDouble(0)));
- }
-
- @Override
- public void evaluateBoolean(Row row, PointCollector collector) throws IOException {
- collector.putBoolean(row.getTime(), (Boolean) script.execute(null, row.getDouble(0)));
- }
- }
-
- private class EvaluatorStringInput implements Evaluator {
- @Override
- public void evaluateDouble(Row row, PointCollector collector) throws IOException {
- collector.putDouble(
- row.getTime(), ((Number) script.execute(null, row.getString(0))).doubleValue());
- }
-
- @Override
- public void evaluateText(Row row, PointCollector collector) throws IOException {
- collector.putString(row.getTime(), (String) script.execute(null, row.getString(0)));
- }
-
- @Override
- public void evaluateBoolean(Row row, PointCollector collector) throws IOException {
- collector.putBoolean(row.getTime(), (Boolean) script.execute(null, row.getString(0)));
- }
- }
-
- private class EvaluatorBooleanInput implements Evaluator {
- @Override
- public void evaluateDouble(Row row, PointCollector collector) throws IOException {
- collector.putDouble(
- row.getTime(), ((Number) script.execute(null, row.getBoolean(0))).doubleValue());
- }
-
- @Override
- public void evaluateText(Row row, PointCollector collector) throws IOException {
- collector.putString(row.getTime(), (String) script.execute(null, row.getBoolean(0)));
- }
-
- @Override
- public void evaluateBoolean(Row row, PointCollector collector) throws IOException {
- collector.putBoolean(row.getTime(), (Boolean) script.execute(null, row.getBoolean(0)));
- }
- }
-
- private class EvaluatorMulInput implements Evaluator {
-
- Object[] values = new Object[inputSeriesNumber];
-
- @Override
- public void evaluateDouble(Row row, PointCollector collector)
- throws IOException, UDFInputSeriesDataTypeNotValidException {
- getValues(row);
- collector.putDouble(row.getTime(), ((Number) script.execute(null, values)).doubleValue());
- }
-
- @Override
- public void evaluateText(Row row, PointCollector collector)
- throws IOException, UDFInputSeriesDataTypeNotValidException {
- getValues(row);
- collector.putString(row.getTime(), (String) script.execute(null, values));
- }
-
- @Override
- public void evaluateBoolean(Row row, PointCollector collector)
- throws IOException, UDFInputSeriesDataTypeNotValidException {
- getValues(row);
- collector.putBoolean(row.getTime(), (Boolean) script.execute(null, values));
- }
-
- public void getValues(Row row) throws IOException, UDFInputSeriesDataTypeNotValidException {
- for (int i = 0; i < inputSeriesNumber; i++) {
- switch (inputDataType[i]) {
- case INT32:
- values[i] = row.getInt(i);
- break;
- case INT64:
- values[i] = row.getLong(i);
- break;
- case FLOAT:
- values[i] = row.getFloat(i);
- break;
- case DOUBLE:
- values[i] = row.getDouble(i);
- break;
- case TEXT:
- values[i] = row.getString(i);
- break;
- case BOOLEAN:
- values[i] = row.getBoolean(i);
- break;
- case STRING:
- case BLOB:
- case OBJECT:
- case DATE:
- case TIMESTAMP:
- default:
- throw new UDFInputSeriesDataTypeNotValidException(
- i,
- UDFDataTypeTransformer.transformToUDFDataType(inputDataType[i]),
- Type.INT32,
- Type.INT64,
- Type.FLOAT,
- Type.DOUBLE,
- Type.TEXT,
- Type.BOOLEAN);
- }
- }
- }
- }
-}
diff --git a/pom.xml b/pom.xml
index ab4b25e0103..c3b80202a01 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,7 +69,6 @@
<commons-cli.version>1.5.0</commons-cli.version>
<commons-codec.version>1.16.1</commons-codec.version>
<commons-csv.version>1.10.0</commons-csv.version>
- <commons-jexl3.version>3.3</commons-jexl3.version>
<commons-math3.version>3.6.1</commons-math3.version>
<commons-pool2.version>2.11.1</commons-pool2.version>
<commons-lang3.version>3.18.0</commons-lang3.version>
@@ -504,11 +503,6 @@
<artifactId>cglib</artifactId>
<version>${cglib.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jexl3</artifactId>
- <version>${commons-jexl3.version}</version>
- </dependency>
<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>