static public Object evalExprWithPart(ExprNodeDesc expr, Partition p) throws HiveException {
    LinkedHashMap<String, String> partSpec = p.getSpec();
    Properties partProps = p.getSchema();
    
    String[] partKeyTypes;
    if (p.getTable().hasNonNativePartitionSupport()) {
      if (!partSpec.keySet().containsAll(expr.getCols())) {
        return null;
      }
      partKeyTypes = p.getTable().getStorageHandler().getPartitionKeys(p.getTable()).stream()
          .map(FieldSchema::getType).toArray(String[]::new);
    } else {
      String pcolTypes = partProps.getProperty(hive_metastoreConstants.META_TABLE_PARTITION_COLUMN_TYPES);
      partKeyTypes = pcolTypes.trim().split(":");
    }
    
    if (partSpec.size() != partKeyTypes.length) {
      if (DDLUtils.isIcebergTable(p.getTable())) {
        return null;
      }
      throw new HiveException("Internal error : Partition Spec size, " + partSpec.size() +
          " doesn't match partition key definition size, " + partKeyTypes.length);
    }
    // Create the row object
    List<String> partNames = new ArrayList<>();
    List<Object> partValues = new ArrayList<>();
    List<ObjectInspector> partObjectInspectors = new ArrayList<>();
    int i = 0;
    for (Map.Entry<String, String> entry : partSpec.entrySet()) {
      partNames.add(entry.getKey());
      ObjectInspector oi = PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector
          (TypeInfoFactory.getPrimitiveTypeInfo(partKeyTypes[i++]));
      partValues.add(ObjectInspectorConverters.getConverter(
          PrimitiveObjectInspectorFactory.javaStringObjectInspector, oi)
          .convert(entry.getValue()));
      partObjectInspectors.add(oi);
    }
    StructObjectInspector partObjectInspector = ObjectInspectorFactory
        .getStandardStructObjectInspector(partNames, partObjectInspectors);

    ExprNodeEvaluator evaluator = ExprNodeEvaluatorFactory
        .get(expr);
    ObjectInspector evaluateResultOI = evaluator
        .initialize(partObjectInspector);
    Object evaluateResultO = evaluator.evaluate(partValues);
    
    return ((PrimitiveObjectInspector) evaluateResultOI)
        .getPrimitiveJavaObject(evaluateResultO);
  }
Evaluate expression with partition columns

@param expr
@return value returned by the expression
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartExprEvalUtils.java