-
Notifications
You must be signed in to change notification settings - Fork 180
Snow-1936378 add support for vector type for loader #2161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Snow-1936378 add support for vector type for loader #2161
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
for (String col : _columns) { | ||
try (ResultSet rs = metadata.getColumns(_database, _schema, _table, col)) { | ||
// Check if column type is VECTOR, if true, add column name and size to vector column map. | ||
if (rs.getString(6).equalsIgnoreCase("vector")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we extract the logic of this condition and name this check instead of a comment?
@@ -83,6 +85,8 @@ public class StreamLoader implements Loader, Runnable { | |||
|
|||
private List<String> _columns; | |||
|
|||
private Map<String, Integer> _vectorColumns = new HashMap<String, Integer>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update the name of this map to better communicate its function: keep column size.
for (int i = 0; i < _columns.size(); i++) { | ||
String colName = _columns.get(i); | ||
if (_vectorColumns.containsKey(colName)) { | ||
sb.append(colName + "::VECTOR(FLOAT, " + _vectorColumns.get(colName) + ")"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about INT types in a vector?
|
||
@Test | ||
@DontRunOnGithubActions | ||
private void testMultipleVectorColumnsInTable() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also test the table with mixed types (the best with all types).
for (String col : _columns) { | ||
try (ResultSet rs = metadata.getColumns(_database, _schema, _table, col)) { | ||
// Check if column type is VECTOR, if true, add column name and size to vector column map. | ||
if (rs.getString(6).equalsIgnoreCase("vector")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to store metadata for all columns, not only for the vector, in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a test that checks the INT Vector?
Overview
SNOW-XXXXX
Pre-review self checklist
master
branchmvn -P check-style validate
)mvn verify
and inspecttarget/japicmp/japicmp.html
)SNOW-XXXX:
External contributors - please answer these questions before submitting a pull request. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Issue: #NNNN
Fill out the following pre-review checklist:
@SnowflakeJdbcInternalApi
(note that public/protected methods/fields in classes marked with this annotation are already internal)Please describe how your code solves the related issue.
Please write a short description of how your code change solves the related issue.