@@ -122,16 +122,16 @@ tsl_recompress_chunk_segmentwise(PG_FUNCTION_ARGS)
122122 "compression with no "
123123 "order by" )));
124124 }
125- bool nullable_orderby = !is_chunk_orderby_nonnullable (settings );
126- if (nullable_orderby )
125+ bool orderby_not_handling_nulls = !is_chunk_orderby_nullhandling (settings );
126+ if (orderby_not_handling_nulls )
127127 {
128128 elog (ts_guc_debug_compression_path_info ? INFO : DEBUG1 ,
129- "in-memory recompression is disabled due to nullable order by, "
129+ "in-memory recompression is disabled due to nullable order by with no firstlast , "
130130 "performing segmentwise decompress/compress on chunk \"%s.%s\"" ,
131131 NameStr (chunk -> fd .schema_name ),
132132 NameStr (chunk -> fd .table_name ));
133133 }
134- recompress_chunk_segmentwise_impl (chunk , nullable_orderby );
134+ recompress_chunk_segmentwise_impl (chunk , orderby_not_handling_nulls );
135135 }
136136
137137 PG_RETURN_OID (uncompressed_relid );
@@ -1063,6 +1063,7 @@ update_orderby_scankeys(Datum *values, bool *isnulls, int num_segmentby, int num
10631063static enum Batch_match_result
10641064handle_null_scan (int key_flags , bool nulls_first , enum Batch_match_result result )
10651065{
1066+ /* uncompressed tuple key is NULL */
10661067 if (key_flags & SK_ISNULL )
10671068 {
10681069 return nulls_first ? Tuple_before : Tuple_after ;
@@ -1086,18 +1087,17 @@ match_tuple_batch(TupleTableSlot *compressed_slot, int num_orderby, ScanKey orde
10861087 if (num_orderby >= 1 )
10871088 {
10881089 ScanKey key = & orderby_scankeys [0 ];
1089- if (!slot_key_test (compressed_slot , key ))
1090+ if (!slot_key_test (compressed_slot , key , nulls_first [ 0 ] ))
10901091 {
10911092 return handle_null_scan (key -> sk_flags , nulls_first [0 ], Tuple_before );
10921093 }
10931094
10941095 key = & orderby_scankeys [1 ];
1095- if (!slot_key_test (compressed_slot , key ))
1096+ if (!slot_key_test (compressed_slot , key , nulls_first [ 0 ] ))
10961097 {
10971098 return handle_null_scan (key -> sk_flags , nulls_first [0 ], Tuple_after );
10981099 }
10991100 }
1100-
11011101 return Tuple_match ;
11021102}
11031103
0 commit comments