private static boolean needsLock(Entity entity, boolean isExternalEnabled, boolean isLocklessReads) {
    switch (entity.getType()) {
      case TABLE:
        return isLockableTable(entity.getTable(), isExternalEnabled, isLocklessReads);
      case PARTITION:
        return isLockableTable(entity.getPartition().getTable(), isExternalEnabled, isLocklessReads);
      default:
        return true;
    }
  }
Full recursive PathFilter version of IdPathFilter (filtering files for a given writeId and stmtId).
This can be used by recursive filelisting, when we want to match the delta / base pattern on the bucketFiles.
ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java