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

Stamatis Zampetakis commented on HIVE-28019:
--------------------------------------------

Thanks for elaborating more and sharing your perspective [~rameshkumar].

The PREHOOK and POSTHOOK messages are emitted by the PreExecutePrinter and 
PostExecutePrinter hooks and by looking at the git history I get the impression 
that these were added only for testing purposes. I guess this hooks are not 
(and were not meant to be) used by end users. In principle, we could do any 
kind of change there that could facilitate testing without worrying too much 
about backwards compatibility. 

The {{commandType}} became part of the pre/post output in HIVE-854 but the 
respective JIRA and history do not have enough info on why this was done. Given 
that {{commandType}} was added in {{SessionState}} as part of HIVE-854, I 
assume that the intention of printing it in qtests was to verify that it is set 
correctly, and it reflects the authorization implications of each statement. In 
that sense, if we now change the type there to be EXPLAIN then in terms of 
testing we lose the information of what authorization mode applies to the 
statement under test.

Moreover, in terms of testing the {{PREHOOK: query:}} entry shows clearly if we 
are dealing with an EXPLAIN query (or not) so from my perspective changing also 
the type to EXPLAIN will lead to reduced test coverage so the proposed changed 
does not look as an improvement.

The same reasoning more or less applies to the HiveProtoLoggingHook but this 
class is something that is meant to be used in production so changes here will 
have more impact to the end-users.

In both cases, I would suggest to keep the type field in the output unchanged. 
If we need to distinguish if a query is an EXPLAIN this could be done by an 
additional field but I also feel that this is not strongly required since it 
can be easily inferred via a regular expression in the output.

As I wrote previously, the appropriate content for the type field in the hooks 
is a bit subjective so the best way to move forward is to gather opinions from 
more people. I am perfectly fine to follow the majority if others feels that 
the query type in the aforementioned hooks should change.


> Fix query type information in proto files for load and explain queries
> ----------------------------------------------------------------------
>
>                 Key: HIVE-28019
>                 URL: https://issues.apache.org/jira/browse/HIVE-28019
>             Project: Hive
>          Issue Type: Task
>          Components: HiveServer2
>            Reporter: Ramesh Kumar Thangarajan
>            Assignee: Ramesh Kumar Thangarajan
>            Priority: Major
>              Labels: pull-request-available
>
> Certain query types like LOAD, export, import and explain queries did not 
> produce the right Hive operation type



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to