@@ -57,6 +57,9 @@ class TReplaceKeyTemplate {
5757 , Position(position)
5858 {
5959 Y_ABORT_UNLESS (Size () > 0 && Position < (ui64)Column (0 ).length ());
60+ for (auto && i : *Columns) {
61+ Types.emplace_back (i->type_id ());
62+ }
6063 }
6164
6265 template <typename T = TArrayVecPtr> requires IsOwning
@@ -65,13 +68,16 @@ class TReplaceKeyTemplate {
6568 , Position(position)
6669 {
6770 Y_ABORT_UNLESS (Size () > 0 && Position < (ui64)Column (0 ).length ());
71+ for (auto && i : *Columns) {
72+ Types.emplace_back (i->type_id ());
73+ }
6874 }
6975
7076 template <typename T>
7177 bool operator == (const TReplaceKeyTemplate<T>& key) const {
7278 Y_ABORT_UNLESS (Size () == key.Size ());
7379
74- for (int i = 0 ; i < Size (); ++i) {
80+ for (ui32 i = 0 ; i < Size (); ++i) {
7581 auto cmp = CompareColumnValue (i, key, i);
7682 if (std::is_neq (cmp)) {
7783 return false ;
@@ -84,7 +90,7 @@ class TReplaceKeyTemplate {
8490 std::partial_ordering operator <=> (const TReplaceKeyTemplate<T>& key) const {
8591 Y_ABORT_UNLESS (Size () == key.Size ());
8692
87- for (int i = 0 ; i < Size (); ++i) {
93+ for (ui32 i = 0 ; i < Size (); ++i) {
8894 auto cmp = CompareColumnValue (i, key, i);
8995 if (std::is_neq (cmp)) {
9096 return cmp;
@@ -97,7 +103,7 @@ class TReplaceKeyTemplate {
97103 std::partial_ordering CompareNotNull (const TReplaceKeyTemplate<T>& key) const {
98104 Y_ABORT_UNLESS (Size () == key.Size ());
99105
100- for (int i = 0 ; i < Size (); ++i) {
106+ for (ui32 i = 0 ; i < Size (); ++i) {
101107 auto cmp = CompareColumnValueNotNull (i, key, i);
102108 if (std::is_neq (cmp)) {
103109 return cmp;
@@ -107,11 +113,11 @@ class TReplaceKeyTemplate {
107113 }
108114
109115 template <typename T>
110- std::partial_ordering ComparePartNotNull (const TReplaceKeyTemplate<T>& key, int size) const {
116+ std::partial_ordering ComparePartNotNull (const TReplaceKeyTemplate<T>& key, const ui32 size) const {
111117 Y_ABORT_UNLESS (size <= key.Size ());
112118 Y_ABORT_UNLESS (size <= Size ());
113119
114- for (int i = 0 ; i < size; ++i) {
120+ for (ui32 i = 0 ; i < size; ++i) {
115121 auto cmp = CompareColumnValueNotNull (i, key, i);
116122 if (std::is_neq (cmp)) {
117123 return cmp;
@@ -130,11 +136,13 @@ class TReplaceKeyTemplate {
130136 template <typename T>
131137 std::partial_ordering CompareColumnValue (int column, const TReplaceKeyTemplate<T>& key, int keyColumn) const {
132138 Y_DEBUG_ABORT_UNLESS (Column (column).type_id () == key.Column (keyColumn).type_id ());
139+ Y_DEBUG_ABORT_UNLESS (Types[column] == Column (column).type_id ());
140+ Y_DEBUG_ABORT_UNLESS (Types.size () == Size ());
133141
134- return TComparator::TypedCompare <false >(Column (column), Position, key.Column (keyColumn), key.Position );
142+ return TComparator::ConcreteTypedCompare <false >(Types[column], Column (column), Position, key.Column (keyColumn), key.Position );
135143 }
136144
137- int Size () const {
145+ ui64 Size () const {
138146 Y_DEBUG_ABORT_UNLESS (Columns);
139147 return Columns->size ();
140148 }
@@ -166,7 +174,7 @@ class TReplaceKeyTemplate {
166174
167175 template <typename T = TArrayVecPtr> requires IsOwning
168176 std::shared_ptr<arrow::RecordBatch> RestoreBatch (const std::shared_ptr<arrow::Schema>& schema) const {
169- AFL_VERIFY (Size () && Size () == schema->num_fields ())(" columns" , DebugString ())(" schema" , JoinSeq (" ," , schema->field_names ()));
177+ AFL_VERIFY (Size () && Size () == (ui32) schema->num_fields ())(" columns" , DebugString ())(" schema" , JoinSeq (" ," , schema->field_names ()));
170178 const auto & columns = *Columns;
171179 return arrow::RecordBatch::Make (schema, columns[0 ]->length (), columns);
172180 }
@@ -220,6 +228,7 @@ class TReplaceKeyTemplate {
220228
221229private:
222230 TArrayVecPtr Columns = nullptr ;
231+ std::vector<arrow::Type::type> Types;
223232 ui64 Position = 0 ;
224233
225234};
0 commit comments