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

Bill Graham commented on HIVE-862:
----------------------------------

I'll take this JIRA. To recap what was discussed on the list and what Edward 
and I discussed off-line, here's the proposed approach. Please comment if you 
think I should proceed differently:

1. We make a non-backward compatible change to the {{CommandProcessor}} 
interface, changing it's sole method from this:

{noformat}
  public int run(String command);
{noformat}

to this:

{noformat}
  public CommandProcessorResponse run(String command);
{noformat}

2. We create a new {{CommandProcessorResponse}} class that looks like the 
current {{Driver.DriverResponse}} class. It's a pojo with the following fields:
- int responseCode
- String errorMessage
- String SQLState

Note: my rational for removing {{DriverResponse}} in lieu of 
{{CommandProcessorResponse}} is to bind the response class name more closely 
with the common interface that uses it (i.e., {{CommandProcessor}}). If we 
instead used {{DriverResponse}} that would make sense for the {{Driver}} class, 
but not so much for the command processors.

3. {{Driver.DriverResponse}} will be removed, and {{Driver.run(command)}} will 
return an instance of {{CommandProcessorResponse}} instead. The {{runCommand}} 
method will be removed and {{HiveServer}} usage will be refactored to use 
{{Driver.run}}.

4. The 5 {{CommandProcessors}} that implement the {{run}} method will change to 
return a {{CommandProcessorResponse}} object. Callers of these classes will 
change to get the response status from the the {{CommandProcessorResponse}} 
object.



> CommandProcessor should return DriverResponse
> ---------------------------------------------
>
>                 Key: HIVE-862
>                 URL: https://issues.apache.org/jira/browse/HIVE-862
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: Query Processor
>            Reporter: Edward Capriolo
>            Assignee: Bill Graham
>
> Since Driver now returns DriverResponse CommandProcessor should return a 
> similar object.
> {noformat}
> For reference here is how i want to use this:
> Currently:
> HWISessionItem.java
> private List<Integer> queryRet;
> private List<String>  queries;
> public void runQuery() {
>   //for each query in queries
>    if (instanceof driver) {
>       //other stuff here
>      queryRet.add( qp.run(cmd) );
>    } else {
>       queryRet.add(proc.run(cmd_1)  );
>    }
> }
> So I would like to refactor and use DriverResponse.
> private List<DriverResponse> queryRet;
> private List<String>  queries;
> public void runQuery() {
>   //for each query in queries
>    
>    if (instanceof driver) {
>       //other stuff here
>      queryRet.add( qp.run(cmd) );  //<--- this is fine
>    } else {
>       queryRet.add(proc.run(cmd_1)  ); <--this returns an int.
>    }
> }
> {noformat}

-- 
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