Cassandra
  1. Cassandra
  2. CASSANDRA-2302

JDBC driver needs ResultSet.getMetaData()

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Fix Version/s: 0.8 beta 1
    • Component/s: Core
    • Labels:

      Activity

      Hide
      Vivek Mishra added a comment -

      CassandraResultSetMetaData cmd = md.unwrap(CassandraResultSetMetaData.class);

      should it be implicit to RsMetaData? It will encapsulate the nice concept of multiple inheritence.

      As unwrap is throwing SQLException in case of:
      if (iface.equals(CassandraResultSetMetaData.class))
      return (T)this;
      else
      throw new SQLFeatureNotSupportedException("No wrappers");

      Does it make sense to implicit cast it into CassandraResultSetMetaData?

      Nulll check on "values" can avoid possible NullPointerException?

      Show
      Vivek Mishra added a comment - CassandraResultSetMetaData cmd = md.unwrap(CassandraResultSetMetaData.class); should it be implicit to RsMetaData? It will encapsulate the nice concept of multiple inheritence. As unwrap is throwing SQLException in case of: if (iface.equals(CassandraResultSetMetaData.class)) return (T)this; else throw new SQLFeatureNotSupportedException("No wrappers"); Does it make sense to implicit cast it into CassandraResultSetMetaData? Nulll check on "values" can avoid possible NullPointerException?
      Hide
      Gary Dusbabek added a comment -

      committed ResultSetMetaData implementation.

      Show
      Gary Dusbabek added a comment - committed ResultSetMetaData implementation.
      Hide
      Gary Dusbabek added a comment -

      Newest patch offers a ResultSetMetaData implementation that is more true to the JDBC spec. The ResultSetMetaData interface is limited in that it only exposes type information for column values. I've exposed CassandraResultSetMetaData to remedy this. It can be accessed this way:

      ResultSet rs = stmt.executeQuery("select ...");
      ResultSetMetaData md = rs.getMetaData();
      CassandraResultSetMetaData cmd = md.unwrap(CassandraResultSetMetaData.class);
      

      CassandraResultSetMetaData is a long name to type out. I'm not opposed to renaming it CassandraResultMetaData or something else shorter.

      One aspect of CassandraResultSetMetaData that is different than the traditional ResultSetMetaData is that it answers questions about the current row and not the entire query (getColumnCount(), etc.), although type information (class names, etc.) will be constant for every row in a result set.

      When the time comes, I think CassandraResultSetMetaData will be the appropriate place to expose decoded and typed row keys.

      Show
      Gary Dusbabek added a comment - Newest patch offers a ResultSetMetaData implementation that is more true to the JDBC spec. The ResultSetMetaData interface is limited in that it only exposes type information for column values. I've exposed CassandraResultSetMetaData to remedy this. It can be accessed this way: ResultSet rs = stmt.executeQuery( "select ..." ); ResultSetMetaData md = rs.getMetaData(); CassandraResultSetMetaData cmd = md.unwrap(CassandraResultSetMetaData.class); CassandraResultSetMetaData is a long name to type out. I'm not opposed to renaming it CassandraResultMetaData or something else shorter. One aspect of CassandraResultSetMetaData that is different than the traditional ResultSetMetaData is that it answers questions about the current row and not the entire query (getColumnCount(), etc.), although type information (class names, etc.) will be constant for every row in a result set. When the time comes, I think CassandraResultSetMetaData will be the appropriate place to expose decoded and typed row keys.
      Hide
      Gary Dusbabek added a comment -

      It turns our that ResultSetMetaData was a bad match for rows with sparse columns. I took advantage of the unwrap() method (abusing it a little) to expose the current row (metdata and values) in the result set.

      Show
      Gary Dusbabek added a comment - It turns our that ResultSetMetaData was a bad match for rows with sparse columns. I took advantage of the unwrap() method (abusing it a little) to expose the current row (metdata and values) in the result set.

        People

        • Assignee:
          Gary Dusbabek
          Reporter:
          Gary Dusbabek
          Reviewer:
          Eric Evans
        • Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development