<< Back to previous view

[JDBC-105] the :as-array? option to query changes the chunkiness of the result Created: 27/Feb/15  Updated: 27/Feb/15

Status: Open
Project: java.jdbc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Kevin Downey Assignee: Sean Corfield
Resolution: Unresolved Votes: 0
Labels: None


jdbc/query uses doall to force results when :as-array? is false and uses vec when :as-array? is true. if you process the result as a seq after that, seqs on vectors are chunked, while the seq from the doall is not, so you can get very different behaviour

:as-array? (rows as vectors) seems like it should be orthogonal to changing chunking

Comment by Sean Corfield [ 27/Feb/15 4:33 PM ]

Good catch. So use doall in both cases and convert via vec in the :as-array? case at the end?

Comment by Sean Corfield [ 27/Feb/15 4:34 PM ]

(or (comp vec doall) perhaps?)

Comment by Kevin Downey [ 27/Feb/15 6:23 PM ]

it doesn't matter how you construct the pvector, calling seq on it will return a chunked seq https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java#L277-L279

Comment by Kevin Downey [ 27/Feb/15 6:29 PM ]

the issue, I guess, isn't the chunking, it is changing the return type of the collection based on :is-array?. one of the differences between the two return types is the chunkedness of the seq you get by calling seq on each

Generated at Wed Mar 04 12:46:38 CST 2015 using JIRA 4.4#649-r158309.