@@ -609,6 +609,55 @@ TEST_P(DataIntegrationTest, TableApplyWithLogging) {
609609 EXPECT_THAT (log.ExtractLines (), Not (Contains (HasSubstr (" MutateRow" ))));
610610}
611611
612+ TEST_P (DataIntegrationTest, ClientQueryColumnFamily) {
613+ auto const & table_id = testing::TableTestEnvironment::table_id ();
614+ auto conn = MakeDataConnection (Options{}.set <DataRetryPolicyOption>(
615+ DataLimitedErrorCountRetryPolicy (0 ).clone ()));
616+ auto table = Table (std::move (conn),
617+ TableResource (project_id (), instance_id (), table_id));
618+ std::string const row_key = " row-key-for-client-query-test" ;
619+ std::string const family = kFamily4 ;
620+ std::string const column1 = " c1" ;
621+ std::string const column2 = " c2" ;
622+ std::string const value1 = " v1" ;
623+ std::string const value2 = " v2" ;
624+
625+ std::vector<Cell> created{
626+ {row_key, family, column1, 0 , value1},
627+ {row_key, family, column2, 0 , value2},
628+ };
629+ BulkApply (table, created);
630+ auto data_connection = table.connection ();
631+ auto client = Client (data_connection, Options{});
632+ std::vector<std::string> full_table_path =
633+ absl::StrSplit (table.table_name (), ' /' );
634+ auto const & table_name = full_table_path.back ();
635+ std::string quoted_table_name = " `" + table_name + " `" ;
636+ Project project (project_id ());
637+ InstanceResource instance_resource (project, instance_id ());
638+ auto prepared_query = client.PrepareQuery (
639+ instance_resource,
640+ SqlStatement (" SELECT family4 AS c0 FROM " + quoted_table_name +
641+ " WHERE _key = '" + row_key + " '" ));
642+ ASSERT_STATUS_OK (prepared_query);
643+
644+ auto bound_query = prepared_query->BindParameters ({});
645+ auto row_stream = client.ExecuteQuery (std::move (bound_query));
646+
647+ std::vector<StatusOr<bigtable::QueryRow>> rows;
648+ for (auto const & row : std::move (row_stream)) {
649+ rows.push_back (row);
650+ }
651+
652+ ASSERT_EQ (rows.size (), 1 );
653+ ASSERT_STATUS_OK (rows[0 ]);
654+ auto const & row1 = *rows[0 ];
655+ ASSERT_EQ (row1.columns ().at (0 ), column1);
656+ ASSERT_EQ (row1.columns ().at (1 ), column2);
657+ ASSERT_EQ (row1.values ().at (0 ), Value (value1));
658+ ASSERT_EQ (row1.values ().at (1 ), Value (value2));
659+ }
660+
612661// TODO(#8800) - remove after deprecation is complete
613662#include " google/cloud/internal/disable_deprecation_warnings.inc"
614663
0 commit comments