code: private Schema getUpdatedSchemaObject(String sourceColumnName, String alias, String targetColumnName) {
      // Check for source column and alias
      Schema obj = this.getMetadataColumnMap().get(sourceColumnName.toLowerCase());
      if (obj == null && alias != null) {
        obj = this.getMetadataColumnMap().get(alias.toLowerCase());
      }
  
      if (obj == null) {
        obj = getCustomColumnSchema(targetColumnName);
      } else {
        String watermarkColumn = this.workUnitState.getProp(ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY);
        String primarykeyColumn = this.workUnitState.getProp(ConfigurationKeys.EXTRACT_PRIMARY_KEY_FIELDS_KEY);
        boolean isMultiColumnWatermark = this.hasMultipleWatermarkColumns(watermarkColumn);
  
        obj.setColumnName(targetColumnName);
        boolean isWatermarkColumn = this.isWatermarkColumn(watermarkColumn, sourceColumnName);
        if (isWatermarkColumn) {
          this.updateDeltaFieldConfig(sourceColumnName, targetColumnName);
        } else if (alias != null) {
          // Check for alias
          isWatermarkColumn = this.isWatermarkColumn(watermarkColumn, alias);
          this.updateDeltaFieldConfig(alias, targetColumnName);
        }
  
        // If there is only one watermark column, then consider it as a
        // watermark. Otherwise add a default watermark column in the end
        if (!isMultiColumnWatermark) {
          obj.setWaterMark(isWatermarkColumn);
        }
  
        // override all columns to nullable except primary key and watermark
        // columns
        if ((isWatermarkColumn && !isMultiColumnWatermark)
            || this.getPrimarykeyIndex(primarykeyColumn, sourceColumnName) > 0) {
          obj.setNullable(false);
        } else {
          obj.setNullable(true);
        }
  
        // set primary key index for all the primary key fields
        int primarykeyIndex = this.getPrimarykeyIndex(primarykeyColumn, sourceColumnName);
        if (primarykeyIndex > 0 && (!sourceColumnName.equalsIgnoreCase(targetColumnName))) {
          this.updatePrimaryKeyConfig(sourceColumnName, targetColumnName);
        }
  
        obj.setPrimaryKey(primarykeyIndex);
      }
      return obj;
    }
docs: Update schema of source column Update column name with target column
  name/alias Update watermark, nullable and primary key flags
  
  @param sourceColumnName
  @param targetColumnName
  @return schema object of a column