[IOTDB-4335] Implement PathPatternTree to support trigger and delete#7270
[IOTDB-4335] Implement PathPatternTree to support trigger and delete#7270qiaojialin merged 16 commits intoapache:masterfrom
Conversation
| private final String name; | ||
| private final Map<String, PathPatternNode> children; | ||
| private final Map<String, PathPatternNode<V>> children; | ||
| private Set<V> valueSet; |
There was a problem hiding this comment.
It seems that you forgot about serializing this field.
There was a problem hiding this comment.
And equalsWIth may also take it into account
There was a problem hiding this comment.
It seems that you forgot about serializing this field.
Nope. I reuse the data structure of the nodes in PathPatternTree here, mounting an additional valueSet. Serialization methods are only used in PathPatternTree, and the serialization information is used as a ByteBuffer in RPC. valueSet is always empty in PathPatternTree, so I did not serialize it to save network cost .
And equalsWIth may also take it into account
I've added the valueSet comparison in equalsWith
There was a problem hiding this comment.
I think it's better to do the serialization in PathPatternNode, because PatternTreeMap also need to be serialized and tranferred by rpc.
It's fine to occupy four more bytes(int size) for one node to indicate the valueSet's size, one packet in network will be like 1KB or something else, four more bytes per node will not hurt the perfermance.
|
|
||
| private void searchDevicePattern( | ||
| PathPatternNode curNode, List<String> nodes, Set<String> results) { | ||
| PathPatternNode<Void> curNode, List<String> nodes, Set<String> results) { |
There was a problem hiding this comment.
What if root.sg.d1.**, it seems that this method won't put it into result.
There was a problem hiding this comment.
I didn't change the semantics of this interface. It originally seemed to assume that the device of root.sg1.d1.** is root.sg1.d1.**. I didn't know if the modification will have an impact on the upper layer application
There was a problem hiding this comment.
You can discuss with @liuminghui233 and @MarcosZyk about it, I think it's a bug in previous implementation, and can be fixed by the way in this pr.
There was a problem hiding this comment.
The device of root.sg1.d1.** may be root.sg1.d1 and root.sg1.d1.**.
| String[] pathNodes, | ||
| int pos, | ||
| List<V> resultList, | ||
| boolean fromMultiWildCard) { |
There was a problem hiding this comment.
fromMultiWildCard means there may exist two consecutive ** in PatternTreeMap?
I think this case should be deal with or avoided at the very beginning like during constructing this PatternTreeMap.
There was a problem hiding this comment.
fromMultiWildCard is unnecessary. I will remove it later.
| private BiConsumer<V, Set<V>> appendFunction; | ||
| private BiConsumer<V, Set<V>> deleteFunction; |
There was a problem hiding this comment.
| private BiConsumer<V, Set<V>> appendFunction; | |
| private BiConsumer<V, Set<V>> deleteFunction; | |
| private final BiConsumer<V, Set<V>> appendFunction; | |
| private final BiConsumer<V, Set<V>> deleteFunction; |
Description
PatternTreeMapto support trigger and deletePatternTreeMapTestPathPatternTreedirectly fromPatternTreeMapFactoryPathPatternTreeto node-commons module