Open sunke38 opened 2 years ago
@dongkelun would you be able to help with this? seems like hive sync config for database was not passed to sql properly. You may try reproduce this with both the latest master version and 0.11.1.
@dongkelun would you be able to help with this? seems like hive sync config for database was not passed to sql properly. You may try reproduce this with both the latest master version and 0.11.1.
ok
@sunke38 @xushiyan When creating a table with spark sql, if hive is enabled, a table will be created in the corresponding hive database. The default value is default. You can use spark sql ("use databaseName") to change the current database. If the table name has a database name, the database name in the table name will prevail.
The database name configured through hoodie.datasource.hive_sync.database
will be synchronized to the corresponding database only when writing data. However, your code does not write data, so it will not be synchronized.If it is not configured, its default value is as follows:
hiveSyncConfig.setValue(HoodieSyncConfig.META_SYNC_DATABASE_NAME, hoodieCatalogTable.table.identifier.database.getOrElse("default"))
@sunke38 : does above response makes sense. Let us know how we can assist here. if you get it resolved, feel free to close out the issue.
Describe the problem you faced
I use spark sql to create table and sync to hive and query by presto. My code get table schema from json and create table if its not exists. Here is my problem, even I set hoodie.datasource.hive_sync.database in sql, the new table is put under default database instead of I set.
code
Expected behavior
create table and sync to hive. that table should be under the schema I set
Environment Description
Hudi version : 0.11
Spark version : 3.2.1
Hadoop version : 3.2.2
Storage (HDFS/S3/GCS..) : HDFS
Running on Docker? (yes/no) : no
Stacktrace
N/A but here is my output from code