[ 
https://issues.apache.org/jira/browse/HIVE-790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12748278#action_12748278
 ] 

Zheng Shao commented on HIVE-790:
---------------------------------

The code above does not allow simple overriding of the close function.
The following code does.  It mimics the structure of initialize(...).

{code}
public void close(boolean abort) {
  // only close when all parents are closed.
  if (!allParentsAreClosed()) {
    return;
  }

  this.state = CLOSE;
  // Close this operator
  this.closeOp(boolean abort);

  // Close all children
  for (int i=0; i<children.size(); i++) {
    children.get(i).close(abort);
  }
}

protected void closeOp(boolean abort) {
  // Different operator will have different states.
}
{code}


I am also OK if you do want to add a new state, but please rename the states to 
something like "CLOSING, CLOSED", instead of "FINISHED", "CLOSE" which are 
harder to understand.


> race condition related to ScriptOperator + UnionOperator
> --------------------------------------------------------
>
>                 Key: HIVE-790
>                 URL: https://issues.apache.org/jira/browse/HIVE-790
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Zheng Shao
>            Assignee: Ning Zhang
>         Attachments: Hive-790.patch, Hive-790_2.patch
>
>
> ScriptOperator uses a second thread to output the rows to the children 
> operators. In a corner case which contains a union, 2 threads might be 
> outputting data into the same operator hierarchy and caused race conditions.
> {code}
> CREATE TABLE tablea (cola STRING);
> SELECT *
> FROM (
>     SELECT TRANSFORM(cola)
>     USING 'cat'
>     AS cola
>     FROM tablea
>   UNION ALL
>     SELECT cola as cola
>     FROM tablea
> ) a;
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to