-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[IOTDB-239] Add interface for showing devices #421
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
Conversation
| /** | ||
| * Get all devices in current Metadata Tree. | ||
| * | ||
| * @return a list contains all distinct storage groups |
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.
| * @return a list contains all distinct storage groups | |
| * @return a list contains all distinct devices |
| * @return a list contains all distinct storage groups | ||
| */ | ||
| HashSet<String> getAllDevices() { | ||
| return new HashSet<>(getNodesList("3")); |
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 not using an int?
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.
getNodesList method is implemented before and I just call it here, should I change the param type to int? (which I think is better as well)
| } | ||
| case "SHOW_DEVICES": | ||
| Set<String> devices = getAllDevices(); | ||
| resp.setShowDevices(devices); |
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.
| resp.setShowDevices(devices); | |
| resp.setDevices(devices); |
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.
Here I also keep consistent with SHOW TIMESERIES and SHOW STORAGE GROUP interface, in which they uses setShowTimeseriesList and setShowStorageGroups... Should I change all of these interfaces? (and I also think your suggestion is better...)
| } | ||
| Assert.assertEquals(resultStr.toString(), standard); | ||
| } catch (SQLException e) { | ||
| System.out.println(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.
Simply print out the exception may bury the error and the TestCase will be regarded as PASSED. It's better to replace it with e.printStackTrace(); fail(e.getMessage());.
| return mtree.getAllStorageGroup(); | ||
| } | ||
|
|
||
| HashSet<String> getAllDevices() { |
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 note that all its callers Interprete the returned value as Set but not HashSet.
|
Hi @qiaojialin @kr11 , Thanks a lot for your detailed review! I have updated codes as you suggested. |
Create an interface for showing all the devices.
USAGE:
SHOW DEVICES.