@@ -57,6 +57,10 @@ pub struct LineData<'a> {
5757 pub collation_key_buffer : Vec < u8 > ,
5858 /// End offsets into `collation_key_buffer` for each line's sort key.
5959 pub collation_key_ends : Vec < usize > ,
60+ /// Tracks whether each line's sort key was computed from a truncated prefix.
61+ /// When `true`, prefix sort keys that compare equal must fall back to full
62+ /// locale comparison.
63+ pub collation_key_truncated : Vec < bool > ,
6064}
6165
6266impl LineData < ' _ > {
@@ -83,6 +87,7 @@ impl Chunk {
8387 contents. line_data . line_num_floats . clear ( ) ;
8488 contents. line_data . collation_key_buffer . clear ( ) ;
8589 contents. line_data . collation_key_ends . clear ( ) ;
90+ contents. line_data . collation_key_truncated . clear ( ) ;
8691 contents. token_buffer . clear ( ) ;
8792 let lines = unsafe {
8893 // SAFETY: It is safe to (temporarily) transmute to a vector of lines with a longer lifetime,
@@ -108,6 +113,9 @@ impl Chunk {
108113 line_num_floats : std:: mem:: take ( & mut contents. line_data . line_num_floats ) ,
109114 collation_key_buffer : std:: mem:: take ( & mut contents. line_data . collation_key_buffer ) ,
110115 collation_key_ends : std:: mem:: take ( & mut contents. line_data . collation_key_ends ) ,
116+ collation_key_truncated : std:: mem:: take (
117+ & mut contents. line_data . collation_key_truncated ,
118+ ) ,
111119 token_buffer : std:: mem:: take ( & mut contents. token_buffer ) ,
112120 line_count_hint : contents. line_count_hint ,
113121 // buffer is set below after we consume `self`
@@ -135,6 +143,7 @@ pub struct RecycledChunk {
135143 line_num_floats : Vec < Option < f64 > > ,
136144 collation_key_buffer : Vec < u8 > ,
137145 collation_key_ends : Vec < usize > ,
146+ collation_key_truncated : Vec < bool > ,
138147 token_buffer : Vec < Range < usize > > ,
139148 line_count_hint : usize ,
140149 buffer : Vec < u8 > ,
@@ -150,6 +159,7 @@ impl RecycledChunk {
150159 line_num_floats : Vec :: new ( ) ,
151160 collation_key_buffer : Vec :: new ( ) ,
152161 collation_key_ends : Vec :: new ( ) ,
162+ collation_key_truncated : Vec :: new ( ) ,
153163 token_buffer : Vec :: new ( ) ,
154164 line_count_hint : 0 ,
155165 buffer : vec ! [ 0 ; capacity] ,
@@ -197,6 +207,7 @@ pub fn read<T: Read>(
197207 line_num_floats,
198208 collation_key_buffer,
199209 collation_key_ends,
210+ collation_key_truncated,
200211 mut token_buffer,
201212 mut line_count_hint,
202213 mut buffer,
@@ -237,6 +248,7 @@ pub fn read<T: Read>(
237248 line_num_floats,
238249 collation_key_buffer,
239250 collation_key_ends,
251+ collation_key_truncated,
240252 } ;
241253 parse_lines (
242254 read,
0 commit comments