Uploaded image for project: 'Tajo (Retired)'
  1. Tajo (Retired)
  2. TAJO-1512

Fix various Expr cloning bugs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 0.10.0
    • 0.11.0, 0.10.1
    • None
    • None

    Description

      When `Expr.clone()` is called, various errors(NPE/TypeCastingError/recursive/functional error) are occurs. This issue should be solved for others issues reusing `Expr`. Please refer the following code.

      • NPE case (Aggregation.java, UnaryOperator.java, CreateTable, AlterTable)
        -    aggregation.namedExprs = new NamedExpr[namedExprs.length];
        -    for (int i = 0; i < namedExprs.length; i++) {
        -      aggregation.namedExprs[i] = (NamedExpr) namedExprs[i].clone();
        +    if (namedExprs != null) {
        +      aggregation.namedExprs = new NamedExpr[namedExprs.length];
        +      for (int i = 0; i < namedExprs.length; i++) {
        +        aggregation.namedExprs[i] = (NamedExpr) namedExprs[i].clone();
        +      }
             }
         
        -    aggregation.groups = new GroupElement[groups.length];
        -    for (int i = 0; i < groups.length; i++) {
        -      aggregation.groups[i] = (GroupElement) groups[i].clone();
        +    if (groups != null) {
        +      aggregation.groups = new GroupElement[groups.length];
        +      for (int i = 0; i < groups.length; i++) {
        +        aggregation.groups[i] = (GroupElement) groups[i].clone();
        +      }
             }
        
      -    alter.addNewColumn = (ColumnDefinition) addNewColumn.clone();
      +    if (addNewColumn != null) {
      +      alter.addNewColumn = (ColumnDefinition) addNewColumn.clone();
      +    }
      
      • Recursive (BetweenPredicate.java)
        -    between.begin = (Expr) between.clone();
        +    between.begin = (Expr) begin.clone();
        
      • Type Casting Error (ValueListExpr.java)
        -      valueListExpr.values = (Expr[]) values[i].clone();
        +      valueListExpr.values[i] = (Expr) values[i].clone();
        
      • Functional Error (CreateTable.java)
        -      if (range.specifiers != null) {
        +      if (specifiers != null) {
        

      Attachments

        1. TAJO-1512.Hyun.150404.0.patch
          10 kB
          Dongjoon Hyun
        2. TAJO-1512.Hyun.150403.0.patch
          3 kB
          Dongjoon Hyun

        Issue Links

          Activity

            People

              dongjoon Dongjoon Hyun
              dongjoon Dongjoon Hyun
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: