Github user jihoonson commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/13#discussion_r13899528
  
    --- Diff: 
tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowSpec.java ---
    @@ -79,17 +76,47 @@ public WindowFrame getWindowFrame() {
         return windowFrame;
       }
     
    +  public Object clone() throws CloneNotSupportedException {
    +    WindowSpec windowSpec = (WindowSpec) super.clone();
    +    windowSpec.windowName = windowName;
    +    if (hasPartitionBy()) {
    +      windowSpec.partitionKeys = new Expr[windowSpec.partitionKeys.length];
    +      for (int i = 0; i < partitionKeys.length; i++) {
    +        windowSpec.partitionKeys[i] = (Expr) partitionKeys[i].clone();
    +      }
    +    }
    +    if (hasOrderBy()) {
    +      windowSpec.sortSpecs = new Sort.SortSpec[sortSpecs.length];
    +      for (int i = 0; i < sortSpecs.length; i++) {
    +        windowSpec.sortSpecs[i] = (Sort.SortSpec) sortSpecs[i].clone();
    +      }
    +    }
    +    if (hasWindowFrame()) {
    +      windowSpec.windowFrame = (WindowFrame) windowFrame.clone();
    +    }
    +    return windowSpec;
    +  }
    +
       @Override
       public int hashCode() {
         return Objects.hashCode(windowName, partitionKeys, sortSpecs);
       }
     
       @Override
    -  boolean equalsTo(Expr expr) {
    -    WindowSpecExpr another = (WindowSpecExpr) expr;
    -    return TUtil.checkEquals(windowName, another.windowName) &&
    -        TUtil.checkEquals(partitionKeys, another.partitionKeys) &&
    -        TUtil.checkEquals(sortSpecs, another.sortSpecs);
    +  public boolean equals(Object obj) {
    +    if (obj == this) {
    +      return true;
    +    }
    +
    +    if (obj instanceof WindowSpec) {
    +      WindowSpec another = (WindowSpec) obj;
    +      return TUtil.checkEquals(windowName, another.windowName) &&
    +          TUtil.checkEquals(partitionKeys, another.partitionKeys) &&
    +          TUtil.checkEquals(sortSpecs, another.sortSpecs);
    --- End diff --
    
    windowFrame also should be compared.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to