You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "diqiu50 (via GitHub)" <gi...@apache.org> on 2024/08/28 02:09:35 UTC

[PR] [#4712] fix (trino-connector): Fix Iceberg JDBC backend tables can not found in Trino [gravitino]

diqiu50 opened a new pull request, #4715:
URL: https://github.com/apache/gravitino/pull/4715

   <!--
   
   
   ### What changes were proposed in this pull request?
   
   Fix  Iceberg JDBC backend tables can not found in Trino
   
   ### Why are the changes needed?
   
   Fix: #4712 
   
   ### Does this PR introduce _any_ user-facing change?
   
   No
   
   ### How was this patch tested?
   
   No
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#4712] fix (trino-connector): Fix Iceberg JDBC backend tables can not found in Trino [gravitino]

Posted by "FANNG1 (via GitHub)" <gi...@apache.org>.
FANNG1 merged PR #4715:
URL: https://github.com/apache/gravitino/pull/4715


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#4712] fix (trino-connector): Fix Iceberg JDBC backend tables can not found in Trino [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on code in PR #4715:
URL: https://github.com/apache/gravitino/pull/4715#discussion_r1733796286


##########
trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/iceberg/IcebergConnectorAdapter.java:
##########
@@ -46,6 +46,7 @@ public IcebergConnectorAdapter() {
   @Override
   public Map<String, String> buildInternalConnectorConfig(GravitinoCatalog catalog)
       throws Exception {
+    catalog.getProperties().put("catalog-name", catalog.getName());

Review Comment:
   @diqiu50 
   Have you test this change,  `catalog.getProperties()` seems to be an immutable value?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#4712] fix (trino-connector): Fix Iceberg JDBC backend tables can not found in Trino [gravitino]

Posted by "FANNG1 (via GitHub)" <gi...@apache.org>.
FANNG1 commented on code in PR #4715:
URL: https://github.com/apache/gravitino/pull/4715#discussion_r1733846436


##########
trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/iceberg/IcebergCatalogPropertyConverter.java:
##########
@@ -351,7 +352,10 @@ private Map<String, String> buildJDBCBackendProperties(Map<String, String> prope
     jdbcProperties.put("iceberg.jdbc-catalog.default-warehouse-dir", properties.get("warehouse"));
 
     // TODO (FANG) make the catalog name equal to the catalog name in Gravitino

Review Comment:
   remove this TODO?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#4712] fix (trino-connector): Fix Iceberg JDBC backend tables can not found in Trino [gravitino]

Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 commented on code in PR #4715:
URL: https://github.com/apache/gravitino/pull/4715#discussion_r1733886536


##########
trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/iceberg/IcebergConnectorAdapter.java:
##########
@@ -46,6 +46,7 @@ public IcebergConnectorAdapter() {
   @Override
   public Map<String, String> buildInternalConnectorConfig(GravitinoCatalog catalog)
       throws Exception {
+    catalog.getProperties().put("catalog-name", catalog.getName());

Review Comment:
   I test it with the playground with my change:
   ```
   diff --git a/docker-compose.yaml b/docker-compose.yaml
   index 6c6a27e..87a9794 100644
   --- a/docker-compose.yaml
   +++ b/docker-compose.yaml
   @@ -82,6 +82,8 @@ services:
        entrypoint:  /bin/bash /tmp/trino/init.sh
        volumes:
          - ./init/trino:/tmp/trino
   +      - /Users/ice/Documents/workspace/git/gravitino/trino-connector/build/libs:/tmp/trino-connector
   +      - /Users/ice/Documents/workspace/git/gravitino/integration-test/trino-it/init/trino/config/jvm.config:/etc/trino/jvm.config
        depends_on:
          hive :
            condition: service_healthy
   @@ -173,4 +175,4 @@ services:
          resources:
            limits:
              cpus: "0.5"
   -          memory: 500M
   \ No newline at end of file
   +          memory: 500M
   diff --git a/init/trino/init.sh b/init/trino/init.sh
   index 70d6199..7284962 100644
   --- a/init/trino/init.sh
   +++ b/init/trino/init.sh
   @@ -18,6 +18,12 @@
    #
   
    # Since trino-connector needs to connect Gravitino service, get the default metalake
   +
   +set -x
   +
   +rm -fr /usr/lib/trino/plugin/gravitino
   +cp -r /tmp/trino-connector /usr/lib/trino/plugin/gravitino
   +
   ```
   Then run the command start the playground
   ···
   cd gravitino-playground
   ./launch-playground.sh
   ···
   Waiting for the playground startup, run the following command:
   ```shell
   docker exec -it playground-spark bash
   ```
   
   ```shell
   spark@container_id:/$ cd /opt/spark && /bin/bash bin/spark-sql 
   ```
   
   ```SQL
   use catalog_iceberg;
   create database sales;
   use sales;
   create table customers (customer_id int, customer_name varchar(100), customer_email varchar(100));
   describe extended customers;    
   insert into customers (customer_id, customer_name, customer_email) values (11,'Rory Brown','rory@123.com');
   insert into customers (customer_id, customer_name, customer_email) values (12,'Jerry Washington','jerry@dt.com');
   ```
   
   2. Login Trino container and execute the steps.
   You can get all the customers from both the Hive and Iceberg table.
   
   ```shell
   docker exec -it playground-trino bash
   ```
   
   ```shell
   trino@container_id:/$ trino  
   ```
   
   ```SQL
   select * from catalog_hive.sales.customers
   union
   select * from catalog_iceberg.sales.customers;
   ```
   
   The finally results :
   ```
    customer_id |  customer_name   |          customer_email
   -------------+------------------+----------------------------------
              4 | Mia Hahn         | miahahn@yahoo.edu
              5 | Quin Hurst       | quinhurst5485@google.net
              1 | Nasim Duke       | nasimduke@hotmail.net
              7 | Erasmus Phelps   | erasmusphelps9105@protonmail.net
              2 | Perry Tyler      | perrytyler@outlook.com
              8 | Lenore Wilder    | lenorewilder@aol.net
              6 | Harriet Best     | harrietbest2890@icloud.com
              9 | Raya Mcguire     | rayamcguire@hotmail.com
             12 | Jerry Washington | jerry@dt.com
             11 | Rory Brown       | rory@123.com
             10 | Ronan Joyner     | ronanjoyner5549@aol.com
              3 | Leah Swanson     | leahswanson1069@protonmail.com
   (12 rows)
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#4712] fix (trino-connector): Fix Iceberg JDBC backend tables can not found in Trino [gravitino]

Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 commented on code in PR #4715:
URL: https://github.com/apache/gravitino/pull/4715#discussion_r1733886536


##########
trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/iceberg/IcebergConnectorAdapter.java:
##########
@@ -46,6 +46,7 @@ public IcebergConnectorAdapter() {
   @Override
   public Map<String, String> buildInternalConnectorConfig(GravitinoCatalog catalog)
       throws Exception {
+    catalog.getProperties().put("catalog-name", catalog.getName());

Review Comment:
   I test it with the playground with my change, I'm build the `gravitino` project with this change  in the directory `/Users/ice/Documents/workspace/git/gravitino` :
   ```
   diff --git a/docker-compose.yaml b/docker-compose.yaml
   index 6c6a27e..87a9794 100644
   --- a/docker-compose.yaml
   +++ b/docker-compose.yaml
   @@ -82,6 +82,8 @@ services:
        entrypoint:  /bin/bash /tmp/trino/init.sh
        volumes:
          - ./init/trino:/tmp/trino
   +      - /Users/ice/Documents/workspace/git/gravitino/trino-connector/build/libs:/tmp/trino-connector
   +      - /Users/ice/Documents/workspace/git/gravitino/integration-test/trino-it/init/trino/config/jvm.config:/etc/trino/jvm.config
        depends_on:
          hive :
            condition: service_healthy
   @@ -173,4 +175,4 @@ services:
          resources:
            limits:
              cpus: "0.5"
   -          memory: 500M
   \ No newline at end of file
   +          memory: 500M
   diff --git a/init/trino/init.sh b/init/trino/init.sh
   index 70d6199..7284962 100644
   --- a/init/trino/init.sh
   +++ b/init/trino/init.sh
   @@ -18,6 +18,12 @@
    #
   
    # Since trino-connector needs to connect Gravitino service, get the default metalake
   +
   +set -x
   +
   +rm -fr /usr/lib/trino/plugin/gravitino
   +cp -r /tmp/trino-connector /usr/lib/trino/plugin/gravitino
   +
   ```
   Then run the command start the playground
   ···
   cd gravitino-playground
   ./launch-playground.sh
   ···
   Waiting for the playground startup, run the following command:
   ```shell
   docker exec -it playground-spark bash
   ```
   
   ```shell
   spark@container_id:/$ cd /opt/spark && /bin/bash bin/spark-sql 
   ```
   
   ```SQL
   use catalog_iceberg;
   create database sales;
   use sales;
   create table customers (customer_id int, customer_name varchar(100), customer_email varchar(100));
   describe extended customers;    
   insert into customers (customer_id, customer_name, customer_email) values (11,'Rory Brown','rory@123.com');
   insert into customers (customer_id, customer_name, customer_email) values (12,'Jerry Washington','jerry@dt.com');
   ```
   
   2. Login Trino container and execute the steps.
   You can get all the customers from both the Hive and Iceberg table.
   
   ```shell
   docker exec -it playground-trino bash
   ```
   
   ```shell
   trino@container_id:/$ trino  
   ```
   
   ```SQL
   select * from catalog_hive.sales.customers
   union
   select * from catalog_iceberg.sales.customers;
   ```
   
   The finally results :
   ```
    customer_id |  customer_name   |          customer_email
   -------------+------------------+----------------------------------
              4 | Mia Hahn         | miahahn@yahoo.edu
              5 | Quin Hurst       | quinhurst5485@google.net
              1 | Nasim Duke       | nasimduke@hotmail.net
              7 | Erasmus Phelps   | erasmusphelps9105@protonmail.net
              2 | Perry Tyler      | perrytyler@outlook.com
              8 | Lenore Wilder    | lenorewilder@aol.net
              6 | Harriet Best     | harrietbest2890@icloud.com
              9 | Raya Mcguire     | rayamcguire@hotmail.com
             12 | Jerry Washington | jerry@dt.com
             11 | Rory Brown       | rory@123.com
             10 | Ronan Joyner     | ronanjoyner5549@aol.com
              3 | Leah Swanson     | leahswanson1069@protonmail.com
   (12 rows)
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#4712] fix (trino-connector): Fix Iceberg JDBC backend tables can not found in Trino [gravitino]

Posted by "FANNG1 (via GitHub)" <gi...@apache.org>.
FANNG1 commented on code in PR #4715:
URL: https://github.com/apache/gravitino/pull/4715#discussion_r1733780478


##########
trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/iceberg/IcebergConnectorAdapter.java:
##########
@@ -46,6 +46,7 @@ public IcebergConnectorAdapter() {
   @Override
   public Map<String, String> buildInternalConnectorConfig(GravitinoCatalog catalog)
       throws Exception {
+    catalog.getProperties().put("catalog-name", catalog.getName());

Review Comment:
    @yuqi1129  please help review again



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#4712] fix (trino-connector): Fix Iceberg JDBC backend tables can not found in Trino [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on code in PR #4715:
URL: https://github.com/apache/gravitino/pull/4715#discussion_r1733796286


##########
trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/iceberg/IcebergConnectorAdapter.java:
##########
@@ -46,6 +46,7 @@ public IcebergConnectorAdapter() {
   @Override
   public Map<String, String> buildInternalConnectorConfig(GravitinoCatalog catalog)
       throws Exception {
+    catalog.getProperties().put("catalog-name", catalog.getName());

Review Comment:
   @diqiu50 
   Have you tested this change,  `catalog.getProperties()` seems to be an immutable value?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org