jojochuang commented on code in PR #163: URL: https://github.com/apache/ozone-site/pull/163#discussion_r2607571039
########## docs/04-user-guide/03-integrations/01-hive.md: ########## @@ -1,3 +1,163 @@ +--- +sidebar_label: Hive +--- + # Hive -**TODO:** File a subtask under [HDDS-9858](https://issues.apache.org/jira/browse/HDDS-9858) and complete this page or section. +Apache Hive has supported Apache Ozone since Hive 4.0. To enable Hive to work with Ozone paths, ensure that the `ozone-filesystem-hadoop3` JAR is added to the Hive classpath. + +## Supported Access Protocols + +Hive supports the following protocols for accessing Ozone data: + +- ofs +- o3fs +- s3a + +## Supported Replication Types + +Hive is compatible with Ozone buckets configured with either: + +- RATIS (Replication) +- Erasure Coding + +## Accessing Ozone Data in Hive + +Hive provides two methods to interact with data in Ozone: + +- Managed Tables +- External Tables + +### Managed Tables + +#### Configuring the Hive Warehouse Directory in Ozone + +To store managed tables in Ozone, update the following properties in the `hive-site.xml` configuration file: + +```xml +<property> + <name>hive.metastore.warehouse.dir</name> + <value>ofs://ozone1/vol1/bucket1/warehouse/</value> +</property> +``` + +#### Creating a Managed Table + +You can create a managed table with a standard `CREATE TABLE` statement: + +```sql +CREATE TABLE myTable ( + id INT, + name STRING +); +``` + +#### Loading Data into a Managed Table + +Data can be loaded into a Hive table from an Ozone location: + +```sql +LOAD DATA INPATH 'ofs://ozone1/vol1/bucket1/table.csv' INTO TABLE myTable; +``` + +#### Specifying a Custom Ozone Path + +You can define a custom Ozone path for a database using the `MANAGEDLOCATION` clause: + +```sql +CREATE DATABASE d1 MANAGEDLOCATION 'ofs://ozone1/vol1/bucket1/data'; +``` + +Tables created in the database d1 will be stored under the specified path: + +`ofs://ozone1/vol1/bucket1/data` + +#### Verifying the Ozone Path + +You can confirm that Hive references the correct Ozone path using: + +```sql +SHOW CREATE DATABASE d1; +``` + +Output Example: + +```text Review Comment: I'm being nitpicking but noticing a missing line here: ```suggestion ```text +----------------------------------------------------+ ``` -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
