public ParamType getForeachParamType(
      String foreachInlineWorkflowId, String stepId, String paramName) {
    String ret =
        withMetricLogError(
            () ->
                withRetryableQuery(
                    GET_PARAM_TYPE_FROM_FOREACH_TEMPLATE,
                    stmt -> {
                      int idx = 0;
                      stmt.setString(++idx, paramName);
                      stmt.setString(++idx, foreachInlineWorkflowId);
                      stmt.setString(++idx, stepId);
                    },
                    result -> {
                      if (result.next()) {
                        return result.getString(PAYLOAD_COLUMN);
                      }
                      return null;
                    }),
            "getForeachParamType",
            "Failed to get the param type for [{}] from foreach step [{}][{}]",
            paramName,
            foreachInlineWorkflowId,
            stepId);
    if (ret == null) {
      throw new MaestroNotFoundException(
          "Parameter [%s] for foreach step [%s][%s] not found (either not created or deleted)",
          paramName, foreachInlineWorkflowId, stepId);
    }
    return ParamType.create(ret);
  }
@Test
  public void testGetForeachParamType() throws Exception {
    si = loadObject("fixtures/instances/sample-step-instance-succeeded.json", StepInstance.class);
    si.setStepAttemptId(10);
    stepDao.insertOrUpsertStepInstance(si, false);
    assertEquals(
        ParamType.LONG, stepDao.getForeachParamType("sample-dag-test-3", "job1", "sleep_seconds"));
  }