You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by kaspersorensen <gi...@git.apache.org> on 2015/07/12 11:12:52 UTC

[GitHub] metamodel pull request: Apache Hive support

GitHub user kaspersorensen opened a pull request:

    https://github.com/apache/metamodel/pull/31

    Apache Hive support

    This PR adds support for Apache Hive via the existing JDBC module.
    
    To do this I had to introduce a new "isTransactional()" flag on IQueryRewriter since commit calls on Hive is not supported.
    
    I also did some cleanup of Hadoop dependencies because I saw Hadoop version conflicts inbetween the "hadoop", "hbase" and now the "jdbc" modules. This caused the Hive connection to fail with class loading issues.

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

    $ git pull https://github.com/kaspersorensen/metamodel feature/hive-support

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

    https://github.com/apache/metamodel/pull/31.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 #31
    
----
commit 007ef51b14ce006a7a088b3c3223e5b855b7be8b
Author: Kasper Sørensen <i....@gmail.com>
Date:   2015-07-12T09:08:39Z

    Added support for Apache Hive via the MetaModel JDBC module

commit e454e133ee0e77b95eaf1ed6b2c92da8a5fdbbeb
Author: Kasper Sørensen <i....@gmail.com>
Date:   2015-07-12T09:10:32Z

    Added missing apache license header

----


---
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] metamodel pull request: Apache Hive support

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

    https://github.com/apache/metamodel/pull/31#discussion_r34438501
  
    --- Diff: jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcUpdateCallback.java ---
    @@ -63,10 +63,12 @@ public void executePreparedStatement(PreparedStatement preparedStatement, boolea
         protected final Connection getConnection() {
             if (_connection == null) {
                 _connection = getDataContext().getConnection();
    -            try {
    -                _connection.setAutoCommit(false);
    -            } catch (SQLException e) {
    -                throw JdbcUtils.wrapException(e, "disable auto-commit");
    +            if (_dataContext.getQueryRewriter().isTransactional()) {
    +                try {
    --- End diff --
    
    With this change we are now setting the autocommit to false only when the isTransactional condition is true, is this what we want?


---
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] metamodel pull request: Apache Hive support

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

    https://github.com/apache/metamodel/pull/31#discussion_r34438977
  
    --- Diff: jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcUpdateCallback.java ---
    @@ -63,10 +63,12 @@ public void executePreparedStatement(PreparedStatement preparedStatement, boolea
         protected final Connection getConnection() {
             if (_connection == null) {
                 _connection = getDataContext().getConnection();
    -            try {
    -                _connection.setAutoCommit(false);
    -            } catch (SQLException e) {
    -                throw JdbcUtils.wrapException(e, "disable auto-commit");
    +            if (_dataContext.getQueryRewriter().isTransactional()) {
    +                try {
    --- End diff --
    
    At least it's what I meant :-) We only have Hive in our portfolio currently that is a "non transactional" JDBC driver. In the case of Hive it is not allowed to call these methods.
    
    Do you have an underlying concern with this specifically?


---
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] metamodel pull request: Apache Hive support

Posted by albertostratio <gi...@git.apache.org>.
Github user albertostratio commented on the pull request:

    https://github.com/apache/metamodel/pull/31#issuecomment-120842871
  
    Thank you @kaspersorensen 
    
    These changes LGTM


---
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] metamodel pull request: Apache Hive support

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

    https://github.com/apache/metamodel/pull/31


---
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] metamodel pull request: Apache Hive support

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

    https://github.com/apache/metamodel/pull/31#discussion_r34438477
  
    --- Diff: jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcUpdateCallback.java ---
    @@ -63,10 +63,12 @@ public void executePreparedStatement(PreparedStatement preparedStatement, boolea
         protected final Connection getConnection() {
             if (_connection == null) {
                 _connection = getDataContext().getConnection();
    -            try {
    -                _connection.setAutoCommit(false);
    -            } catch (SQLException e) {
    -                throw JdbcUtils.wrapException(e, "disable auto-commit");
    +            if (_dataContext.getQueryRewriter().isTransactional()) {
    +                try {
    +                    _connection.setAutoCommit(false);
    +                } catch (SQLException e) {
    --- End diff --
    
    With this change we are now setting the autocommit to false only when the isTransactional condition is true, is this what we want?


---
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] metamodel pull request: Apache Hive support

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

    https://github.com/apache/metamodel/pull/31#discussion_r34438993
  
    --- Diff: jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcUpdateCallback.java ---
    @@ -78,18 +80,20 @@ public final void close(boolean success) {
                     closePreparedStatement(_preparedStatement);
                 }
     
    -            try {
    -                commitOrRollback(success);
    +            if (_dataContext.getQueryRewriter().isTransactional()) {
    +                try {
    --- End diff --
    
    Same comment as above :)


---
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] metamodel pull request: Apache Hive support

Posted by albertostratio <gi...@git.apache.org>.
Github user albertostratio commented on the pull request:

    https://github.com/apache/metamodel/pull/31#issuecomment-120838816
  
    @kaspersorensen I've added some comments, please review.


---
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] metamodel pull request: Apache Hive support

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

    https://github.com/apache/metamodel/pull/31#discussion_r34440037
  
    --- Diff: jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcUpdateCallback.java ---
    @@ -63,10 +63,12 @@ public void executePreparedStatement(PreparedStatement preparedStatement, boolea
         protected final Connection getConnection() {
             if (_connection == null) {
                 _connection = getDataContext().getConnection();
    -            try {
    -                _connection.setAutoCommit(false);
    -            } catch (SQLException e) {
    -                throw JdbcUtils.wrapException(e, "disable auto-commit");
    +            if (_dataContext.getQueryRewriter().isTransactional()) {
    +                try {
    --- End diff --
    
    Ok got it! Thank you for clarifying, makes sense now.


---
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] metamodel pull request: Apache Hive support

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

    https://github.com/apache/metamodel/pull/31#discussion_r34438523
  
    --- Diff: jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcUpdateCallback.java ---
    @@ -78,18 +80,20 @@ public final void close(boolean success) {
                     closePreparedStatement(_preparedStatement);
                 }
     
    -            try {
    -                commitOrRollback(success);
    +            if (_dataContext.getQueryRewriter().isTransactional()) {
    +                try {
    --- End diff --
    
    Same comment than above


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