private long getLatestWatermark(String watermarkColumn, WatermarkType watermarkType, long lwmValue, long hwmValue)
      throws HighWatermarkException, IOException {

    if (!Boolean.valueOf(this.workUnitState.getProp(ConfigurationKeys.SOURCE_QUERYBASED_SKIP_HIGH_WATERMARK_CALC))) {
      log.info("Getting high watermark");
      List<Predicate> list = new ArrayList<>();
      WatermarkPredicate watermark = new WatermarkPredicate(watermarkColumn, watermarkType);
      String lwmOperator = partition.isLowWatermarkInclusive() ? ">=" : ">";
      String hwmOperator = (partition.isLastPartition() || partition.isHighWatermarkInclusive()) ? "<=" : "<";

      Predicate lwmPredicate = watermark.getPredicate(this, lwmValue, lwmOperator, Predicate.PredicateType.LWM);
      Predicate hwmPredicate = watermark.getPredicate(this, hwmValue, hwmOperator, Predicate.PredicateType.HWM);
      if (lwmPredicate != null) {
        list.add(lwmPredicate);
      }
      if (hwmPredicate != null) {
        list.add(hwmPredicate);
      }

      return this.getMaxWatermark(this.schema, this.entity, watermarkColumn, list,
          watermark.getWatermarkSourceFormat(this));
    }

    return hwmValue;
  }
private long getLatestWatermark ( String watermarkColumn , WatermarkType watermarkType , long lwmValue , long hwmValue ) throws HighWatermarkException , IOException { if ( ! Boolean . valueOf ( this . workUnitState . getProp ( ConfigurationKeys . SOURCE_QUERYBASED_SKIP_HIGH_WATERMARK_CALC ) ) ) { log . info ( "Getting high watermark" ) ; List < Predicate > list = new ArrayList < > ( ) ; WatermarkPredicate watermark = new WatermarkPredicate ( watermarkColumn , watermarkType ) ; String lwmOperator = partition . isLowWatermarkInclusive ( ) ? ">=" : ">" ; String hwmOperator = ( partition . isLastPartition ( ) || partition . isHighWatermarkInclusive ( ) ) ? "<=" : "<" ; Predicate lwmPredicate = watermark . getPredicate ( this , lwmValue , lwmOperator , Predicate . PredicateType . LWM ) ; Predicate hwmPredicate = watermark . getPredicate ( this , hwmValue , hwmOperator , Predicate . PredicateType . HWM ) ; if ( lwmPredicate != null ) { list . add ( lwmPredicate ) ; } if ( hwmPredicate != null ) { list . add ( hwmPredicate ) ; } return this . getMaxWatermark ( this . schema , this . entity , watermarkColumn , list , watermark . getWatermarkSourceFormat ( this ) ) ; } return hwmValue ; }
if snapshot extract, get latest watermark else return work unit high watermark

@param watermarkColumn watermark column
@param lwmValue low watermark value
@param hwmValue high watermark value
@param watermarkType watermark type
@return latest watermark
@throws IOException