@@ -688,6 +688,18 @@ TEST(VersionStore, AppendRefKeyOptimisation) {
688688 ASSERT_TRUE (it == std::end (all_index_keys));
689689}
690690
691+ auto get_frame_from_read_output (const auto & read_result) {
692+ return arcticdb::util::variant_match (
693+ read_result,
694+ [](const arcticdb::version_store::ReadVersionOutput& output){
695+ return output.frame_and_descriptor_ .frame_ ;
696+ },
697+ [](const arcticdb::version_store::ReadVersionWithNodesOutput& output){
698+ return output.root_ .frame_and_descriptor_ .frame_ ;
699+ }
700+ );
701+ }
702+
691703TEST (VersionStore, UpdateWithin) {
692704 using namespace arcticdb ;
693705 using namespace arcticdb ::storage;
@@ -724,15 +736,7 @@ TEST(VersionStore, UpdateWithin) {
724736 auto read_result = version_store.read_dataframe_version_internal (
725737 symbol, VersionQuery{}, read_query, ReadOptions{}, handler_data
726738 );
727- const auto & seg = util::variant_match (
728- read_result,
729- [](const arcticdb::version_store::ReadVersionOutput& output) -> const SegmentInMemory& {
730- return output.frame_and_descriptor_ .frame_ ;
731- },
732- [](const arcticdb::version_store::ReadVersionWithNodesOutput& output) -> const SegmentInMemory& {
733- return output.root_ .frame_and_descriptor_ .frame_ ;
734- }
735- );
739+ const auto & seg = get_frame_from_read_output (read_result);
736740
737741 for (auto i = 0u ; i < num_rows; ++i) {
738742 const uint8_t expected = update_range.contains (i) ? i + update_val : i;
@@ -776,15 +780,7 @@ TEST(VersionStore, UpdateBefore) {
776780 auto read_result = version_store.read_dataframe_version_internal (
777781 symbol, VersionQuery{}, read_query, ReadOptions{}, handler_data
778782 );
779- const auto & seg = util::variant_match (
780- read_result,
781- [](const arcticdb::version_store::ReadVersionOutput& output) -> const SegmentInMemory& {
782- return output.frame_and_descriptor_ .frame_ ;
783- },
784- [](const arcticdb::version_store::ReadVersionWithNodesOutput& output) -> const SegmentInMemory& {
785- return output.root_ .frame_and_descriptor_ .frame_ ;
786- }
787- );
783+ const auto & seg = get_frame_from_read_output (read_result);
788784
789785 for (auto i = 0u ; i < num_rows + update_range.diff (); ++i) {
790786 const auto expected = update_range.contains (i) ? i + update_val : i;
@@ -828,7 +824,7 @@ TEST(VersionStore, UpdateAfter) {
828824 auto read_result = version_store.read_dataframe_version_internal (
829825 symbol, VersionQuery{}, read_query, ReadOptions{}, handler_data
830826 );
831- const auto & seg = read_result. root_ . frame_and_descriptor_ . frame_ ;
827+ const auto & seg = get_frame_from_read_output ( read_result) ;
832828
833829 for (auto i = 0u ; i < num_rows + update_range.diff (); ++i) {
834830 const auto expected = update_range.contains (i) ? i + update_val : i;
@@ -872,15 +868,7 @@ TEST(VersionStore, UpdateIntersectBefore) {
872868 auto read_result = version_store.read_dataframe_version_internal (
873869 symbol, VersionQuery{}, read_query, ReadOptions{}, handler_data
874870 );
875- const auto & seg = util::variant_match (
876- read_result,
877- [](const arcticdb::version_store::ReadVersionOutput& output) -> const SegmentInMemory& {
878- return output.frame_and_descriptor_ .frame_ ;
879- },
880- [](const arcticdb::version_store::ReadVersionWithNodesOutput& output) -> const SegmentInMemory& {
881- return output.root_ .frame_and_descriptor_ .frame_ ;
882- }
883- );
871+ const auto & seg = get_frame_from_read_output (read_result);
884872
885873 for (auto i = 0u ; i < num_rows + 5 ; ++i) {
886874 const auto expected = update_range.contains (i) ? i + update_val : i;
@@ -924,15 +912,7 @@ TEST(VersionStore, UpdateIntersectAfter) {
924912 auto read_result = version_store.read_dataframe_version_internal (
925913 symbol, VersionQuery{}, read_query, ReadOptions{}, handler_data
926914 );
927- const auto & seg = util::variant_match (
928- read_result,
929- [](const arcticdb::version_store::ReadVersionOutput& output) -> const SegmentInMemory& {
930- return output.frame_and_descriptor_ .frame_ ;
931- },
932- [](const arcticdb::version_store::ReadVersionWithNodesOutput& output) -> const SegmentInMemory& {
933- return output.root_ .frame_and_descriptor_ .frame_ ;
934- }
935- );
915+ const auto & seg = get_frame_from_read_output (read_result);
936916
937917 for (auto i = 0u ; i < num_rows + 5 ; ++i) {
938918 const auto expected = update_range.contains (i) ? i + update_val : i;
@@ -986,15 +966,7 @@ TEST(VersionStore, UpdateWithinSchemaChange) {
986966 auto read_result = version_store.read_dataframe_version_internal (
987967 symbol, VersionQuery{}, read_query, read_options, handler_data
988968 );
989- const auto & seg = util::variant_match (
990- read_result,
991- [](const arcticdb::version_store::ReadVersionOutput& output) -> const SegmentInMemory& {
992- return output.frame_and_descriptor_ .frame_ ;
993- },
994- [](const arcticdb::version_store::ReadVersionWithNodesOutput& output) -> const SegmentInMemory& {
995- return output.root_ .frame_and_descriptor_ .frame_ ;
996- }
997- );
969+ const auto & seg = get_frame_from_read_output (read_result);
998970
999971 for (auto i = 0u ; i < num_rows; ++i) {
1000972 auto expected = update_range.contains (i) ? i + update_val : i;
@@ -1058,15 +1030,7 @@ TEST(VersionStore, UpdateWithinTypeAndSchemaChange) {
10581030 auto read_result = version_store.read_dataframe_version_internal (
10591031 symbol, VersionQuery{}, read_query, read_options, handler_data
10601032 );
1061- const auto & seg = util::variant_match (
1062- read_result,
1063- [](const arcticdb::version_store::ReadVersionOutput& output) -> const SegmentInMemory& {
1064- return output.frame_and_descriptor_ .frame_ ;
1065- },
1066- [](const arcticdb::version_store::ReadVersionWithNodesOutput& output) -> const SegmentInMemory& {
1067- return output.root_ .frame_and_descriptor_ .frame_ ;
1068- }
1069- );
1033+ const auto & seg = get_frame_from_read_output (read_result);
10701034
10711035 for (auto i = 0u ; i < num_rows; ++i) {
10721036 auto expected = update_range.contains (i) ? i + update_val : i;
0 commit comments