Skip to content
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-405] cache results in the client and makes the display look nice. #782

Merged
merged 8 commits into from Feb 10, 2020

Conversation

Genius-pig
Copy link
Contributor

cache results in the client and makes the display look nice.
https://issues.apache.org/jira/projects/IOTDB/issues/IOTDB-405

Copy link
Member

@qiaojialin qiaojialin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this function be added to our CLI?

If the result set has too many lines. Each time CLI prints 1000 lines and wait for the command of the user, if the user enters an "ENTER", the CLI prints another 1000 line. If the user enters a "q", the CLI stop to print the Result and wait for the next command.

boolean printTimestamp = !((IoTDBQueryResultSet) resultSet).isIgnoreTimeStamp();
List<List<String>> lists = new ArrayList<>(columnLength);
for(int i = 1; i <= columnLength; i++) {
List<String> list = new ArrayList<>(30);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this 30 to a field of this class

tmp = resultSet.getString(i);
}
lists.get(i-1).add(tmp);
if(maxSizeList.get(i-1) < tmp.length()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format what?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, nothing

}
long costTime = System.currentTimeMillis() - startTime;
println(String.format("It costs %.3fs", costTime / 1000.0));
}

private static List<List<String>> cacheResult(ResultSet resultSet, List<Integer> maxSizeList,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some javadoc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

List<Integer> maxSizeList = new ArrayList<>(columnLength);
List<List<String>> lists = cacheResult(resultSet, maxSizeList, columnLength,
resultSetMetaData, zoneId);
output(lists, maxSizeList);
}
}
} catch (Exception e) {
println("Msg: " + e.getMessage());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a null pointer exception, I can not print result in my client. Try to fix it...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@qiaojialin
Copy link
Member

My test case is:

SET STORAGE GROUP TO root.turbine;
create timeseries root.turbine.d1.s0 with datatype=DOUBLE, encoding=GORILLA, compression=SNAPPY;
create timeseries root.turbine.d2.s0 with datatype=DOUBLE, encoding=GORILLA, compression=SNAPPY;
insert into root.turbine.d1(time,s0) values(4,4);
select * from root;

@sonarcloud
Copy link

sonarcloud bot commented Feb 10, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@qiaojialin qiaojialin merged commit c400bf1 into master Feb 10, 2020
@qiaojialin qiaojialin deleted the client_chache branch February 10, 2020 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants