@@ -701,20 +701,17 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
701701 UNIT_ASSERT_UNEQUAL (exMode, EEx::IfExists);
702702 const TString ifNotExistsStatement = exMode == EEx::IfNotExists ? " IF NOT EXISTS" : " " ;
703703 const TString objType = isStore ? " TABLESTORE" : " TABLE" ;
704- const TString sql = fmt::format (R"sql(
705- CREATE {obj_type} {if_not_exists} {obj_path} (
704+ auto sql = TStringBuilder () << R"(
705+ --!syntax_v1
706+ CREATE )" << objType << " " << ifNotExistsStatement << " `" << objPath << R"( ` (
706707 Key Uint64 NOT NULL,
707708 Value String,
708709 PRIMARY KEY (Key)
709710 )
710711 WITH (
711712 STORE = COLUMN,
712713 AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 10
713- );)sql" ,
714- " obj_type" _a = objType,
715- " if_not_exists" _a = ifNotExistsStatement,
716- " obj_path" _a = objPath
717- );
714+ );)" ;
718715
719716 auto result = db.ExecuteQuery (sql, TTxControl::NoTx ()).ExtractValueSync ();
720717 if (expectSuccess) {
@@ -727,29 +724,36 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
727724
728725 auto checkAlter = [&](const TString& objPath, bool isStore) {
729726 const TString objType = isStore ? " TABLESTORE" : " TABLE" ;
730- const TString sql = fmt::format (R"sql(
731- ALTER {obj_type} {obj_path} (
732- SET (AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 10)
733- );)sql" ,
734- " obj_type" _a = objType,
735- " obj_path" _a = objPath
736- );
727+ {
728+ auto sql = TStringBuilder () << R"(
729+ --!syntax_v1
730+ ALTER )" << objType << " `" << objPath << R"( `
731+ ADD COLUMN NewColumn Uint64;
732+ ;)" ;
737733
738- auto result = db.ExecuteQuery (sql, TTxControl::NoTx ()).ExtractValueSync ();
734+ auto result = db.ExecuteQuery (sql, TTxControl::NoTx ()).ExtractValueSync ();
735+ UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::SUCCESS, result.GetIssues ().ToString ());
736+ }
737+ {
738+ auto sql = TStringBuilder () << R"(
739+ --!syntax_v1
740+ ALTER )" << objType << " `" << objPath << R"( `
741+ DROP COLUMN NewColumn;
742+ ;)" ;
743+
744+ auto result = db.ExecuteQuery (sql, TTxControl::NoTx ()).ExtractValueSync ();
745+ UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::SUCCESS, result.GetIssues ().ToString ());
746+ }
739747 };
740748
741749 auto checkDrop = [&](bool expectSuccess, EEx exMode,
742750 const TString& objPath, bool isStore) {
743751 UNIT_ASSERT_UNEQUAL (exMode, EEx::IfNotExists);
744752 const TString ifExistsStatement = exMode == EEx::IfExists ? " IF EXISTS" : " " ;
745753 const TString objType = isStore ? " TABLESTORE" : " TABLE" ;
746- const TString sql = fmt::format (R"sql(
747- DROP {obj_type} {if_exists} {obj_path};
748- )sql" ,
749- " obj_type" _a = objType,
750- " if_exists" _a = ifExistsStatement,
751- " obj_path" _a = objPath
752- );
754+ auto sql = TStringBuilder () << R"(
755+ --!syntax_v1
756+ DROP )" << objType << " " << ifExistsStatement << " `" << objPath << R"( `;)" ;
753757
754758 auto result = db.ExecuteQuery (sql, TTxControl::NoTx ()).ExtractValueSync ();
755759 if (expectSuccess) {
@@ -779,7 +783,7 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
779783
780784 auto settings = NYdb::NTable::TDescribeTableSettings ().WithTableStatistics (true );
781785 auto describeResult =
782- testHelper.GetSession ().DescribeTable (" /Root/TableStoreTest/ColumnTableTest " , settings).GetValueSync ();
786+ testHelper.GetSession ().DescribeTable (objPath , settings).GetValueSync ();
783787
784788 UNIT_ASSERT_C (describeResult.IsSuccess (), describeResult.GetIssues ().ToString ());
785789
@@ -792,26 +796,26 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
792796 checkCreate (true , EEx::Empty, " /Root/TableStoreTest" , true );
793797 checkCreate (false , EEx::Empty, " /Root/TableStoreTest" , true );
794798 checkCreate (true , EEx::IfNotExists, " /Root/TableStoreTest" , true );
795- checkAlter (" /Root/TableStoreTest" , true );
796799 checkDrop (true , EEx::Empty, " /Root/TableStoreTest" , true );
797800 checkDrop (true , EEx::IfExists, " /Root/TableStoreTest" , true );
798801 checkDrop (false , EEx::Empty, " /Root/TableStoreTest" , true );
799802
800803 checkCreate (true , EEx::IfNotExists, " /Root/TableStoreTest" , true );
801804 checkCreate (false , EEx::Empty, " /Root/TableStoreTest" , true );
802- checkAlter (" /Root/TableStoreTest" , true );
803805 checkDrop (true , EEx::IfExists, " /Root/TableStoreTest" , true );
804806 checkDrop (false , EEx::Empty, " /Root/TableStoreTest" , true );
805807
806- checkCreate (true , EEx::IfNotExists, " /Root/TableStoreTest" , true );
807- checkCreate (true , EEx::Empty, " /Root/TableStoreTest/ColumnTable" , false );
808- checkCreate (false , EEx::Empty, " /Root/TableStoreTest/ColumnTable" , false );
809- checkCreate (true , EEx::IfNotExists, " /Root/TableStoreTest/ColumnTable" , false );
810- checkAddRow (" /Root/TableStoreTest/ColumnTable" );
811- checkDrop (true , EEx::IfExists, " /Root/TableStoreTest/ColumnTable" , false );
812- checkDrop (false , EEx::Empty, " /Root/TableStoreTest/ColumnTable" , false );
813- checkDrop (true , EEx::IfExists, " /Root/TableStoreTest/ColumnTable" , false );
814- checkDrop (false , EEx::Empty, " /Root/TableStoreTest" , true );
808+ checkCreate (true , EEx::IfNotExists, " /Root/ColumnTable" , false );
809+ checkAlter (" /Root/ColumnTable" , false );
810+ checkDrop (true , EEx::IfExists, " /Root/ColumnTable" , false );
811+
812+ checkCreate (true , EEx::Empty, " /Root/ColumnTable" , false );
813+ checkCreate (false , EEx::Empty, " /Root/ColumnTable" , false );
814+ checkCreate (true , EEx::IfNotExists, " /Root/ColumnTable" , false );
815+ checkAddRow (" /Root/ColumnTable" );
816+ checkDrop (true , EEx::IfExists, " /Root/ColumnTable" , false );
817+ checkDrop (false , EEx::Empty, " /Root/ColumnTable" , false );
818+ checkDrop (true , EEx::IfExists, " /Root/ColumnTable" , false );
815819 }
816820
817821 Y_UNIT_TEST (DdlUser) {
0 commit comments