public long getTimePartition() {
    return tsFileID.timePartitionId;
  }
make sure Either the deviceToIndex is not empty Or the path contains a partition folder
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java