massquantity opened a new issue #2919:
URL: https://github.com/apache/iceberg/issues/2919


   I'm following the instructions in 
[AWS-hive](https://iceberg.apache.org/aws/#hive) doc to query data from 
GlueCatalog using hive, but failed to create external tables. The error message 
shows `Database xxx doesn't exist`.
   
   Previously I've created iceberg tables using PySpark:
   ```python
   ICEBERG_VERSION = "0.11.1"
   DEPENDENCIES = f"org.apache.iceberg:iceberg-spark3-runtime:{ICEBERG_VERSION}"
   
   AWS_SDK_VERSION = "2.15.40"
   AWS_MAVEN_GROUP = "software.amazon.awssdk"
   AWS_PACKAGES = (
       "bundle",
       "url-connection-client"
   )
   
   for pkg in AWS_PACKAGES:
       DEPENDENCIES += f",{AWS_MAVEN_GROUP}:{pkg}:{AWS_SDK_VERSION}"
   
   spark = (SparkSession.builder
             .master("local[*]")
             .config("spark.jars.packages", DEPENDENCIES)
             .config("spark.sql.catalog.lake_catalog", 
"org.apache.iceberg.spark.SparkCatalog")
             .config("spark.sql.catalog.lake_catalog.warehouse", 
"s3://bucket_name/key")
             .config("spark.sql.catalog.lake_catalog.catalog-impl", 
"org.apache.iceberg.aws.glue.GlueCatalog")
             .config("spark.sql.catalog.lake_catalog.io-impl", 
"org.apache.iceberg.aws.s3.S3FileIO")
             .getOrCreate())
   
   spark_df = spark.createDataFrame(pd_data)  # pd_data is a pandas DataFrame
   spark_df.writeTo("lake_catalog.database_name.table_name").create()
   ```
   
   I can also query the data using PySpark:
   ```python
   df = spark.sql("SELECT * FROM lake_catalog.database_name.table_name")
   ```
   
   So this verifies that the database and table exist in iceberg, but hive 
can't locate them. 
   I use the following setting in hive:
   
   ```shell
   SET iceberg.engine.hive.enabled=true;
   SET hive.vectorized.execution.enabled=false;
   SET 
iceberg.catalog.glue.catalog-impl=org.apache.iceberg.aws.glue.GlueCatalog;
   SET iceberg.catalog.glue.warehouse=s3://bucket_name/key;
   SET 
iceberg.catalog.glue.lock-impl=org.apache.iceberg.aws.glue.DynamoLockManager;
   SET iceberg.catalog.glue.lock.table=myGlueLockTable;
   
   CREATE EXTERNAL TABLE database_name.table_name
   STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler'
   TBLPROPERTIES ('iceberg.catalog'='glue');
   ```


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

Reply via email to