You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by utf7 <gi...@git.apache.org> on 2016/07/20 08:56:19 UTC

[GitHub] hive pull request #90: fix the import database_name.table_name from path

GitHub user utf7 opened a pull request:

    https://github.com/apache/hive/pull/90

    fix the import database_name.table_name from path

    detail :
    use test;
    create table a(id int,name string);
    export table a to '/tmp/a';
    drop table a;
    import table test.a from '/tmp/a';
    hive> import table test.a from '/tmp/a';
    Failed with exception Invalid table name test.test.a
    FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask
    
    when use import database_name.table_name from ,
    the tblDesc.getTableName() return database_name.table_name ,not table_name
    Table table = new Table(dbname,database_name.table_name) will return the table's name is dbname.database_name.table_name
    correct table name should be test.a,not   test.test.a
    
    we can fix this:
      String[] dbTableName =Utilities.getDbTableName(dbname,tblDesc.getTableName());
       Table table = new Table(dbTableName[0], dbTableName[1]);

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

    $ git pull https://github.com/utf7/hive patch-2

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

    https://github.com/apache/hive/pull/90.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 #90
    
----
commit 3862872280c785e81a2b5d7bc0fee99d23b3de98
Author: utf7 <yc...@gmail.com>
Date:   2016-07-20T08:55:52Z

    fix the import database_name.table_name from 
    
    detail :
    use test;
    create table a(id int,name string);
    export table a to '/tmp/a';
    drop table a;
    import table test.a from '/tmp/a';
    hive> import table test.a from '/tmp/a';
    Failed with exception Invalid table name test.test.a
    FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask
    
    when use import database_name.table_name from ,
    the tblDesc.getTableName() return database_name.table_name ,not table_name
    Table table = new Table(dbname,database_name.table_name) will return the table's name is dbname.database_name.table_name
    correct table name should be test.a,not   test.test.a
    
    we can fix this:
      String[] dbTableName =Utilities.getDbTableName(dbname,tblDesc.getTableName());
       Table table = new Table(dbTableName[0], dbTableName[1]);

----


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