Title
Page icon
Create new category
Edit page index title
Edit category
Edit link
Access Hive Managed ACID Tables with Spark 3
Hive managed ACID tables store transactional data in base and delta files. Standard Spark Hive integration might not correctly process the transactional state of these tables, which can result in missing, duplicate, or deleted rows being returned.
Use Hive Warehouse Connector (HWC) to access Hive managed ACID tables from Spark 3.
HWC enables Spark to interact with Hive managed ACID tables while handling the required Hive transactional processing.
Prerequisites
Before you begin:
Ensure that Spark 3 is installed and configured.
Identify the ODP version installed on the cluster.
Obtain the HiveServer2 JDBC URL.
For Kerberos-enabled clusters, obtain the HiveServer2 Kerberos principal.
Start Spark Shell with HWC
Start Spark Shell and specify the HWC JAR:
Replace <ODP_VERSION> and <HIVE_JDBC_URL> with the values for your environment.
Start PySpark with HWC
Start PySpark and specify the HWC JAR and Python package:
Create an HWC session
Spark Shell
Import HiveWarehouseSession:
Create an HWC session:
PySpark
Create an HWC session:
Read a Hive managed ACID table
Use the HWC table API to read a managed ACID table.
Spark Shell
PySpark
Replace default.employee_acid with the database and table name that you want to access.