Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.apache.iotdb.db.exception.sql;

public class MeasurementNotExistException extends SemanticException {
public class MeasurementNotExistException extends RuntimeException {

public MeasurementNotExistException(String message) {
super(message);
Expand Down
10 changes: 6 additions & 4 deletions server/src/main/java/org/apache/iotdb/db/mpp/common/QueryId.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@

public class QueryId {

public static QueryId mockQueryId = QueryId.valueOf("mock_query_id");
public static final QueryId mockQueryId = QueryId.valueOf("mock_query_id");

private final String id;

private int nextPlanNodeIndex;
private int nextPlanFragmentIndex;

private static final String INVALID_ID_ERROR_MSG = "Invalid id %s";

public static QueryId valueOf(String queryId) {
// ID is verified in the constructor
return new QueryId(queryId);
Expand Down Expand Up @@ -94,8 +96,8 @@ public static List<String> parseDottedId(String id, int expectedParts, String na
checkArgument(ids.size() == expectedParts, "Invalid %s %s", name, id);

for (String part : ids) {
checkArgument(!part.isEmpty(), "Invalid id %s", id);
checkArgument(isValidId(part), "Invalid id %s", id);
checkArgument(!part.isEmpty(), INVALID_ID_ERROR_MSG, id);
checkArgument(isValidId(part), INVALID_ID_ERROR_MSG, id);
}
return ids;
}
Expand Down Expand Up @@ -128,7 +130,7 @@ private static boolean isValidId(String id) {
public static String validateId(String id) {
requireNonNull(id, "id is null");
checkArgument(!id.isEmpty(), "id is empty");
checkArgument(isValidId(id), "Invalid id %s", id);
checkArgument(isValidId(id), INVALID_ID_ERROR_MSG, id);
return id;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

public class ColumnHeaderConstant {

private ColumnHeaderConstant() {
// forbidding instantiation
}

// column names for query statement
public static final String TIME = "Time";
public static final String ENDTIME = "__endTime";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

public class DatasetHeaderFactory {

private DatasetHeaderFactory() {
// forbidding instantiation
}

public static DatasetHeader getCountStorageGroupHeader() {
return new DatasetHeader(ColumnHeaderConstant.countStorageGroupColumnHeaders, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.iotdb.commons.utils.PathUtils;
import org.apache.iotdb.commons.utils.TestOnly;
import org.apache.iotdb.db.exception.metadata.PathNotExistException;
import org.apache.iotdb.db.exception.sql.SemanticException;
import org.apache.iotdb.db.mpp.common.schematree.node.SchemaEntityNode;
import org.apache.iotdb.db.mpp.common.schematree.node.SchemaInternalNode;
import org.apache.iotdb.db.mpp.common.schematree.node.SchemaMeasurementNode;
Expand All @@ -40,7 +41,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.rmi.UnexpectedException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
Expand Down Expand Up @@ -184,11 +184,9 @@ public List<Integer> compute(
if (node == null) {
indexOfMissingMeasurements.add(index);
} else {
if (firstNonViewMeasurement) {
if (!node.getAsMeasurementNode().isLogicalView()) {
schemaComputation.computeDevice(cur.getAsEntityNode().isAligned());
firstNonViewMeasurement = false;
}
if (firstNonViewMeasurement && !node.getAsMeasurementNode().isLogicalView()) {
schemaComputation.computeDevice(cur.getAsEntityNode().isAligned());
firstNonViewMeasurement = false;
}
schemaComputation.computeMeasurement(index, node.getAsMeasurementNode());
}
Expand All @@ -214,16 +212,14 @@ public void computeSourceOfLogicalView(
PartialPath fullPath = logicalViewSchema.getSourcePathIfWritable();
Pair<List<MeasurementPath>, Integer> searchResult = this.searchMeasurementPaths(fullPath);
List<MeasurementPath> measurementPathList = searchResult.left;
if (measurementPathList.size() <= 0) {
throw new RuntimeException(
if (measurementPathList.isEmpty()) {
throw new SemanticException(
new PathNotExistException(
String.format(
"The source path of view [%s] does not exist.", fullPath.getFullPath())));
} else if (measurementPathList.size() > 1) {
throw new RuntimeException(
new UnexpectedException(
String.format(
"The source paths of view [%s] are multiple.", fullPath.getFullPath())));
throw new SemanticException(
String.format("The source paths of view [%s] are multiple.", fullPath.getFullPath()));
} else {
Integer realIndex = schemaComputation.getIndexListOfLogicalViewPaths().get(index);
MeasurementPath measurementPath = measurementPathList.get(0);
Expand Down Expand Up @@ -407,7 +403,7 @@ public String getBelongedDatabase(String pathName) {
return database;
}
}
throw new RuntimeException("No matched database. Please check the path " + pathName);
throw new SemanticException("No matched database. Please check the path " + pathName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public abstract class SchemaTreeVisitor<R> extends AbstractTreeVisitor<SchemaNod

protected SchemaTreeVisitor() {}

public SchemaTreeVisitor(SchemaNode root, PartialPath pathPattern, boolean isPrefixMatch) {
protected SchemaTreeVisitor(SchemaNode root, PartialPath pathPattern, boolean isPrefixMatch) {
super(root, pathPattern, isPrefixMatch);
initStack();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
import org.apache.iotdb.db.mpp.common.schematree.node.SchemaNode;

public class SchemaTreeVisitorFactory {

private SchemaTreeVisitorFactory() {
// forbidden instantiation
}

public static SchemaTreeDeviceVisitor createSchemaTreeDeviceVisitor(
SchemaNode root, PartialPath pathPattern, boolean isPrefixMatch) {
return new SchemaTreeDeviceVisitor(root, pathPattern, isPrefixMatch);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.iotdb.db.mpp.plan;

import org.apache.iotdb.common.rpc.thrift.TEndPoint;
Expand Down
173 changes: 0 additions & 173 deletions server/src/main/java/org/apache/iotdb/db/mpp/plan/TestRPCClient.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ public class Analysis {
// Statement
private Statement statement;

// indicate whether this statement is `WRITE` or `READ`
private QueryType queryType;

private DataPartition dataPartition;

private SchemaPartition schemaPartition;
Expand Down Expand Up @@ -111,15 +108,17 @@ public class Analysis {
// tag keys specified in `GROUP BY TAG` clause
private List<String> tagKeys;

// {tag values -> {grouped expression -> output expressions}}
// For different combination of tag keys, the grouped expression may be different. Let's say there
// are 3 timeseries root.sg.d1.temperature, root.sg.d1.status, root.sg.d2.temperature, and their
// tags are [k1=v1], [k1=v1] and [k1=v2] respectively. For query "SELECT last_value(**) FROM root
// GROUP BY k1", timeseries are grouped by their tags into 2 buckets. Bucket [v1] has
// [root.sg.d1.temperature, root.sg.d1.status], while bucket [v2] has [root.sg.d2.temperature].
// Thus, the aggregation results of bucket [v1] and [v2] are different. Bucket [v1] has 2
// aggregation results last_value(temperature) and last_value(status), whereas bucket [v2] only
// has [last_value(temperature)].
/*
tag values -> (grouped expression -> output expressions)
For different combination of tag keys, the grouped expression may be different. Let's say there
are 3 timeseries root.sg.d1.temperature, root.sg.d1.status, root.sg.d2.temperature, and their
tags are [k1=v1], [k1=v1] and [k1=v2] respectively. For query "SELECT last_value(**) FROM root
GROUP BY k1", timeseries are grouped by their tags into 2 buckets. Bucket [v1] has
[root.sg.d1.temperature, root.sg.d1.status], while bucket [v2] has [root.sg.d2.temperature].
Thus, the aggregation results of bucket [v1] and [v2] are different. Bucket [v1] has 2
aggregation results last_value(temperature) and last_value(status), whereas bucket [v2] only
has [last_value(temperature)].
*/
private Map<List<String>, LinkedHashMap<Expression, List<Expression>>>
tagValuesToGroupedTimeseriesOperands;

Expand Down Expand Up @@ -260,6 +259,7 @@ public List<TRegionReplicaSet> getPartitionInfo(PartialPath seriesPath, Filter t
}

public List<TRegionReplicaSet> getPartitionInfo(String deviceName, Filter globalTimeFilter) {
// TODO: (xingtanzjr) implement the calculation of timePartitionIdList
return dataPartition.getDataRegionReplicaSet(deviceName, null);
}

Expand Down
Loading