@Override
  public void open() throws CatalogException {
    if (this.client == null) {
      try {
        this.client = Hive.get(hiveConf).getMSC();
      } catch (Exception e) {
        throw new HoodieCatalogException("Failed to create hive metastore client", e);
      }
      LOG.info("Connected to Hive metastore");
    }
    if (!databaseExists(getDefaultDatabase())) {
      LOG.info("{} does not exist, will be created.", getDefaultDatabase());
      CatalogDatabase database = new CatalogDatabaseImpl(Collections.emptyMap(), "default database");
      try {
        createDatabase(getDefaultDatabase(), database, true);
      } catch (DatabaseAlreadyExistException e) {
        throw new HoodieCatalogException(getName(), e);
      }
    }
  }
@Test
  void testCreateTableWithoutPreCombineKey() throws TableAlreadyExistException, DatabaseNotExistException, IOException, TableNotExistException {
    String db = "default";
    hoodieCatalog = HoodieCatalogTestUtils.createHiveCatalog();
    hoodieCatalog.open();

    Map<String, String> options = new HashMap<>();
    options.put(FactoryUtil.CONNECTOR.key(), "hudi");

    TypedProperties props = createTableAndReturnTableProperties(options, new ObjectPath(db, "tmptb1"));
    assertFalse(props.containsKey("hoodie.table.precombine.field"));

    options.put(PRECOMBINE_FIELD.key(), "ts_3");
    props = createTableAndReturnTableProperties(options, new ObjectPath(db, "tmptb2"));
    assertTrue(props.containsKey("hoodie.table.precombine.field"));
    assertEquals("ts_3", props.get("hoodie.table.precombine.field"));
  }