public boolean getPartitionsByExpr(Table tbl, ExprNodeDesc expr, HiveConf conf,
      List<Partition> partitions) throws HiveException, TException {
    PerfLogger perfLogger = SessionState.getPerfLogger();
    perfLogger.perfLogBegin(CLASS_NAME, PerfLogger.HIVE_GET_PARTITIONS_BY_EXPR);
    try {
      Preconditions.checkNotNull(partitions);
      String defaultPartitionName = HiveConf.getVar(conf, ConfVars.DEFAULT_PARTITION_NAME);
      if (tbl.hasNonNativePartitionSupport()) {
        partitions.addAll(tbl.getStorageHandler().getPartitionsByExpr(tbl, expr));
        return false;
      } else {
        byte[] exprBytes = SerializationUtilities.serializeObjectWithTypeInformation(expr);
        List<org.apache.hadoop.hive.metastore.api.PartitionSpec> msParts =
                new ArrayList<>();
        ValidWriteIdList validWriteIdList = null;

        PartitionsByExprRequest req = buildPartitionByExprRequest(tbl, exprBytes, defaultPartitionName, conf,
                null);

        if (AcidUtils.isTransactionalTable(tbl)) {
          validWriteIdList = getValidWriteIdList(tbl.getDbName(), tbl.getTableName());
          req.setValidWriteIdList(validWriteIdList != null ? validWriteIdList.toString() : null);
          req.setId(tbl.getTTable().getId());
        }

        boolean hasUnknownParts = getMSC().listPartitionsSpecByExpr(req, msParts);
        partitions.addAll(convertFromPartSpec(msParts.iterator(), tbl));

        return hasUnknownParts;
      }
    } finally {
      perfLogger.perfLogEnd(CLASS_NAME, PerfLogger.HIVE_GET_PARTITIONS_BY_EXPR, "HS2-cache");
    }
  }
Get a list of Partitions by expr.
@param tbl The table containing the partitions.
@param expr A serialized expression for partition predicates.
@param conf Hive config.
@param partitions the resulting list of partitions
@return whether the resulting list contains partitions which may or may not match the expr
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java