zhuangchong commented on code in PR #1081:
URL: https://github.com/apache/incubator-paimon/pull/1081#discussion_r1186643183


##########
docs/content/engines/hive.md:
##########
@@ -200,60 +170,61 @@ OK
 2      Store
 3      Paimon
 */
--- Insert records into test table from other table
-
-INSERT INTO test_table SELECT a, b FROM test_table;
-
-SELECT a, b FROM test_table ORDER BY a;
-
-/*
-OK
-1      Table
-1      Table
-2      Store
-2      Store
-3      Paimon
-3      Paimon
-*/
-
 ```
 
-* To create paimon tables that do not exist, you can create them as external 
and internal tables in Hive. Run the following Hive SQL in Hive CLI.
+## Hive SQL: create new Paimon Tables
+
+You can create new paimon tables in Hive. Run the following Hive SQL in Hive 
CLI.
 
 ```sql
 -- Assume that paimon-hive-connector-{{< version >}}.jar is already in auxlib 
directory.
--- Let's create a new external table that doesn't exist in paimon.
--- Need to specify the location to the path of table.
+-- Let's create a new paimon table.
+
+SET hive.metastore.warehouse.dir=warehouse_path;
 
-CREATE EXTERNAL TABLE hive_test_table(
+CREATE TABLE hive_test_table(
     a INT COMMENT 'The a field',
     b STRING COMMENT 'The b field'
 )
 STORED BY 'org.apache.paimon.hive.PaimonStorageHandler'
-LOCATION '/path/to/table/store/warehouse/default.db/hive_test_table';
+```
+
+## Hive SQL: access Paimon Tables by External Table
 
--- Insert records into hive_test_table
+To access existing paimon table, you can also register them as external tables 
in Hive. Run the following Hive SQL in Hive CLI.
 
-INSERT INTO hive_test_table VALUES (1, 'Paimon');
+```sql
+-- Assume that paimon-hive-connector-{{< version >}}.jar is already in auxlib 
directory.
+-- Let's use the test_table created in the above section.
+-- To create an external table, you don't need to specify any column or table 
properties.
+-- Pointing the location to the path of table is enough.
+
+CREATE EXTERNAL TABLE external_test_table
+STORED BY 'org.apache.paimon.hive.PaimonStorageHandler'
+LOCATION '/path/to/table/store/warehouse/default.db/test_table';
 
--- Read records from hive_test_table
+-- Read records from external_test_table
 
-SELECT a, b FROM hive_test_table;
+SELECT a, b FROM test_table ORDER BY a;
 
 /*
 OK
-1      Paimon
+1      Table
+2      Store
 */
 
--- Let's create a new internal table that doesn't exist in paimon.
--- Need to specify the location to the path of table.
+-- Insert records into test table
 
-CREATE TABLE hive_internal_test_table(
-    a INT COMMENT 'The a field',
-    b STRING COMMENT 'The b field'
-)
-STORED BY 'org.apache.paimon.hive.PaimonStorageHandler'
-LOCATION '/path/to/table/store/warehouse/default.db/hive_internal_test_table';
+INSERT INTO test_table VALUES (3, 'Paimon');
+
+SELECT a, b FROM test_table ORDER BY a;

Review Comment:
   external_test_table?



##########
docs/content/how-to/creating-tables.md:
##########
@@ -415,25 +421,14 @@ val dataset = 
spark.read.format("paimon").load("hdfs://path/to/table")
 
 {{< tab "Hive" >}}
 
-* To access existing paimon table, you can also register them as external and 
internal tables in Hive. The following SQL creates an external table named 
`my_table`, where the base path of table files is `hdfs://path/to/table`. As 
schemas are stored in table files, users do not need to write column 
definitions.
+To access existing paimon table, you can also register them as external and 
internal tables in Hive. The following SQL creates an external table named 
`my_table`, where the base path of table files is `hdfs://path/to/table`. As 
schemas are stored in table files, users do not need to write column 
definitions.
 
 ```sql
 CREATE EXTERNAL TABLE my_table
 STORED BY 'org.apache.paimon.hive.PaimonStorageHandler'
 LOCATION 'hdfs://path/to/table';

Review Comment:
   hdfs:///path/to/table?



##########
docs/content/how-to/creating-tables.md:
##########
@@ -133,7 +135,9 @@ CREATE TABLE MyTable (
     behavior STRING,
     dt STRING,
     hh STRING
-) TBLPROPERTIES (
+)
+STORED BY 'org.apache.paimon.hive.PaimonStorageHandler'
+TBLPROPERTIES (

Review Comment:
   Add the statement before creating the table: `SET 
hive.metastore.warehouse.dir=warehouse_path;` ?



##########
docs/content/engines/hive.md:
##########
@@ -200,60 +170,61 @@ OK
 2      Store
 3      Paimon
 */
--- Insert records into test table from other table
-
-INSERT INTO test_table SELECT a, b FROM test_table;
-
-SELECT a, b FROM test_table ORDER BY a;
-
-/*
-OK
-1      Table
-1      Table
-2      Store
-2      Store
-3      Paimon
-3      Paimon
-*/
-
 ```
 
-* To create paimon tables that do not exist, you can create them as external 
and internal tables in Hive. Run the following Hive SQL in Hive CLI.
+## Hive SQL: create new Paimon Tables
+
+You can create new paimon tables in Hive. Run the following Hive SQL in Hive 
CLI.
 
 ```sql
 -- Assume that paimon-hive-connector-{{< version >}}.jar is already in auxlib 
directory.
--- Let's create a new external table that doesn't exist in paimon.
--- Need to specify the location to the path of table.
+-- Let's create a new paimon table.
+
+SET hive.metastore.warehouse.dir=warehouse_path;
 
-CREATE EXTERNAL TABLE hive_test_table(
+CREATE TABLE hive_test_table(
     a INT COMMENT 'The a field',
     b STRING COMMENT 'The b field'
 )
 STORED BY 'org.apache.paimon.hive.PaimonStorageHandler'
-LOCATION '/path/to/table/store/warehouse/default.db/hive_test_table';
+```
+
+## Hive SQL: access Paimon Tables by External Table
 
--- Insert records into hive_test_table
+To access existing paimon table, you can also register them as external tables 
in Hive. Run the following Hive SQL in Hive CLI.
 
-INSERT INTO hive_test_table VALUES (1, 'Paimon');
+```sql
+-- Assume that paimon-hive-connector-{{< version >}}.jar is already in auxlib 
directory.
+-- Let's use the test_table created in the above section.
+-- To create an external table, you don't need to specify any column or table 
properties.
+-- Pointing the location to the path of table is enough.
+
+CREATE EXTERNAL TABLE external_test_table
+STORED BY 'org.apache.paimon.hive.PaimonStorageHandler'
+LOCATION '/path/to/table/store/warehouse/default.db/test_table';
 
--- Read records from hive_test_table
+-- Read records from external_test_table
 
-SELECT a, b FROM hive_test_table;
+SELECT a, b FROM test_table ORDER BY a;

Review Comment:
   external_test_table?



##########
docs/content/engines/hive.md:
##########
@@ -132,53 +132,23 @@ SELECT * FROM test_table;
 */
 ```
 
-Select the paimon table created in hive from flink. [creating a table with 
Hive SQL]({{< ref "engines/hive#quick-start-with-hive-table" >}}).
+## Hive SQL: access Paimon Tables already in Hive metastore

Review Comment:
   Here should be flink sql access paimon table created in hive engine?



##########
docs/content/how-to/creating-tables.md:
##########
@@ -74,7 +74,9 @@ CREATE TABLE MyTable (
     behavior STRING,
     dt STRING,
     hh STRING
-) TBLPROPERTIES (
+)
+STORED BY 'org.apache.paimon.hive.PaimonStorageHandler'
+TBLPROPERTIES (

Review Comment:
   Add the statement before creating the table: `SET 
hive.metastore.warehouse.dir=warehouse_path;` ?



##########
paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogITCaseBase.java:
##########
@@ -266,14 +266,12 @@ public void testFlinkWriteAndHiveRead() throws Exception {
 
     @Test
     public void testHiveCreateAndFlinkRead() throws Exception {
+        hiveShell.execute("SET hive.metastore.warehouse.dir=" + path);
         hiveShell.execute(
                 "CREATE EXTERNAL TABLE hive_test_table ( a INT, b STRING ) "

Review Comment:
   CREATE TABLE hive_test_table ...?



##########
docs/content/how-to/creating-tables.md:
##########
@@ -351,7 +355,9 @@ CREATE TABLE MyTable (
     behavior STRING,
     dt STRING,
     hh STRING
-) TBLPROPERTIES (
+)
+STORED BY 'org.apache.paimon.hive.PaimonStorageHandler'
+TBLPROPERTIES (

Review Comment:
   Add the statement before creating the table: `SET 
hive.metastore.warehouse.dir=warehouse_path;` ?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to