You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by anoopsharma00 <gi...@git.apache.org> on 2017/02/24 22:39:42 UTC

[GitHub] incubator-trafodion pull request #979: TRAFODION-2498 Add support to run hiv...

GitHub user anoopsharma00 opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/979

    TRAFODION-2498 Add support to run hive stmts from traf interface

    Syntax:
      process hive statement '<string>';
    
      <string>: hive statement starting with create/drop/alter/truncate.
          These are the only stmts currently supported.
      Ex:
       >>process hive statement 'create database trafsch';
       will create hive database 'trafsch'
    
       >>process hive statement 'create table trafsch.t (a int)';
       will create hive table 't' in hive schema 'trafsch'.
    
      'process hive statment ..' could be issued from any traf interface
       (sqlci/trafci/jdbc...)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/anoopsharma00/incubator-trafodion ansharma_hivesql_br

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/979.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #979
    
----
commit e9389fa010c031669e97385f264d758043b9e4ac
Author: Anoop Sharma <an...@esgyn.com>
Date:   2017-02-24T22:34:09Z

    TRAFODION-2498 Add support to run hive stmts from traf interface
    
    Syntax:
      process hive statement '<string>';
    
      <string>: hive statement starting with create/drop/alter/truncate.
          These are the only stmts currently supported.
      Ex:
       >>process hive statement 'create database trafsch';
       will create hive database 'trafsch'
    
       >>process hive statement 'create table trafsch.t (a int)';
       will create hive table 't' in hive schema 'trafsch'.
    
      'process hive statment ..' could be issued from any traf interface
       (sqlci/trafci/jdbc...)

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request #979: TRAFODION-2498 Add support to run hiv...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-trafodion/pull/979


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request #979: TRAFODION-2498 Add support to run hiv...

Posted by robertamarton <gi...@git.apache.org>.
Github user robertamarton commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/979#discussion_r103294768
  
    --- Diff: core/sql/executor/ExExeUtilMisc.cpp ---
    @@ -2509,3 +2509,128 @@ ExExeUtilHiveTruncatePrivateState::ExExeUtilHiveTruncatePrivateState()
     ExExeUtilHiveTruncatePrivateState::~ExExeUtilHiveTruncatePrivateState()
     {
     };
    +
    +////////////////////////////////////////////////////////////////
    +// Constructor for class ExExeUtilHiveQueryTdb
    +///////////////////////////////////////////////////////////////
    +ex_tcb * ExExeUtilHiveQueryTdb::build(ex_globals * glob)
    +{
    +  ExExeUtilTcb * exe_util_tcb;
    +
    +  exe_util_tcb = new(glob->getSpace()) ExExeUtilHiveQueryTcb(*this, glob);
    +  exe_util_tcb->registerSubtasks();
    +
    +  return (exe_util_tcb);
    +}
    +
    +
    +////////////////////////////////////////////////////////////////
    +// Constructor for class ExExeUtilHiveQueryTcb
    +///////////////////////////////////////////////////////////////
    +ExExeUtilHiveQueryTcb::ExExeUtilHiveQueryTcb(
    +     const ComTdbExeUtilHiveQuery & exe_util_tdb,
    +     ex_globals * glob)
    +     : ExExeUtilTcb( exe_util_tdb, NULL, glob)
    +{
    +  // Allocate the private state in each entry of the down queue
    +  qparent_.down->allocatePstate(this);
    +
    +  step_ = INITIAL_;
    +}
    +
    +ExExeUtilHiveQueryTcb::~ExExeUtilHiveQueryTcb()
    +{
    +}
    +
    +//////////////////////////////////////////////////////
    +// work() for ExExeUtilHiveQueryTsb
    +//////////////////////////////////////////////////////
    +short ExExeUtilHiveQueryTcb::work()
    +{
    +  short rc = 0;
    +  Lng32 cliRC = 0;
    +
    +  // if no parent request, return
    +  if (qparent_.down->isEmpty())
    +    return WORK_OK;
    +
    +  // if no room in up queue, won't be able to return data/status.
    +  // Come back later.
    +  if (qparent_.up->isFull())
    +    return WORK_OK;
    +
    +  ex_queue_entry * pentry_down = qparent_.down->getHeadEntry();
    +  ExExeUtilPrivateState & pstate = *((ExExeUtilPrivateState*) pentry_down->pstate);
    +
    +  while (1)
    +    {
    +      switch (step_)
    +        {
    +        case INITIAL_:
    +          {
    +            step_ = PROCESS_QUERY_;
    +          }
    +          break;
    +          
    --- End diff --
    
    If authorization is enabled, need a check to make sure that the current user has the authority to manage hive tables.   Need to determine if the currently connected user has admin privileges in Hive.  If not, should not allow the operation.  If this is too difficult, then just prevent create, alter, and drops of Hive tables when authorization is enabled.
    When Sentry is enabled, then return an error - Sentry enabled hive tables are only managed by Hive.  We could, in the future, call Sentry to see if the currently connected user has admin privileges and allow these operations.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request #979: TRAFODION-2498 Add support to run hiv...

Posted by zellerh <gi...@git.apache.org>.
Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/979#discussion_r103283297
  
    --- Diff: core/sql/regress/seabase/EXPECTED031 ---
    @@ -557,6 +558,14 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
     
     --- SQL operation complete.
     >>
    +>>-- should return error.
    +>>process hive statement 'insert into t values (1)';
    --- End diff --
    
    Just curious why we don't support insert?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---