You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "JackieTien97 (via GitHub)" <gi...@apache.org> on 2025/08/29 06:37:41 UTC
Re: [PR] Add new udf UDAFMKIdentify [iotdb]
JackieTien97 commented on code in PR #15577:
URL: https://github.com/apache/iotdb/pull/15577#discussion_r2309289100
##########
example/udf/src/main/java/org/apache/iotdb/udf/UDAFMKIdentify.java:
##########
@@ -0,0 +1,171 @@
+package org.apache.iotdb.udf;
+
+import org.apache.iotdb.udf.api.State;
+import org.apache.iotdb.udf.api.customizer.analysis.AggregateFunctionAnalysis;
+import org.apache.iotdb.udf.api.customizer.parameter.FunctionArguments;
+import org.apache.iotdb.udf.api.exception.UDFArgumentNotValidException;
+import org.apache.iotdb.udf.api.relational.AggregateFunction;
+import org.apache.iotdb.udf.api.relational.access.Record;
+import org.apache.iotdb.udf.api.type.Type;
+import org.apache.iotdb.udf.api.utils.ResultValue;
+import org.apache.iotdb.udf.table.MatchingKeyState;
+
+import org.apache.tsfile.utils.Binary;
+
+import java.nio.charset.Charset;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * This is a UDAF function used to identify sets of matching keys that satisfy user-defined
+ * constraints.
+ */
+public class UDAFMKIdentify implements AggregateFunction {
+ /**
+ * CREATE DATABASE root; USE root; CREATE TABLE test ( Time TIMESTAMP TIME, PlateText TEXT FIELD,
+ * VehicleID TEXT FIELD, CameraID TEXT FIELD ) WITH (TTL=31536000000); INSERT INTO test(Time,
+ * "PlateText", "VehicleID", "CameraID") values ('2025-01-01T01:56:19.000+08:00', 'B0D3O444s',
+ * '100', '78'); INSERT INTO test(Time, "PlateText", "VehicleID", "CameraID") values
+ * ('2025-01-01T01:56:39.000+08:00', 'B0D3O444s', '100', '78'); INSERT INTO test(Time,
+ * "PlateText", "VehicleID", "CameraID") values ('2025-01-01T03:30:59.000+08:00', 'B0134s00', '2',
+ * '150');
+ *
+ * <p>CREATE FUNCTION mkidentify AS 'org.apache.iotdb.udf.UDAFMK'; SHOW FUNCTIONS;
+ *
+ * <p>SELECT mkidentify(Time, PlateText, VehicleID, CameraID, 2, 0.2, 1.0) FROM root.test;
+ */
Review Comment:
It's an IT case, shouldn't put it in source code, we need to move it to integration-test/src/test/java/org/apache/iotdb/relational/it/udaf/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org