public Map<Long, String> getEvaluatedResultsFromForeach(
      String foreachInlineWorkflowId, String stepId, String paramName) {
    Map<Long, String> idParams = new HashMap<>();
    return withMetricLogError(
        () ->
            withRetryableQuery(
                GET_EVALUATED_RESULTS_FROM_FOREACH_TEMPLATE,
                stmt -> {
                  int idx = 0;
                  stmt.setString(++idx, paramName);
                  stmt.setString(++idx, foreachInlineWorkflowId);
                  stmt.setString(++idx, stepId);
                },
                result -> {
                  while (result.next()) {
                    String val = result.getString(PAYLOAD_COLUMN);
                    if (val != null) {
                      idParams.put(result.getLong(ID_COLUMN), val);
                    }
                  }
                  return idParams;
                }),
        "getEvaluatedResultsFromForeach",
        "Failed to get the evaluated results of param [{}] from foreach step [{}][{}]",
        paramName,
        foreachInlineWorkflowId,
        stepId);
  }
@Test
  public void testGetEvaluatedResultsFromForeach() throws Exception {
    si = loadObject("fixtures/instances/sample-step-instance-succeeded.json", StepInstance.class);
    si.setStepAttemptId(10);
    stepDao.insertOrUpsertStepInstance(si, false);
    assertEquals(
        Collections.singletonMap(1L, "15"),
        stepDao.getEvaluatedResultsFromForeach("sample-dag-test-3", "job1", "sleep_seconds"));
  }