This is an automated email from the ASF dual-hosted git repository.

shuwenwei pushed a commit to branch read_tsfile_table_function
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 93f9a5027de24e3d08c7010193145960160a3b63
Author: shuwenwei <[email protected]>
AuthorDate: Mon Jun 8 16:44:05 2026 +0800

    modify parameter name
---
 .../InformationSchemaContentSupplierFactory.java   |   8 +-
 .../config/metadata/ShowFunctionsTask.java         |   6 +
 .../DataNodeTableBuiltinTableFunction.java         |  67 +++++++++++
 .../function}/tvf/ReadTsFileTableFunction.java     | 124 ++++++++++++++++++---
 .../relational/metadata/TableMetadataImpl.java     |  11 ++
 .../plan/relational/planner/RelationPlanner.java   |   6 +-
 .../function/TableBuiltinTableFunction.java        |   6 +-
 7 files changed, 201 insertions(+), 27 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/InformationSchemaContentSupplierFactory.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/InformationSchemaContentSupplierFactory.java
index ca9c09ecb95..43efe7c7415 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/InformationSchemaContentSupplierFactory.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/InformationSchemaContentSupplierFactory.java
@@ -86,6 +86,7 @@ import org.apache.iotdb.db.queryengine.plan.Coordinator;
 import org.apache.iotdb.db.queryengine.plan.execution.IQueryExecution;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.ShowCreateViewTask;
 import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanGraphPrinter;
+import 
org.apache.iotdb.db.queryengine.plan.relational.function.DataNodeTableBuiltinTableFunction;
 import 
org.apache.iotdb.db.queryengine.plan.relational.planner.node.InformationSchemaTableScanNode;
 import 
org.apache.iotdb.db.queryengine.plan.relational.planner.node.TableDiskUsageInformationSchemaTableScanNode;
 import org.apache.iotdb.db.queryengine.plan.relational.security.AccessControl;
@@ -133,6 +134,7 @@ import java.util.Set;
 import java.util.TreeMap;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import static 
org.apache.iotdb.commons.conf.IoTDBConstant.FUNCTION_STATE_AVAILABLE;
 import static 
org.apache.iotdb.commons.conf.IoTDBConstant.FUNCTION_TYPE_BUILTIN_AGG_FUNC;
@@ -957,7 +959,11 @@ public class InformationSchemaContentSupplierFactory {
               
TableBuiltinAggregationFunction.getBuiltInAggregateFunctionName().iterator();
         } else if 
(functionType.equals(BINARY_MAP.get(FUNCTION_TYPE_BUILTIN_AGG_FUNC))) {
           functionType = BINARY_MAP.get(FUNCTION_TYPE_BUILTIN_TABLE_FUNC);
-          nameIterator = 
TableBuiltinTableFunction.getBuiltInTableFunctionName().iterator();
+          nameIterator =
+              Stream.concat(
+                      
TableBuiltinTableFunction.getBuiltInTableFunctionName().stream(),
+                      
DataNodeTableBuiltinTableFunction.getBuiltInTableFunctionName().stream())
+                  .iterator();
         } else {
           return false;
         }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowFunctionsTask.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowFunctionsTask.java
index d9fcf3a979c..9866b77cf13 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowFunctionsTask.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowFunctionsTask.java
@@ -36,6 +36,7 @@ import 
org.apache.iotdb.db.queryengine.common.header.DatasetHeaderFactory;
 import org.apache.iotdb.db.queryengine.plan.execution.config.ConfigTaskResult;
 import org.apache.iotdb.db.queryengine.plan.execution.config.IConfigTask;
 import 
org.apache.iotdb.db.queryengine.plan.execution.config.executor.IConfigTaskExecutor;
+import 
org.apache.iotdb.db.queryengine.plan.relational.function.DataNodeTableBuiltinTableFunction;
 import org.apache.iotdb.db.queryengine.plan.udf.TreeUDFUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
 
@@ -158,6 +159,11 @@ public class ShowFunctionsTask implements IConfigTask {
         TableBuiltinTableFunction.getBuiltInTableFunctionName(),
         BINARY_MAP.get(FUNCTION_TYPE_BUILTIN_TABLE_FUNC),
         BINARY_MAP.get(FUNCTION_STATE_AVAILABLE));
+    appendFunctions(
+        builder,
+        DataNodeTableBuiltinTableFunction.getBuiltInTableFunctionName(),
+        BINARY_MAP.get(FUNCTION_TYPE_BUILTIN_TABLE_FUNC),
+        BINARY_MAP.get(FUNCTION_STATE_AVAILABLE));
     DatasetHeader datasetHeader = 
DatasetHeaderFactory.getShowFunctionsHeader();
     future.set(new ConfigTaskResult(TSStatusCode.SUCCESS_STATUS, 
builder.build(), datasetHeader));
   }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/DataNodeTableBuiltinTableFunction.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/DataNodeTableBuiltinTableFunction.java
new file mode 100644
index 00000000000..858c2ab3926
--- /dev/null
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/DataNodeTableBuiltinTableFunction.java
@@ -0,0 +1,67 @@
+/*
+ * 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.queryengine.plan.relational.function;
+
+import org.apache.iotdb.commons.exception.SemanticException;
+import org.apache.iotdb.commons.i18n.QueryMessages;
+import 
org.apache.iotdb.db.queryengine.plan.relational.function.tvf.ReadTsFileTableFunction;
+import org.apache.iotdb.udf.api.relational.TableFunction;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public enum DataNodeTableBuiltinTableFunction {
+  READ_TSFILE("read_tsfile");
+
+  private final String functionName;
+
+  DataNodeTableBuiltinTableFunction(String functionName) {
+    this.functionName = functionName;
+  }
+
+  public String getFunctionName() {
+    return functionName;
+  }
+
+  private static final Set<String> BUILT_IN_TABLE_FUNCTION_NAME =
+      new HashSet<>(
+          Arrays.stream(DataNodeTableBuiltinTableFunction.values())
+              .map(DataNodeTableBuiltinTableFunction::getFunctionName)
+              .collect(Collectors.toList()));
+
+  public static Set<String> getBuiltInTableFunctionName() {
+    return BUILT_IN_TABLE_FUNCTION_NAME;
+  }
+
+  public static boolean isBuiltInTableFunction(String functionName) {
+    return BUILT_IN_TABLE_FUNCTION_NAME.contains(functionName.toLowerCase());
+  }
+
+  public static TableFunction getBuiltinTableFunction(String functionName) {
+    switch (functionName.toLowerCase()) {
+      case "read_tsfile":
+        return new ReadTsFileTableFunction();
+      default:
+        throw new 
SemanticException(String.format(QueryMessages.UNKNOWN_FUNCTION, functionName));
+    }
+  }
+}
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/relational/tvf/ReadTsFileTableFunction.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/tvf/ReadTsFileTableFunction.java
similarity index 79%
rename from 
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/relational/tvf/ReadTsFileTableFunction.java
rename to 
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/tvf/ReadTsFileTableFunction.java
index d2f92f6e287..71ed1b3670f 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/relational/tvf/ReadTsFileTableFunction.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/tvf/ReadTsFileTableFunction.java
@@ -17,10 +17,11 @@
  * under the License.
  */
 
-package org.apache.iotdb.commons.udf.builtin.relational.tvf;
+package org.apache.iotdb.db.queryengine.plan.relational.function.tvf;
 
 import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
 import org.apache.iotdb.commons.udf.utils.UDFDataTypeTransformer;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.udf.api.exception.UDFArgumentNotValidException;
 import org.apache.iotdb.udf.api.exception.UDFException;
 import org.apache.iotdb.udf.api.relational.TableFunction;
@@ -48,6 +49,7 @@ import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -64,37 +66,38 @@ import static 
org.apache.iotdb.commons.schema.table.TsTable.TIME_COLUMN_NAME;
 /** Reads one or more TsFiles as a table function source. */
 public class ReadTsFileTableFunction implements TableFunction {
   private static final String TABLE_NAME_PARAMETER_NAME = "TABLE_NAME";
-  private static final String TSFILE_PATHS_PARAMETER_NAME = "TSFILE_PATHS";
+  private static final String PATHS_PARAMETER_NAME = "PATHS";
 
   @Override
   public List<ParameterSpecification> getArgumentsSpecifications() {
     return Arrays.asList(
+        
ScalarParameterSpecification.builder().name(PATHS_PARAMETER_NAME).type(Type.STRING).build(),
         ScalarParameterSpecification.builder()
             .name(TABLE_NAME_PARAMETER_NAME)
             .type(Type.STRING)
-            .build(),
-        ScalarParameterSpecification.builder()
-            .name(TSFILE_PATHS_PARAMETER_NAME)
-            .type(Type.STRING)
+            .defaultValue("")
             .build());
   }
 
   @Override
   public TableFunctionAnalysis analyze(Map<String, Argument> arguments) throws 
UDFException {
-    String tableName = getRequiredStringArgument(arguments, 
TABLE_NAME_PARAMETER_NAME);
+    String tableName = getOptionalStringArgument(arguments, 
TABLE_NAME_PARAMETER_NAME);
     List<String> tsFilePaths =
-        parseTsFilePaths(getRequiredStringArgument(arguments, 
TSFILE_PATHS_PARAMETER_NAME));
+        parseTsFilePaths(getRequiredStringArgument(arguments, 
PATHS_PARAMETER_NAME));
+    checkTsFilePathsAreOutsideDataDirs(tsFilePaths);
     TsFileSchemaCollection schemaCollection =
-        collectTsFilesAndResolveSchema(tableName, tsFilePaths);
+        collectTsFilesAndResolveSchema(tableName.isEmpty() ? null : tableName, 
tsFilePaths);
     if (schemaCollection.mergedTableSchema == null) {
       throw new UDFArgumentNotValidException(
-          "No table schema found for table " + tableName + " in TsFiles");
+          tableName.isEmpty()
+              ? "No table schema found in TsFiles"
+              : "No table schema found for table " + tableName + " in 
TsFiles");
     }
     DescribedSchema outputSchema = 
convertToDescribedSchema(schemaCollection.mergedTableSchema);
 
     ReadTsFileTableFunctionHandle handle =
         new ReadTsFileTableFunctionHandle(
-            tableName,
+            schemaCollection.tableName,
             schemaCollection.tsFiles.stream()
                 .map(File::getAbsolutePath)
                 .collect(Collectors.toList()),
@@ -130,6 +133,21 @@ public class ReadTsFileTableFunction implements 
TableFunction {
     return ((String) value).trim();
   }
 
+  private static String getOptionalStringArgument(Map<String, Argument> 
arguments, String name) {
+    Argument argument = arguments.get(name);
+    if (argument == null) {
+      return "";
+    }
+    if (!(argument instanceof ScalarArgument)) {
+      throw new UDFArgumentNotValidException("Invalid scalar argument: " + 
name);
+    }
+    Object value = ((ScalarArgument) argument).getValue();
+    if (!(value instanceof String)) {
+      throw new UDFArgumentNotValidException("Argument " + name + " should be 
a string");
+    }
+    return ((String) value).trim();
+  }
+
   private static List<String> parseTsFilePaths(String tsFilePaths) {
     List<String> paths =
         Arrays.stream(tsFilePaths.split(","))
@@ -138,15 +156,44 @@ public class ReadTsFileTableFunction implements 
TableFunction {
             .collect(Collectors.toList());
     if (paths.isEmpty()) {
       throw new UDFArgumentNotValidException(
-          "Argument " + TSFILE_PATHS_PARAMETER_NAME + " should contain at 
least one path");
+          "Argument " + PATHS_PARAMETER_NAME + " should contain at least one 
path");
     }
     return paths;
   }
 
+  private static void checkTsFilePathsAreOutsideDataDirs(List<String> 
tsFilePaths) {
+    List<Path> dataDirs =
+        Arrays.stream(IoTDBDescriptor.getInstance().getConfig().getDataDirs())
+            .map(ReadTsFileTableFunction::normalizePath)
+            .collect(Collectors.toList());
+    for (String tsFilePath : tsFilePaths) {
+      Path normalizedTsFilePath = normalizePath(tsFilePath);
+      for (Path dataDir : dataDirs) {
+        if (normalizedTsFilePath.startsWith(dataDir) || 
dataDir.startsWith(normalizedTsFilePath)) {
+          throw new UDFArgumentNotValidException(
+              String.format(
+                  "read_tsfile path %s is not allowed because it may access 
IoTDB data directory %s",
+                  tsFilePath, dataDir));
+        }
+      }
+    }
+  }
+
+  private static Path normalizePath(String path) {
+    Path normalizedPath = Paths.get(path).toAbsolutePath().normalize();
+    try {
+      return normalizedPath.toRealPath();
+    } catch (IOException e) {
+      return normalizedPath;
+    }
+  }
+
   private static TsFileSchemaCollection collectTsFilesAndResolveSchema(
-      String tableName, List<String> tsFilePaths) {
+      String specifiedTableName, List<String> tsFilePaths) {
     List<File> tsFiles = new ArrayList<>();
     MergedTableSchemaBuilder schemaBuilder = null;
+    String resolvedTableName =
+        specifiedTableName == null ? null : 
specifiedTableName.toLowerCase(Locale.ENGLISH);
     for (String tsFilePath : tsFilePaths) {
       Path path = new File(tsFilePath).toPath();
       if (!Files.exists(path)) {
@@ -156,13 +203,25 @@ public class ReadTsFileTableFunction implements 
TableFunction {
         Iterator<Path> iterator = 
walkedPaths.filter(Files::isRegularFile).iterator();
         while (iterator.hasNext()) {
           Path filePath = iterator.next();
-          TableSchema tableSchema = tryReadTableSchema(tableName, 
filePath.toFile());
+          TableSchema tableSchema =
+              specifiedTableName == null
+                  ? tryInferTableSchema(filePath.toFile())
+                  : tryReadTableSchema(specifiedTableName, filePath.toFile());
           if (tableSchema == null) {
             continue;
           }
+          String currentTableName = 
tableSchema.getTableName().toLowerCase(Locale.ENGLISH);
+          if (resolvedTableName == null) {
+            resolvedTableName = currentTableName;
+          } else if (!resolvedTableName.equals(currentTableName)) {
+            throw new UDFArgumentNotValidException(
+                String.format(
+                    "Cannot infer table name from TsFiles because multiple 
tables are found: %s and %s",
+                    resolvedTableName, currentTableName));
+          }
           tsFiles.add(filePath.toFile());
           if (schemaBuilder == null) {
-            schemaBuilder = new MergedTableSchemaBuilder(tableName, 
tableSchema);
+            schemaBuilder = new MergedTableSchemaBuilder(resolvedTableName, 
tableSchema);
           } else {
             schemaBuilder.merge(tableSchema);
           }
@@ -174,8 +233,7 @@ public class ReadTsFileTableFunction implements 
TableFunction {
     if (tsFiles.isEmpty()) {
       throw new UDFArgumentNotValidException("No valid TsFiles found");
     }
-    return new TsFileSchemaCollection(
-        tsFiles, schemaBuilder == null ? null : schemaBuilder.build());
+    return new TsFileSchemaCollection(resolvedTableName, tsFiles, 
schemaBuilder.build());
   }
 
   private static TableSchema tryReadTableSchema(String tableName, File tsFile) 
{
@@ -193,11 +251,41 @@ public class ReadTsFileTableFunction implements 
TableFunction {
     }
   }
 
+  private static TableSchema tryInferTableSchema(File tsFile) {
+    if (!tsFile.canRead()) {
+      return null;
+    }
+    try (TsFileSequenceReader reader = new 
TsFileSequenceReader(tsFile.getAbsolutePath())) {
+      if (!reader.isComplete() || reader.readVersionNumber() != 
TSFileConfig.VERSION_NUMBER) {
+        return null;
+      }
+      Map<String, TableSchema> tableSchemaMap = reader.getTableSchemaMap();
+      if (tableSchemaMap.isEmpty()) {
+        throw new UDFArgumentNotValidException(
+            "Cannot infer table name from TsFile because no table schema is 
found in "
+                + tsFile.getAbsolutePath());
+      }
+      if (tableSchemaMap.size() > 1) {
+        throw new UDFArgumentNotValidException(
+            "Cannot infer table name from TsFile because multiple tables are 
found in "
+                + tsFile.getAbsolutePath());
+      }
+      return tableSchemaMap.values().iterator().next();
+    } catch (UDFArgumentNotValidException e) {
+      throw e;
+    } catch (Exception e) {
+      return null;
+    }
+  }
+
   private static class TsFileSchemaCollection {
+    private final String tableName;
     private final List<File> tsFiles;
     private final TableSchema mergedTableSchema;
 
-    private TsFileSchemaCollection(List<File> tsFiles, TableSchema 
mergedTableSchema) {
+    private TsFileSchemaCollection(
+        String tableName, List<File> tsFiles, TableSchema mergedTableSchema) {
+      this.tableName = tableName;
       this.tsFiles = tsFiles;
       this.mergedTableSchema = mergedTableSchema;
     }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java
index 898b226ffa1..1305f8db4a0 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java
@@ -27,6 +27,7 @@ import 
org.apache.iotdb.commons.partition.DataPartitionQueryParam;
 import org.apache.iotdb.commons.partition.SchemaPartition;
 import org.apache.iotdb.commons.queryengine.common.SessionInfo;
 import 
org.apache.iotdb.commons.queryengine.plan.relational.function.OperatorType;
+import 
org.apache.iotdb.commons.queryengine.plan.relational.function.TableFunctionFactory;
 import 
org.apache.iotdb.commons.queryengine.plan.relational.function.arithmetic.AdditionResolver;
 import 
org.apache.iotdb.commons.queryengine.plan.relational.function.arithmetic.DivisionResolver;
 import 
org.apache.iotdb.commons.queryengine.plan.relational.function.arithmetic.ModulusResolver;
@@ -52,6 +53,7 @@ import org.apache.iotdb.db.i18n.DataNodeQueryMessages;
 import org.apache.iotdb.db.queryengine.common.MPPQueryContext;
 import org.apache.iotdb.db.queryengine.plan.analyze.ClusterPartitionFetcher;
 import org.apache.iotdb.db.queryengine.plan.analyze.IPartitionFetcher;
+import 
org.apache.iotdb.db.queryengine.plan.relational.function.DataNodeTableBuiltinTableFunction;
 import 
org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.TableDeviceSchemaFetcher;
 import 
org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.TableDeviceSchemaValidator;
 import 
org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.TableHeaderSchemaValidator;
@@ -62,6 +64,7 @@ import 
org.apache.iotdb.udf.api.customizer.analysis.ScalarFunctionAnalysis;
 import org.apache.iotdb.udf.api.customizer.parameter.FunctionArguments;
 import org.apache.iotdb.udf.api.relational.AggregateFunction;
 import org.apache.iotdb.udf.api.relational.ScalarFunction;
+import org.apache.iotdb.udf.api.relational.TableFunction;
 
 import org.apache.tsfile.file.metadata.IDeviceID;
 import org.apache.tsfile.read.common.type.ObjectType;
@@ -95,6 +98,14 @@ public class TableMetadataImpl implements Metadata {
 
   private final DataNodeTableCache tableCache = 
DataNodeTableCache.getInstance();
 
+  @Override
+  public TableFunction getTableFunction(String functionName) {
+    if 
(DataNodeTableBuiltinTableFunction.isBuiltInTableFunction(functionName)) {
+      return 
DataNodeTableBuiltinTableFunction.getBuiltinTableFunction(functionName);
+    }
+    return TableFunctionFactory.getTableFunction(functionName);
+  }
+
   @Override
   public boolean tableExists(final QualifiedObjectName name) {
     return tableCache.getTable(name.getDatabaseName(), name.getObjectName(), 
false) != null;
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
index f857775cc45..5855b15922f 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
@@ -24,7 +24,6 @@ import 
org.apache.iotdb.commons.queryengine.common.SessionInfo;
 import org.apache.iotdb.commons.queryengine.plan.planner.plan.node.PlanNode;
 import 
org.apache.iotdb.commons.queryengine.plan.planner.plan.node.TableScanNode;
 import org.apache.iotdb.commons.queryengine.plan.relational.analyzer.NodeRef;
-import 
org.apache.iotdb.commons.queryengine.plan.relational.function.TableBuiltinTableFunction;
 import 
org.apache.iotdb.commons.queryengine.plan.relational.metadata.ColumnSchema;
 import 
org.apache.iotdb.commons.queryengine.plan.relational.metadata.QualifiedObjectName;
 import 
org.apache.iotdb.commons.queryengine.plan.relational.planner.Assignments;
@@ -89,7 +88,6 @@ import 
org.apache.iotdb.commons.queryengine.plan.relational.sql.ast.VariableDefi
 import 
org.apache.iotdb.commons.queryengine.plan.relational.type.InternalTypeManager;
 import org.apache.iotdb.commons.queryengine.utils.cte.CteDataStore;
 import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
-import 
org.apache.iotdb.commons.udf.builtin.relational.tvf.ReadTsFileTableFunction;
 import org.apache.iotdb.db.i18n.DataNodeQueryMessages;
 import org.apache.iotdb.db.queryengine.common.MPPQueryContext;
 import org.apache.iotdb.db.queryengine.common.QueryId;
@@ -116,6 +114,8 @@ import 
org.apache.iotdb.db.queryengine.plan.relational.analyzer.RelationType;
 import org.apache.iotdb.db.queryengine.plan.relational.analyzer.Scope;
 import 
org.apache.iotdb.db.queryengine.plan.relational.analyzer.tablefunction.TableArgumentAnalysis;
 import 
org.apache.iotdb.db.queryengine.plan.relational.analyzer.tablefunction.TableFunctionInvocationAnalysis;
+import 
org.apache.iotdb.db.queryengine.plan.relational.function.DataNodeTableBuiltinTableFunction;
+import 
org.apache.iotdb.db.queryengine.plan.relational.function.tvf.ReadTsFileTableFunction;
 import 
org.apache.iotdb.db.queryengine.plan.relational.metadata.TableMetadataImpl;
 import 
org.apache.iotdb.db.queryengine.plan.relational.metadata.TreeDeviceViewSchema;
 import org.apache.iotdb.db.queryengine.plan.relational.planner.ir.IrUtils;
@@ -1459,7 +1459,7 @@ public class RelationPlanner implements 
AstVisitor<RelationPlan, Void> {
   @Override
   public RelationPlan visitTableFunctionInvocation(TableFunctionInvocation 
node, Void context) {
     TableFunctionInvocationAnalysis functionAnalysis = 
analysis.getTableFunctionAnalysis(node);
-    if (TableBuiltinTableFunction.READ_TSFILE
+    if (DataNodeTableBuiltinTableFunction.READ_TSFILE
         .getFunctionName()
         .equalsIgnoreCase(functionAnalysis.getFunctionName())) {
       return planExternalTsFileScan(node, functionAnalysis);
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/queryengine/plan/relational/function/TableBuiltinTableFunction.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/queryengine/plan/relational/function/TableBuiltinTableFunction.java
index fe54d1078cd..43673a2e90c 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/queryengine/plan/relational/function/TableBuiltinTableFunction.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/queryengine/plan/relational/function/TableBuiltinTableFunction.java
@@ -26,7 +26,6 @@ import 
org.apache.iotdb.commons.queryengine.plan.relational.function.tvf.Pattern
 import 
org.apache.iotdb.commons.udf.builtin.relational.tvf.CapacityTableFunction;
 import 
org.apache.iotdb.commons.udf.builtin.relational.tvf.CumulateTableFunction;
 import org.apache.iotdb.commons.udf.builtin.relational.tvf.HOPTableFunction;
-import 
org.apache.iotdb.commons.udf.builtin.relational.tvf.ReadTsFileTableFunction;
 import 
org.apache.iotdb.commons.udf.builtin.relational.tvf.SessionTableFunction;
 import org.apache.iotdb.commons.udf.builtin.relational.tvf.TumbleTableFunction;
 import 
org.apache.iotdb.commons.udf.builtin.relational.tvf.VariationTableFunction;
@@ -46,8 +45,7 @@ public enum TableBuiltinTableFunction {
   CAPACITY("capacity"),
   FORECAST("forecast"),
   PATTERN_MATCH("pattern_match"),
-  CLASSIFY("classify"),
-  READ_TSFILE("read_tsfile");
+  CLASSIFY("classify");
 
   private final String functionName;
 
@@ -93,8 +91,6 @@ public enum TableBuiltinTableFunction {
         return new ForecastTableFunction();
       case "classify":
         return new ClassifyTableFunction();
-      case "read_tsfile":
-        return new ReadTsFileTableFunction();
       default:
         throw new UnsupportedOperationException(
             String.format(QueryMessages.UNSUPPORTED_TABLE_FUNCTION, 
functionName));

Reply via email to