snowflake-jdbc icon indicating copy to clipboard operation
snowflake-jdbc copied to clipboard

SNOW-404946: Asynchronous query: Ambiguous NO_DATA status

Open giangstrider opened this issue 3 years ago • 0 comments

Hi everyone,

I'm working on asynchronous query feature. I have the question around NO_DATA status.

What is exactly meaning of NO_DATA status? Looking into the source, NO_DATA returned here https://github.com/snowflakedb/snowflake-jdbc/blob/ee2b57b9eb45b8da960f191222084176ec820f9e/src/main/java/net/snowflake/client/core/QueryStatus.java#L90

public static QueryStatus getStatusFromString(String description) {
    if (description != null) {
      for (QueryStatus st : QueryStatus.values()) {
        if (description.equalsIgnoreCase(st.getDescription())) {
          return st;
        }
      }
      return QueryStatus.NO_DATA;
    }
    return null;
  }

In my case, when the query ran for first second, the query status return NO_DATA. Few secs later it return SUCCESS status. https://github.com/snowflakedb/snowflake-jdbc/blob/ee2b57b9eb45b8da960f191222084176ec820f9e/src/main/java/net/snowflake/client/core/QueryStatus.java#L63

public static boolean isStillRunning(QueryStatus status) {
    switch (status.getValue()) {
      case 0: // "RUNNING"
      case 8: // "RESUMING_WAREHOUSE"
      case 5: // "QUEUED"
      case 9: // "QUEUED_REPAIRING_WAREHOUSE"
      case 12: // "NO_DATA"
        return true;
      default:
        return false;
    }
  }

My concern is what is the difference between NO_DATA and RUNNING status?

Shall we remove or somehow merge it with other status to avoid confusion, such as RUNNING for example?

Finally, maybe the docs for this should mentioned as well. https://docs.snowflake.com/en/user-guide/jdbc-using.html#best-practices-for-asynchronous-queries

Thanks, Giang

giangstrider avatar Jul 25 '21 06:07 giangstrider