guangxuCheng commented on a change in pull request #1477:
URL: https://github.com/apache/kylin/pull/1477#discussion_r523370528
##########
File path:
core-dictionary/src/main/java/org/apache/kylin/dict/TrieDictionaryBuilder.java
##########
@@ -108,11 +112,13 @@ private void addValueR(Node node, byte[] value, int
start) {
// if value fully matched within the current node
if (i == n) {
// if equals to current node, just mark end of value
- node.isEndOfValue = true;
+ if (!isSplitValue) {
+ node.isEndOfValue = true;
+ }
} else {
// otherwise, split the current node into two
Node c = new Node(BytesUtil.subarray(node.part, i, n),
node.isEndOfValue, node.children);
- node.reset(BytesUtil.subarray(node.part, 0, i), true);
+ node.reset(BytesUtil.subarray(node.part, 0, i), isSplitValue?
false : true);
Review comment:
`isSplitValue? false : true` can be simplified to `!isSplitValue`
##########
File path:
core-dictionary/src/main/java/org/apache/kylin/dict/TrieDictionaryBuilder.java
##########
@@ -121,7 +127,7 @@ private void addValueR(Node node, byte[] value, int start) {
// if partially matched the current, split the current node, add the
new value, make a 3-way
if (i < n) {
Node c1 = new Node(BytesUtil.subarray(node.part, i, n),
node.isEndOfValue, node.children);
- Node c2 = new Node(BytesUtil.subarray(value, j, nn), true);
+ Node c2 = new Node(BytesUtil.subarray(value, j, nn), isSplitValue?
false : true);
Review comment:
`isSplitValue? false : true` can be simplified to `!isSplitValue`
##########
File path:
core-dictionary/src/main/java/org/apache/kylin/dict/TrieDictionaryBuilder.java
##########
@@ -152,10 +158,10 @@ else if (comp > 0)
}
if (found) {
// found a child node matching the first byte, continue in that
child
- addValueR(node.children.get(mid), value, j);
+ addValueR(node.children.get(mid), value, j, isSplitValue);
} else {
// otherwise, make the value a new child
- Node c = new Node(BytesUtil.subarray(value, j, nn), true);
+ Node c = new Node(BytesUtil.subarray(value, j, nn), isSplitValue ?
false : true);
Review comment:
`isSplitValue? false : true` can be simplified to `!isSplitValue`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]