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
Conversation
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.
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.
client/src/main/java/org/apache/iotdb/client/AbstractClient.java
Outdated
Show resolved
Hide resolved
client/src/main/java/org/apache/iotdb/client/AbstractClient.java
Outdated
Show resolved
Hide resolved
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); |
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.
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()) { |
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.
format
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.
format what?
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.
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, |
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.
add some javadoc
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
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()); |
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.
There is a null pointer exception, I can not print result in my client. Try to fix it...
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.
My test case is: SET STORAGE GROUP TO root.turbine; |
Co-Authored-By: Jialin Qiao <qjl16@mails.tsinghua.edu.cn>
Co-Authored-By: Jialin Qiao <qjl16@mails.tsinghua.edu.cn>
…otdb into client_chache
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
cache results in the client and makes the display look nice.
https://issues.apache.org/jira/projects/IOTDB/issues/IOTDB-405