jt2594838 commented on code in PR #18606:
URL: https://github.com/apache/iotdb/pull/18606#discussion_r3977849693


##########
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/TSDataTypeSwitchArchitectureTest.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.db.utils;
+
+import com.tngtech.archunit.core.importer.ClassFileImporter;
+import com.tngtech.archunit.core.importer.ImportOption;
+import org.junit.Test;
+
+public class TSDataTypeSwitchArchitectureTest {
+
+  @Test
+  public void productionCodeMustUseTypeService() {
+    // Scan IoTDB production classes on this module's classpath, including its 
dependencies.
+    // Do not freeze violations or swallow failures: existing violations must 
fail this test too.
+    TSDataTypeSwitchRule.RULE.check(
+        new ClassFileImporter()
+            .withImportOption(new ImportOption.DoNotIncludeTests())
+            // Avoid building the entire server dependency graph: only switch 
owners need checking.
+            .withImportOption(location -> 
TSDataTypeSwitchRule.hasSwitch(location.asURI()))
+            .importPackages("org.apache.iotdb"));

Review Comment:
   Fixed in 
[5eb7694245c](https://github.com/apache/iotdb/commit/5eb7694245c85771eccebdfcf68a0bfb1123a3f9).
 Added architecture-test to the default reactor with an aggregate production 
classpath covering the Java modules, including library-udf, JDBC and examples. 
Its ArchUnit/ASM check scans org.apache.iotdb without a violation baseline; the 
existing DataNode check remains explicitly scoped to org.apache.iotdb.db. The 
aggregate module includes the rule regression tests for ordinary switches, 
lambdas, anonymous classes, valid TypeService implementations and unrelated 
methods. Both the aggregate and DataNode architecture suites pass (7 tests 
each). Remaining client/example/REST type dispatches were migrated to 
TypeService.



##########
library-udf/src/main/i18n/en/org/apache/iotdb/library/i18n/LibraryUdfMessages.java:
##########
@@ -60,6 +60,9 @@ public final class LibraryUdfMessages {
   public static final String ALL_VALUES_ARE_NAN = "All values are NaN";
 
   // UDFEnvelopeAnalysis
+  public static final String FREQUENCY_MUST_BE_POSITIVE = "The param 
'frequency' must > 0.";
+  public static final String AMPLIFICATION_MUST_BE_AT_LEAST_1 =
+      "The param 'amplification' must >= 1.";

Review Comment:
   Fixed in 
[5eb7694245c](https://github.com/apache/iotdb/commit/5eb7694245c85771eccebdfcf68a0bfb1123a3f9).
 The English messages now say "must be greater than 0" and "must be greater 
than or equal to 1". The corresponding Chinese messages and validation behavior 
are preserved.



##########
library-udf/src/main/i18n/en/org/apache/iotdb/library/i18n/LibraryUdfMessages.java:
##########
@@ -60,6 +60,9 @@ public final class LibraryUdfMessages {
   public static final String ALL_VALUES_ARE_NAN = "All values are NaN";
 
   // UDFEnvelopeAnalysis
+  public static final String FREQUENCY_MUST_BE_POSITIVE = "The param 
'frequency' must > 0.";
+  public static final String AMPLIFICATION_MUST_BE_AT_LEAST_1 =
+      "The param 'amplification' must >= 1.";

Review Comment:
   Fixed in 
[5eb7694245c](https://github.com/apache/iotdb/commit/5eb7694245c85771eccebdfcf68a0bfb1123a3f9).
 The frequency and amplification keys now use 
EXCEPTION_THE_PARAM_FREQUENCY_MUST_BE_GREATER_THAN_0_45820CF9 and 
EXCEPTION_THE_PARAM_AMPLIFICATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO_1_D64050EB, 
derived from the corrected English messages. Both locale files and 
UDFEnvelopeAnalysis call sites match.



##########
library-udf/src/main/i18n/en/org/apache/iotdb/library/i18n/LibraryUdfMessages.java:
##########
@@ -100,6 +103,16 @@ public final class LibraryUdfMessages {
   // UDAFPatternMatch, UDAFDTWMatch
   public static final String UNSUPPORTED_DATATYPE = "Unsupported datatype %s";
 
+  // ExactOrderStatistics
+  public static final String UNSUPPORTED_DATA_TYPE = "Unsupported data type: 
%s";
+
+  // UDAFQuantile
+  public static final String UNSUPPORTED_DATA_TYPE_IN_QUANTILE = "Unsupported 
data type";

Review Comment:
   Fixed in 
[5eb7694245c](https://github.com/apache/iotdb/commit/5eb7694245c85771eccebdfcf68a0bfb1123a3f9).
 Both locale files now use EXCEPTION_UNSUPPORTED_DATA_TYPE_ARG_B411C29E and 
EXCEPTION_UNSUPPORTED_DATA_TYPE_A8CA7BE7, with ExactOrderStatistics and 
UDAFQuantile updated accordingly. English and Chinese source reactor builds 
pass.



##########
library-udf/src/main/i18n/en/org/apache/iotdb/library/i18n/LibraryUdfMessages.java:
##########
@@ -100,6 +103,16 @@ public final class LibraryUdfMessages {
   // UDAFPatternMatch, UDAFDTWMatch
   public static final String UNSUPPORTED_DATATYPE = "Unsupported datatype %s";
 
+  // ExactOrderStatistics
+  public static final String UNSUPPORTED_DATA_TYPE = "Unsupported data type: 
%s";
+
+  // UDAFQuantile
+  public static final String UNSUPPORTED_DATA_TYPE_IN_QUANTILE = "Unsupported 
data type";
+  public static final String QUANTILE_K_MUST_BE_AT_LEAST_100 =
+      "Size K has to be greater than or equal to 100.";
+  public static final String QUANTILE_RANK_MUST_BE_IN_RANGE =
+      "rank has to be greater than 0 and less than or equal to 1.";

Review Comment:
   Fixed in 
[5eb7694245c](https://github.com/apache/iotdb/commit/5eb7694245c85771eccebdfcf68a0bfb1123a3f9).
 The size/rank validation keys now use 
EXCEPTION_SIZE_K_HAS_TO_BE_GREATER_THAN_OR_EQUAL_TO_100_C514D1C3 and 
EXCEPTION_RANK_HAS_TO_BE_GREATER_THAN_0_AND_LESS_THAN_OR_EQUAL_TO_1_0F16AF94 in 
both locale files and UDAFQuantile. The validation boundaries are unchanged; 
English and Chinese source reactor builds pass.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to