New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IOTDB-527] Refactor series reader #864
Conversation
* fix valueFilterBug for nextOverlappedPage
* new multithread groupby and GroupByExecutor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the Group by parallel, it seems that it will create new future task and invoke future.get() each time nextWithoutConstraint() is called. This way is like the first version's raw data query parallel that I implements. It will slower the query instead of speeding up.
if (!satisfyTimeFilter(seriesReader.currentChunkStatistics())) { | ||
seriesReader.skipCurrentChunk(); | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why here delete this, if we can know from the chunk statistics that the chunk is not satisfied, we can just skip that chunk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made up for it
public boolean hasNextChunk() throws IOException { | ||
if (hasCachedFirstChunkMetadata) { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that if I keep calling hasNextChunk(), the firstChunkMetaData will move to next all the time.
you can add an if statement.
if (firstChunkMetaData != null)
return true;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if (remainingToCalculate == 0) { | ||
return aggregateResultList; | ||
|
||
private class GroupByExecutor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better name it GroupByTask
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no , i like executor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
executor or task are all fine to me
QueryDataSource queryDataSource = QueryResourceManager.getInstance() | ||
.getQueryDataSource(path, context, timeFilter); | ||
// update filter by TTL | ||
timeFilter = queryDataSource.updateFilterUsingTTL(timeFilter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to construct these two, if pathExecutors already has the path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Thank you very much for your reminding. I will continue to study why is it slow |
* del callable task * move querysource to GroupByExecutor * skip chunk
…imize_series_reader
...rc/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByWithoutValueFilterDataSet.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByWithoutValueFilterDataSet.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesReader.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesReader.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesReader.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/iotdb/db/integration/IoTDBCloseIT.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/iotdb/db/integration/IoTDBEngineTimeGeneratorIT.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/iotdb/db/integration/IoTDBLargeDataIT.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java
Outdated
Show resolved
Hide resolved
…eIT.java Co-Authored-By: Zesong Sun <szs19@mails.tsinghua.edu.cn>
…imize_series_reader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some places still needs to be fixed
} | ||
} catch (QueryProcessException e) { | ||
logger.error("GroupByWithoutValueFilterDataSet execute has error,{}", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to use {},just
logger.error("GroupByWithoutValueFilterDataSet execute has error ", e);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -85,7 +86,7 @@ private static void insertData() | |||
.getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root"); | |||
Statement statement = connection.createStatement()) { | |||
|
|||
for (String sql : Constant.create_sql) { | |||
for (String sql : org.apache.iotdb.db.constant.TestConstant.create_sql) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (String sql : org.apache.iotdb.db.constant.TestConstant.create_sql) { | |
for (String sql : TestConstant.create_sql) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -138,7 +139,7 @@ public void selectAllTest() throws ClassNotFoundException { | |||
int cnt1 = 0; | |||
while (resultSet1.next() && cnt1 < 5) { | |||
StringBuilder builder = new StringBuilder(); | |||
builder.append(resultSet1.getString(Constant.TIMESTAMP_STR)) | |||
builder.append(resultSet1.getString(org.apache.iotdb.db.constant.TestConstant.TIMESTAMP_STR)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
builder.append(resultSet1.getString(org.apache.iotdb.db.constant.TestConstant.TIMESTAMP_STR)) | |
builder.append(resultSet1.getString(TestConstant.TIMESTAMP_STR)) |
@@ -154,7 +155,7 @@ public void selectAllTest() throws ClassNotFoundException { | |||
int cnt2 = 0; | |||
while (resultSet2.next()) { | |||
StringBuilder builder = new StringBuilder(); | |||
builder.append(resultSet2.getString(Constant.TIMESTAMP_STR)) | |||
builder.append(resultSet2.getString(org.apache.iotdb.db.constant.TestConstant.TIMESTAMP_STR)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
builder.append(resultSet2.getString(org.apache.iotdb.db.constant.TestConstant.TIMESTAMP_STR)) | |
builder.append(resultSet2.getString(TestConstant.TIMESTAMP_STR)) |
private static String filePath1 = org.apache.iotdb.db.constant.TestConstant.BASE_OUTPUT_PATH.concat("watermarked_query_result.csv"); | ||
private static String filePath2 = org.apache.iotdb.db.constant.TestConstant.BASE_OUTPUT_PATH.concat("notWatermarked_query_result.csv"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static String filePath1 = org.apache.iotdb.db.constant.TestConstant.BASE_OUTPUT_PATH.concat("watermarked_query_result.csv"); | |
private static String filePath2 = org.apache.iotdb.db.constant.TestConstant.BASE_OUTPUT_PATH.concat("notWatermarked_query_result.csv"); | |
private static String filePath1 = TestConstant.BASE_OUTPUT_PATH.concat("watermarked_query_result.csv"); | |
private static String filePath2 = TestConstant.BASE_OUTPUT_PATH.concat("notWatermarked_query_result.csv"); |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
remove hasOverlappedPage & isPageOverlapped methods in IAggregateReader
optimize logic in series reader