snowflakedb/snowflake-jdbc

SNOW-1452552: ResultSetMetadata with VECTOR column does not provide a means of inferring its dimension

Closed this issue ยท 7 comments

Driver version: 3.16.1

OS: Linux

Java version: 17

When in my SnowflakeResultSetMetadata I have a column of type VECTOR, I can infer the type in its fields such as INT or FLOAT but there is no means of being able to understand what is its dimension size.

I would expect that somewhere in the metadata I am able to get the dimension size of the VECTOR type for that column.
Apologies if I am missing something

Hi @sfc-gh-wfateem Just wanted to check in and ask if there's any update on this ?
Thanks,
Jack

Hey @JackMatthewRimmer,

I was just looking into this today. I first wanted to see if we get the information about a vector's dimensions from the backend to begin with. I have been able to confirm that this information is, in fact, returned to us, so we should be able to present that information somehow in the ResultSetMetadata.

It's not the most convenient approach, but If you're looking for any kind of solution to get the dimensions for now, you can do something like this:

// Assuming you have this table in Snowflake:
// create or replace table JDBC_VECTOR(float_vec VECTOR(FLOAT, 256), int_vec VECTOR(INT, 16))

Statement stmt = connection.createStatement();
stmt.executeQuery("show columns in MY_DB.MY_SCHEMA.MY_TABLE");
ResultSet resultSet = statement.getResultSet();
resultSet.next();
resultSet.getString(3); // value: FLOAT_VEC
resultSet.getString(4); // value: {"type":"VECTOR","nullable":true,"vectorElementType":{"type":"REAL","nullable":false},"dimension":256}

You can extract the dimension from the JSON data returned.

Hi @sfc-gh-wfateem,

Thank you for having a look at this. Unfortunately the way our system is built it requires the data being present in the ResultSetMetadata. Would you possible be able to give a rough idea about how long it may take before this would make its way into a release ?

Thanks,
Jack

@JackMatthewRimmer We release a new version once a month. Versions 3.16.1 was released end of May, so in theory the next release would be end of June, however, because of the Snowflake Summit I would expect that to have some impact on the release schedule. Roughly, you're looking at the end of June/beginning of July. You also need to be aware that there are priorities, so just depending on the issues we have in the pipeline we might not get around to this in the next release.
In case this is important to your team's work and you have some important deadlines, then I would recommend you open a support case with Snowflake and share that context so that the team can prioritize this for you, if possible.

@sfc-gh-wfateem Thank you for your responses ๐Ÿ™ . I think we will look at raising a support ticket.
Thanks,
Jack

@JackMatthewRimmer PR #1788 is currently in review and will address this.

@JackMatthewRimmer this has been released in JDBC v3.17.0. I'll go ahead and close the issue at this point, but if you still have any issues with this fix in v3.17.0 please let us know.