You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tajo.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/05/17 23:45:13 UTC

[jira] [Commented] (TAJO-2103) JdbcMetadataProviderBase need to differentiate between database name in DBMS and database name in Tajo.

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

ASF GitHub Bot commented on TAJO-2103:
--------------------------------------

Github user hyunsik commented on the pull request:

    https://github.com/apache/tajo/pull/990#issuecomment-219886726
  
    Could you explain the purpose of this patch? 
    
    See setDatabase() in the below. The variable 'database' already contains 'mapped_dbname'.
    ```
    public JdbcTablespace(String name, URI uri, JSONObject config) {
        super(name, uri, config);
        setDatabase();
        setJdbcProperties();
      }
    
      private void setDatabase() {
        if (config.containsKey(CONFIG_KEY_MAPPED_DATABASE)) {
          database = this.config.getAsString(CONFIG_KEY_MAPPED_DATABASE);
        } else {
          database = ConnectionInfo.fromURI(uri).database();
        }
      }
    ```
    
    But, your patch changes as the below. It's a duplicate.
    ```
    public MetadataProvider getMetadataProvider() {
       return new PgSQLMetadataProvider(this, database, ConnectionInfo.fromURI(uri).database());
    }
    ```


> JdbcMetadataProviderBase need to differentiate between database name in DBMS and database name in Tajo.
> -------------------------------------------------------------------------------------------------------
>
>                 Key: TAJO-2103
>                 URL: https://issues.apache.org/jira/browse/TAJO-2103
>             Project: Tajo
>          Issue Type: Bug
>          Components: JDBC Storage
>            Reporter: Jaehwa Jung
>            Assignee: Jaehwa Jung
>
> When using {{mapped_database}} configuration in JDBCTablespace, users can map actual database name in RDBMS to virtual database name in Tajo. If users set tajo-storage.json as follow:
> {code:xml}
> {
>   "spaces": {
>     "pgsql_db1": {
>       "uri": "jdbc:postgresql://hostname:port/db1",
>       "configs": {
>         "mapped_database": "tajo_db1",
>         "connection_properties": {
>           "user":     "tajo",
>           "password": "xxxx"
>         }
>       }
>     }
>   }
> }
> {code}
> In above example, the database db1 in PostgreSQL will be mapped the database tajo_db1 in Tajo. And users can write select statement, for example, "SELECT * from tajo_db1.Xyz".
> But actually, if mapped database name is not equals to actual database name, users won't be able to get table in Tajo because {{JdbcMetadataProviderBase}} always get table with mapped database name. The provider need to differentiate between database name in DBMS and database name in Tajo. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)