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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/AlterTimeSeriesTask.java:
##########
@@ -40,11 +40,18 @@ public AlterTimeSeriesTask(
   @Override
   public ListenableFuture<ConfigTaskResult> execute(final IConfigTaskExecutor 
configTaskExecutor)
       throws InterruptedException {
-    if (alterTimeSeriesStatement.getDataType() != null) {
+    if (alterTimeSeriesStatement
+        .getAlterType()
+        .equals(AlterTimeSeriesStatement.AlterType.SET_DATA_TYPE)) {
+      if (alterTimeSeriesStatement.getDataType() == null) {
+        throw new InterruptedException(
+            String.format(
+                "Data type cannot be null executing the statement that alter 
timeseries %s set data type",
+                alterTimeSeriesStatement.getPath().getFullPath()));
+      }
       return configTaskExecutor.alterTimeSeriesDataType(queryId, 
alterTimeSeriesStatement);
     } else {
-      // not support
-      throw new InterruptedException("AlterTimeSeriesTask is not support");
+      throw new InterruptedException("Not support current statement");

Review Comment:
   UnsupportedOperationException



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/AlterTimeSeriesTask.java:
##########
@@ -40,11 +40,18 @@ public AlterTimeSeriesTask(
   @Override
   public ListenableFuture<ConfigTaskResult> execute(final IConfigTaskExecutor 
configTaskExecutor)
       throws InterruptedException {
-    if (alterTimeSeriesStatement.getDataType() != null) {
+    if (alterTimeSeriesStatement
+        .getAlterType()
+        .equals(AlterTimeSeriesStatement.AlterType.SET_DATA_TYPE)) {
+      if (alterTimeSeriesStatement.getDataType() == null) {
+        throw new InterruptedException(
+            String.format(
+                "Data type cannot be null executing the statement that alter 
timeseries %s set data type",
+                alterTimeSeriesStatement.getPath().getFullPath()));

Review Comment:
   IllegalArgumentException



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java:
##########
@@ -3245,6 +3246,14 @@ public SettableFuture<ConfigTaskResult> 
alterTimeSeriesDataType(
     }
   }
 
+  @Override
+  public SettableFuture<ConfigTaskResult> alterTimeSeries(
+      final String queryId, final AlterTimeSeriesStatement 
alterTimeSeriesStatement) {
+    final SettableFuture<ConfigTaskResult> future = SettableFuture.create();
+    future.set(new ConfigTaskResult(TSStatusCode.SUCCESS_STATUS));
+    return future;
+  }
+

Review Comment:
   Should throw an exception



##########
integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAlterTimeSeriesTypeIT.java:
##########
@@ -2452,22 +2448,38 @@ private static void standardAccumulatorQueryTest(
         }
       }
     } else {
-      SessionDataSet dataSet =
-          session.executeQueryStatement(
-              "select 
min_value(s1),max_value(s1),first_value(s1),last_value(s1) from "
-                  + database
-                  + ".construct_and_alter_column_type");
-      RowRecord rec = dataSet.next();
-      int[] expectedValue = {1, 1024, 1, 1024};
-      if (newType == TSDataType.STRING
-          || newType == TSDataType.TEXT
-          || newType == TSDataType.BLOB) {
-        expectedValue[1] = 999;
-      } else if (newType == TSDataType.BOOLEAN) {
-        expectedValue = new int[] {19700102, 19721021, 19700102, 19721021};
+      SessionDataSet dataSet;
+      int[] expectedValue;
+      int max = 4;
+      if (DATA_TYPE_LIST.contains(newType)) {
+        dataSet =
+            session.executeQueryStatement(
+                "select first_value(s1),last_value(s1) from "
+                    + database
+                    + ".construct_and_alter_column_type");
+        expectedValue = new int[] {1, 1024};
+        max = 2;
+      } else {
+        dataSet =
+            session.executeQueryStatement(
+                "select 
min_value(s1),max_value(s1),first_value(s1),last_value(s1) from "
+                    + database
+                    + ".construct_and_alter_column_type");
+        expectedValue = new int[] {1, 1024, 1, 1024};
+        if (newType == TSDataType.BOOLEAN) {
+          expectedValue = new int[] {19700102, 19721021, 19700102, 19721021};
+        }
       }
+      RowRecord rec = dataSet.next();
+      //      if (newType == TSDataType.STRING
+      //          || newType == TSDataType.TEXT
+      //          || newType == TSDataType.BLOB) {
+      //        expectedValue[1] = 999;
+      //      } else if (newType == TSDataType.BOOLEAN) {
+      //        expectedValue = new int[] {19700102, 19721021, 19700102, 
19721021};
+      //      }
       if (newType != TSDataType.BOOLEAN) {

Review Comment:
   Remove



##########
integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBAlterColumnTypeIT.java:
##########
@@ -1325,18 +1316,30 @@ public void testAlignDeviceSequenceDataQuery(TSDataType 
from, TSDataType to)
         tablet.reset();
       }
 
-      SessionDataSet dataSet =
-          session.executeQueryStatement(
-              "select min(s1),max(s1),first(s1),last(s1) from 
construct_and_alter_column_type");
-      RowRecord rec = dataSet.next();
-      while (rec != null) {
-        System.out.println(rec.getFields().toString());
-        rec = dataSet.next();
+      if (DATA_TYPE_LIST.contains(from) || DATA_TYPE_LIST.contains(to)) {
+        SessionDataSet dataSet =
+            session.executeQueryStatement(
+                "select first(s1),last(s1) from 
construct_and_alter_column_type");
+        RowRecord rec = dataSet.next();
+        while (rec != null) {
+          System.out.println(rec.getFields().toString());

Review Comment:
   Remove



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/SeriesScanUtil.java:
##########
@@ -331,7 +330,6 @@ public boolean canUseCurrentFileStatistics() {
     checkState(firstTimeSeriesMetadata != null, "no first file");
 
     if (currentFileOverlapped() || firstTimeSeriesMetadata.isModified()) {
-      //        || !firstTimeSeriesMetadata.isModified()) {

Review Comment:
   ?



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java:
##########
@@ -675,19 +680,20 @@ public void parseAliasClause(
   }
 
   private TSDataType 
parseDataTypeAttribute(IoTDBSqlParser.AttributeValueContext ctx) {
-    TSDataType dataType = null;
-    if (ctx != null) {
-      String dataTypeString = parseAttributeValue(ctx);
-      try {
-        dataType = TSDataType.valueOf(dataTypeString);
-        if (TSDataType.UNKNOWN.equals(dataType) || 
TSDataType.VECTOR.equals(dataType)) {
-          throw new SemanticException(String.format("Unsupported datatype: 
%s", dataTypeString));
-        }
-      } catch (Exception e) {
+    if (ctx == null) {
+      throw new SemanticException("Incorrect Data type");
+    }
+
+    String dataTypeString = parseAttributeValue(ctx);
+    try {
+      TSDataType dataType = TSDataType.valueOf(dataTypeString);
+      if (TSDataType.UNKNOWN.equals(dataType) || 
TSDataType.VECTOR.equals(dataType)) {
         throw new SemanticException(String.format("Unsupported datatype: %s", 
dataTypeString));
       }
+      return dataType;
+    } catch (Exception e) {
+      throw new SemanticException(String.format("Unsupported datatype: %s", 
dataTypeString));
     }

Review Comment:
   Unnecessary to catch and rethrow the same exception.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java:
##########
@@ -289,21 +290,15 @@ public static List<String> 
splitPartialBuiltinAggregation(TAggregationType aggre
     }
   }
 
-  private static void addSymmetricPairs(
-      Set<Pair<TSDataType, TSDataType>> set, TSDataType... dataTypes) {
-    for (int i = 0; i < dataTypes.length; i++) {
-      for (int j = i + 1; j < dataTypes.length; j++) {
-        set.add(new Pair<>(dataTypes[i], dataTypes[j]));
-        set.add(new Pair<>(dataTypes[j], dataTypes[i]));
-      }
-    }
-  }
-
   public static boolean isUsingSameColumn(TSDataType originalDataType, 
TSDataType dataType) {
     if (originalDataType == dataType) {
       return true;
     }
-    return SAME_TYPE_PAIRS.contains(new Pair<>(originalDataType, dataType));
+    if (dataTypeColumnClassMap.get(originalDataType) == null
+        || dataTypeColumnClassMap.get(dataType) == null) {
+      return false;
+    }
+    return dataTypeColumnClassMap.get(originalDataType) == 
dataTypeColumnClassMap.get(dataType);

Review Comment:
   Objects.equals(dataTypeColumnClassMap.get(originalDataType), 
dataTypeColumnClassMap.get(dataType))



-- 
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