This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/dev/1.3 by this push:
new adb620a794d [To dev/1.3] Remove built-in jexl function in tree mode
(#17095)
adb620a794d is described below
commit adb620a794d0c6e9558023d4a66d50750f04d5c1
Author: Jackie Tien <[email protected]>
AuthorDate: Wed Jan 28 14:17:39 2026 +0800
[To dev/1.3] Remove built-in jexl function in tree mode (#17095)
---
.../BuiltinTimeSeriesGeneratingFunctionEnum.java | 1 -
.../db/it/udf/IoTDBUDTFBuiltinFunctionIT.java | 235 -------------
iotdb-core/node-commons/pom.xml | 4 -
.../BuiltinTimeSeriesGeneratingFunction.java | 1 -
.../apache/iotdb/commons/udf/builtin/UDTFJexl.java | 365 ---------------------
pom.xml | 6 -
6 files changed, 612 deletions(-)
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 fa0c5b5b148..e269f1af701 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"),
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 2ddc99f6ead..258bcbe48e1 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/node-commons/pom.xml b/iotdb-core/node-commons/pom.xml
index 5068f220905..f17bdb74946 100644
--- a/iotdb-core/node-commons/pom.xml
+++ b/iotdb-core/node-commons/pom.xml
@@ -159,10 +159,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/BuiltinTimeSeriesGeneratingFunction.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/BuiltinTimeSeriesGeneratingFunction.java
index ece0e3104a6..25bf548c6c4 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/BuiltinTimeSeriesGeneratingFunction.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/BuiltinTimeSeriesGeneratingFunction.java
@@ -88,7 +88,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);
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 d554cfe2572..00000000000
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/UDTFJexl.java
+++ /dev/null
@@ -1,365 +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:
- 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 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 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 1328311ae9a..3cc3e73a774 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,7 +70,6 @@
<commons-codec.version>1.16.1</commons-codec.version>
<commons-csv.version>1.10.0</commons-csv.version>
<commons-io.version>2.14.0</commons-io.version>
- <commons-jexl3.version>3.3</commons-jexl3.version>
<commons-lang3.version>3.18.0</commons-lang3.version>
<commons-math3.version>3.6.1</commons-math3.version>
<commons-pool2.version>2.11.1</commons-pool2.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>