@@ -650,7 +650,7 @@ TEST_P(DataIntegrationTest, ClientQueryColumnFamily) {
650650
651651 auto prepared_query = client.PrepareQuery (
652652 instance_resource,
653- SqlStatement (" SELECT family4 AS family4 FROM " + quoted_table_name +
653+ SqlStatement (" SELECT family4 FROM " + quoted_table_name +
654654 " WHERE _key = '" + row_key + " '" ));
655655
656656 ASSERT_STATUS_OK (prepared_query);
@@ -762,63 +762,61 @@ TEST_P(DataIntegrationTest, ClientQueryColumnFamilyWithHistory) {
762762 auto value_hist = row.get (" family4_history" );
763763 ASSERT_TRUE (value_hist.ok ()) << value_hist.status ().message ();
764764 Value const & bigtable_val = *value_hist;
765- std::cout << bigtable_val << std::endl;
766- using HistoryEntry = std::unordered_map<std::string, std::string>;
765+ std::cout << bigtable_val << std::endl;
766+ using HistoryEntry = std::tuple<std::pair<std::string, Timestamp>,
767+ std::pair<std::string, Bytes>>;
767768 auto history_map =
768- bigtable_val
769- .get <std::unordered_map<std::string, std::vector<HistoryEntry>>>();
769+ bigtable_val.get <std::unordered_map<Bytes, std::vector<HistoryEntry>>>();
770770 ASSERT_TRUE (history_map.ok ()) << history_map.status ().message ();
771771 ASSERT_EQ (history_map->size (), 2 );
772772
773- // Verify cells returned ordered from newest to oldest.
774- auto c1_entry0 = (*history_map)[" c1" ][0 ];
773+ // Verify the new version of "c1"
774+ auto c1_entry0 = (*history_map)[Bytes ( " c1" ) ][0 ];
775775 auto c1_ts_new =
776- bigtable_internal::TimestampFromRFC3339 (c1_entry0[" timestamp" ])
777- .value ()
778- .get <sys_time<std::chrono::microseconds>>();
776+ std::get<0 >(c1_entry0).second .get <sys_time<std::chrono::microseconds>>();
779777 ASSERT_STATUS_OK (c1_ts_new);
780778 auto c1_expected_current_time_ms =
781779 duration_cast<milliseconds>(std::chrono::microseconds (current_time));
782780 EXPECT_EQ (duration_cast<milliseconds>(c1_ts_new->time_since_epoch ()),
783781 c1_expected_current_time_ms);
784- EXPECT_EQ (c1_entry0[" value" ], column_1_value_new);
782+ EXPECT_EQ (std::get<1 >(c1_entry0).second .get <std::string>(),
783+ column_1_value_new);
785784
786- auto c1_entry1 = (*history_map)[" c1" ][1 ];
785+ // Verify the old version of "c1"
786+ auto c1_entry1 = (*history_map)[Bytes (" c1" )][1 ];
787787 auto c1_ts_old =
788- bigtable_internal::TimestampFromRFC3339 (c1_entry1[" timestamp" ])
789- .value ()
790- .get <sys_time<std::chrono::microseconds>>();
788+ std::get<0 >(c1_entry1).second .get <sys_time<std::chrono::microseconds>>();
791789 ASSERT_STATUS_OK (c1_ts_old);
792790 auto c1_expected_old_time_ms =
793791 duration_cast<milliseconds>(std::chrono::microseconds (old_time));
794792 EXPECT_EQ (duration_cast<milliseconds>(c1_ts_old->time_since_epoch ()),
795793 c1_expected_old_time_ms);
796- EXPECT_EQ (c1_entry1[" value" ], column_1_value_old);
794+ EXPECT_EQ (std::get<1 >(c1_entry1).second .get <std::string>(),
795+ column_1_value_new);
797796
798- // Verify cells returned ordered from newest to oldest.
799- auto c2_entry0 = (*history_map)[" c2" ][0 ];
797+ // Verify the new version of "c2"
798+ auto c2_entry0 = (*history_map)[Bytes ( " c2" ) ][0 ];
800799 auto c2_ts_new =
801- bigtable_internal::TimestampFromRFC3339 (c2_entry0[" timestamp" ])
802- .value ()
803- .get <sys_time<std::chrono::microseconds>>();
800+ std::get<0 >(c2_entry0).second .get <sys_time<std::chrono::microseconds>>();
804801 ASSERT_STATUS_OK (c2_ts_new);
805802 auto c2_expected_current_time_ms =
806803 duration_cast<milliseconds>(std::chrono::microseconds (current_time));
807804 EXPECT_EQ (duration_cast<milliseconds>(c2_ts_new->time_since_epoch ()),
808805 c2_expected_current_time_ms);
809- EXPECT_EQ (c2_entry0[" value" ], column_2_value_new);
806+ EXPECT_EQ (std::get<1 >(c2_entry0).second .get <std::string>(),
807+ column_2_value_new);
810808
811- auto c2_entry1 = (*history_map)[" c2" ][1 ];
809+ // Verify the old version of "c2"
810+ auto c2_entry1 = (*history_map)[Bytes (" c2" )][1 ];
812811 auto c2_ts_old =
813- bigtable_internal::TimestampFromRFC3339 (c2_entry1[" timestamp" ])
814- .value ()
815- .get <sys_time<std::chrono::microseconds>>();
812+ std::get<0 >(c2_entry1).second .get <sys_time<std::chrono::microseconds>>();
816813 ASSERT_STATUS_OK (c2_ts_old);
817814 auto c2_expected_old_time_ms =
818815 duration_cast<milliseconds>(std::chrono::microseconds (old_time));
819816 EXPECT_EQ (duration_cast<milliseconds>(c2_ts_old->time_since_epoch ()),
820817 c2_expected_old_time_ms);
821- EXPECT_EQ (c2_entry1[" value" ], column_2_value_old);
818+ EXPECT_EQ (std::get<1 >(c2_entry1).second .get <std::string>(),
819+ column_2_value_new);
822820}
823821
824822// TODO(#8800) - remove after deprecation is complete
0 commit comments