Repository: NetEase/arctic (java)

Issue:
[Bug]: Global Catalog configuration not valid for table build check
### What happened?

![image](https://github.com/NetEase/arctic/assets/109209550/bd86789d-e7b4-4a1c-8329-9efcbd7dbe46)
![image](https://github.com/NetEase/arctic/assets/109209550/ad30e9e3-8b92-4748-a988-ba1b56216807)
As you can see, after I configured table.log-store.topic = xxxxx in the global configuration of catalog, I still get an error saying that this configuration cannot be null.

### Affects Versions

0.4.x

### What engines are you seeing the problem on?

Core

### How to reproduce

1.Create a catalog and set properties log-store.topic = xxxxx
2.Create a table under this catalog and set properties log-store.enabled = true

### Relevant log output

```shell
2023/06/12 20:12:10 java.lang.IllegalArgumentException: log-store.topic must not be null when log-store.enabled is true.
	at org.apache.iceberg.relocated.com.google.common.base.Preconditions.checkArgument(Preconditions.java:142)
	at com.netease.arctic.catalog.BasicArcticCatalog$ArcticTableBuilder.checkProperties(BasicArcticCatalog.java:549)
	at com.netease.arctic.catalog.BasicArcticCatalog$ArcticTableBuilder.doCreateCheck(BasicArcticCatalog.java:539)
	at com.netease.arctic.hive.catalog.ArcticHiveCatalog$ArcticHiveTableBuilder.doCreateCheck(ArcticHiveCatalog.java:249)
	at com.netease.arctic.catalog.BasicArcticCatalog$ArcticTableBuilder.create(BasicArcticCatalog.java:488)
	at com.netease.arctic.spark.ArcticSparkCatalog.createTable(ArcticSparkCatalog.java:198)
	at org.apache.spark.sql.execution.datasources.v2.CreateTableExec.run(CreateTableExec.scala:41)
	at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.result$lzycompute(V2CommandExec.scala:40)
	at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.result(V2CommandExec.scala:40)
	at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.executeCollect(V2CommandExec.scala:46)
	at org.apache.spark.sql.Dataset.$anonfun$logicalPlan$1(Dataset.scala:228)
	at org.apache.spark.sql.Dataset.$anonfun$withAction$1(Dataset.scala:3687)
	at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$5(SQLExecution.scala:103)
	at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:163)
	at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:90)
	at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:772)
	at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:64)
	at org.apache.spark.sql.Dataset.withAction(Dataset.scala:3685)
	at org.apache.spark.sql.Dataset.(Dataset.scala:228)
	at org.apache.spark.sql.Dataset$.$anonfun$ofRows$2(Dataset.scala:99)
	at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:772)
	at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:96)
	at org.apache.spark.sql.SparkSession.$anonfun$sql$1(SparkSession.scala:615)
	at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:772)
	at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:610)
	at com.netease.arctic.ams.server.terminal.local.LocalTerminalSession.executeStatement(LocalTerminalSession.java:65)
	at com.netease.arctic.ams.server.terminal.TerminalSessionContext$ExecutionTask.executeStatement(TerminalSessionContext.java:275)
	at com.netease.arctic.ams.server.terminal.TerminalSessionContext$ExecutionTask.execute(TerminalSessionContext.java:238)
	at com.netease.arctic.ams.server.terminal.TerminalSessionContext$ExecutionTask.lambda$get$0(TerminalSessionContext.java:199)
	at com.netease.arctic.table.TableMetaStore.doAsUgi(TableMetaStore.java:365)
	at com.netease.arctic.table.TableMetaStore.lambda$doAs$0(TableMetaStore.java:345)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:360)
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1873)
	at com.netease.arctic.table.TableMetaStore.doAs(TableMetaStore.java:345)
	at com.netease.arctic.ams.server.terminal.TerminalSessionContext$ExecutionTask.get(TerminalSessionContext.java:191)
	at com.netease.arctic.ams.server.terminal.TerminalSessionContext$ExecutionTask.get(TerminalSessionContext.java:162)
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
```


### Anything else

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

Pull request:
[ARCTIC-1551]: Global Catalog configuration not valid for table build check
<!--
Thanks for sending a pull request!

Here are some tips for you:
  1. If this is your first time, please read our contributor guidelines: https://arctic.netease.com/ch/contribute/
  2. If the PR is related to an issue in https://github.com/NetEase/arctic/issues, add '[ARCTIC-XXXX]' in your PR title, e.g., '[ARCTIC-XXXX] Your PR title ...'.
  3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][ARCTIC #XXXX] Your PR title ...'.
-->

## Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
  1. If you add a feature, you can talk about its use case.
  2. If you fix a bug, you can clarify why it is a bug.
-->
resolve #1551 

## Brief change log

  - *Merge catalog properties before validation*

## How was this patch tested?
- [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [x] Run test locally before making a pull request

## Documentation

  - Does this pull request introduces a new feature? (no)


Patch:
diff --git a/core/src/main/java/com/netease/arctic/catalog/BasicArcticCatalog.java b/core/src/main/java/com/netease/arctic/catalog/BasicArcticCatalog.java
index d1514b011..882e7e8c3 100644
--- a/core/src/main/java/com/netease/arctic/catalog/BasicArcticCatalog.java
+++ b/core/src/main/java/com/netease/arctic/catalog/BasicArcticCatalog.java
@@ -283,6 +283,7 @@ public class BasicArcticCatalog implements ArcticCatalog {
 
     @Override
     public ArcticTable create() {
+      properties = CatalogUtil.mergeCatalogPropertiesToTable(properties, catalogMeta.getCatalogProperties());
       ConvertStructUtil.TableMetaBuilder builder = createTableMataBuilder();
       doCreateCheck();
       TableMeta meta = builder.build();


Test patch:
diff --git a/core/src/test/java/com/netease/arctic/catalog/TestMixedCatalog.java b/core/src/test/java/com/netease/arctic/catalog/TestMixedCatalog.java
index 660d9daea..48cc7fcd1 100644
--- a/core/src/test/java/com/netease/arctic/catalog/TestMixedCatalog.java
+++ b/core/src/test/java/com/netease/arctic/catalog/TestMixedCatalog.java
@@ -142,6 +142,41 @@ public class TestMixedCatalog extends CatalogTestBase {
         TableProperties.ENABLE_SELF_OPTIMIZING, TableProperties.ENABLE_SELF_OPTIMIZING_DEFAULT));
   }
 
+  @Test
+  public void testCreateTableWithNewCatalogLogProperties() throws TException {
+    UnkeyedTable createTable = getCatalog()
+        .newTableBuilder(TableTestHelper.TEST_TABLE_ID, getCreateTableSchema())
+        .withPartitionSpec(getCreateTableSpec())
+        .create()
+        .asUnkeyedTable();
+    Assert.assertTrue(PropertyUtil.propertyAsBoolean(createTable.properties(),
+        TableProperties.ENABLE_SELF_OPTIMIZING, TableProperties.ENABLE_SELF_OPTIMIZING_DEFAULT));
+    getCatalog().dropTable(TableTestHelper.TEST_TABLE_ID, true);
+
+    CatalogMeta testCatalogMeta = TEST_AMS.getAmsHandler().getCatalog(CatalogTestHelper.TEST_CATALOG_NAME);
+    TEST_AMS.getAmsHandler().updateMeta(
+        testCatalogMeta,
+        CatalogMetaProperties.TABLE_PROPERTIES_PREFIX + TableProperties.LOG_STORE_ADDRESS,
+        "1.1.1.1");
+    TEST_AMS.getAmsHandler().updateMeta(
+        testCatalogMeta,
+        CatalogMetaProperties.TABLE_PROPERTIES_PREFIX + TableProperties.LOG_STORE_MESSAGE_TOPIC,
+        "test-topic");
+    TEST_AMS.getAmsHandler().updateMeta(
+        testCatalogMeta,
+        CatalogMetaProperties.TABLE_PROPERTIES_PREFIX + TableProperties.ENABLE_SELF_OPTIMIZING,
+        "false");
+    getCatalog().refresh();
+    createTable = getCatalog()
+        .newTableBuilder(TableTestHelper.TEST_TABLE_ID, getCreateTableSchema())
+        .withPartitionSpec(getCreateTableSpec())
+        .withProperty(TableProperties.ENABLE_LOG_STORE, "true")
+        .create()
+        .asUnkeyedTable();
+    Assert.assertFalse(PropertyUtil.propertyAsBoolean(createTable.properties(),
+        TableProperties.ENABLE_SELF_OPTIMIZING, TableProperties.ENABLE_SELF_OPTIMIZING_DEFAULT));
+  }
+
   @Test
   public void testUnkeyedRecoverableFileIO() throws TException {
     UnkeyedTable createTable = getCatalog()