public void configureTableJobProperties(
      TableDesc tableDesc, Map<String, String> jobProperties, boolean isInputJob) throws Exception {
    Properties tableProperties = tableDesc.getProperties();
    String tableName = null;
    String connStr = tableProperties.getProperty(MRConstants.SPLICE_JDBC_STR);
    if (connStr == null)
      throw new Exception(
          "Error: wrong param. Did you mean '" + MRConstants.SPLICE_JDBC_STR + "'?"); // TODO JL
    if (sqlUtil == null) sqlUtil = SMSQLUtil.getInstance(connStr);
    if (isInputJob) {
      tableName = tableProperties.getProperty(MRConstants.SPLICE_TABLE_NAME);
      if (tableName == null)
        throw new Exception(
            "Error: wrong param. Did you mean '" + MRConstants.SPLICE_TABLE_NAME + "'?");
    } else {
      tableName = tableProperties.getProperty(MRConstants.SPLICE_TABLE_NAME);
      if (tableName == null)
        throw new Exception(
            "Error: wrong param. Did you mean '" + MRConstants.SPLICE_TABLE_NAME + "'?");
    }

    tableName = tableName.trim();

    if (parentConn == null) {
      parentTxnId = startWriteJobParentTxn(connStr, tableName);
    }
    jobProperties.put(MRConstants.SPLICE_TRANSACTION_ID, parentTxnId);
    jobProperties.put(MRConstants.SPLICE_TABLE_NAME, tableName);
    jobProperties.put(MRConstants.SPLICE_JDBC_STR, connStr);
  }
  public String startWriteJobParentTxn(String connStr, String tableName) {

    if (sqlUtil == null) sqlUtil = SMSQLUtil.getInstance(connStr);
    try {
      parentConn = sqlUtil.createConn();
      sqlUtil.disableAutoCommit(parentConn);
      String txsId = sqlUtil.getTransactionID(parentConn);
      PreparedStatement ps =
          parentConn.prepareStatement("call SYSCS_UTIL.SYSCS_ELEVATE_TRANSACTION(?)");
      ps.setString(1, tableName);
      ps.executeUpdate();
      return txsId;
    } catch (SQLException e) {
      return null;
    } catch (InstantiationException e) {
      // TODO Auto-generated catch block
      return null;
    } catch (IllegalAccessException e) {
      // TODO Auto-generated catch block
      return null;
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      return null;
    }
  }
  @Override
  public void preCreateTable(Table tbl) throws MetaException {

    boolean isExternal = MetaStoreUtils.isExternalTable(tbl);
    if (isExternal) {
      Log.info("Creating External table for Splice...");
    }

    String inputTableName = tbl.getParameters().get(MRConstants.SPLICE_TABLE_NAME);
    if (inputTableName == null)
      throw new MetaException(
          "Wrong param, you are missing " + MRConstants.SPLICE_TABLE_NAME + " ? ");

    // We can choose to support user define column mapping.
    // But currently I don't think it is necessary
    // We map all columns from Splice Table to Hive Table.
    String connStr = tbl.getParameters().get(MRConstants.SPLICE_JDBC_STR);
    if (connStr == null)
      throw new MetaException("Wrong param, did you mean " + MRConstants.SPLICE_JDBC_STR + " ? ");
    if (sqlUtil == null) sqlUtil = SMSQLUtil.getInstance(connStr);
    if (inputTableName != null) {
      inputTableName = inputTableName.trim();
      checkTableExists(inputTableName);
    }
  }