Skip to content

Commit

Permalink
Used a LinkedHashMap for DuckDBStruct.getMap
Browse files Browse the repository at this point in the history
This retains the order of the attributes in the struct.
  • Loading branch information
rayokota committed Jul 2, 2024
1 parent 33f20be commit 64a26a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/duckdb/DuckDBStruct.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.sql.SQLException;
import java.sql.Struct;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

public class DuckDBStruct implements Struct {
Expand Down Expand Up @@ -41,7 +41,7 @@ public Object[] getAttributes(Map<String, Class<?>> map) throws SQLException {

public Map<String, Object> getMap() throws SQLException {
Object[] values = getAttributes();
Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new LinkedHashMap<>();
for (int i = 0; i < values.length; i++) {
result.put(keys[i], values[i]);
}
Expand Down

0 comments on commit 64a26a7

Please sign in to comment.