Skip to content
Open
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 @@ -275,6 +275,9 @@

@Override
public Analysis visitQuery(QueryStatement queryStatement, MPPQueryContext context) {
// used for retry
queryStatement.setWhereConditionBackToOriginal();

Analysis analysis = new Analysis();
analysis.setLastLevelUseWildcard(queryStatement.isLastLevelUseWildcard());

Expand Down Expand Up @@ -524,6 +527,8 @@
WhereCondition whereCondition = queryStatement.getWhereCondition();
Expression predicate = whereCondition.getPredicate();

WhereCondition originalWhereCondition = new WhereCondition(predicate);

Check warning on line 530 in iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Distance between variable 'originalWhereCondition' declaration and its first usage is 6, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).

See more on https://sonarcloud.io/project/issues?id=apache_iotdb&issues=AZ9HcVNeywqgongkTFDK&open=AZ9HcVNeywqgongkTFDK&pullRequest=18179

Pair<Expression, Boolean> resultPair =
PredicateUtils.extractGlobalTimePredicate(predicate, true, true);
globalTimePredicate = resultPair.left;
Expand All @@ -540,6 +545,8 @@
} else {
whereCondition.setPredicate(predicate);
}

queryStatement.setOriginalWhereCondition(originalWhereCondition);
}
analysis.setGlobalTimePredicate(globalTimePredicate);
analysis.setHasValueFilter(hasValueFilter);
Expand All @@ -565,7 +572,7 @@
return analyzeLastSourceAndDataPartition(analysis, selectExpressions, schemaTree, context);
}

private Analysis analyzeLastSourceAndDataPartition(

Check warning on line 575 in iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

A "Brain Method" was detected. Refactor it to reduce at least one of the following metrics: LOC from 73 to 64, Complexity from 15 to 14, Nesting Level from 5 to 2, Number of Variables from 20 to 6.

See more on https://sonarcloud.io/project/issues?id=apache_iotdb&issues=AZ9HcVNeywqgongkTFDI&open=AZ9HcVNeywqgongkTFDI&pullRequest=18179
Analysis analysis,
List<Expression> selectExpressions,
ISchemaTree schemaTree,
Expand Down Expand Up @@ -2212,7 +2219,7 @@
* contains [XX, +oo), res.right.right = true
*/
@SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning
public static Pair<List<TTimePartitionSlot>, Pair<Boolean, Boolean>> getTimePartitionSlotList(

Check warning on line 2222 in iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

A "Brain Method" was detected. Refactor it to reduce at least one of the following metrics: LOC from 71 to 64, Complexity from 15 to 14, Nesting Level from 3 to 2, Number of Variables from 14 to 6.

See more on https://sonarcloud.io/project/issues?id=apache_iotdb&issues=AZ9HcVNeywqgongkTFDJ&open=AZ9HcVNeywqgongkTFDJ&pullRequest=18179
Filter timeFilter, MPPQueryContext context) {
if (timeFilter == null) {
// (-oo, +oo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public class QueryStatement extends AuthorityInformationStatement {
private SelectComponent selectComponent;
private FromComponent fromComponent;
private WhereCondition whereCondition;

// used for retry
private WhereCondition originalWhereCondition;

private HavingCondition havingCondition;

// row limit for result set. The default value is 0, which means no limit
Expand Down Expand Up @@ -241,6 +245,16 @@ public void setWhereCondition(WhereCondition whereCondition) {
this.whereCondition = whereCondition;
}

public void setWhereConditionBackToOriginal() {
if (originalWhereCondition != null) {
this.whereCondition = originalWhereCondition;
}
}

public void setOriginalWhereCondition(WhereCondition originalWhereCondition) {
this.originalWhereCondition = originalWhereCondition;
}

public boolean hasHaving() {
return havingCondition != null;
}
Expand Down
Loading