@@ -919,42 +919,48 @@ public void testTableStatisticsOps() throws Exception {
919919 List <ColumnStatistics > tabColStats ;
920920 try (AutoCloseable c = deadline ()) {
921921 tabColStats = objectStore .getTableColumnStatistics (DEFAULT_CATALOG_NAME , DB1 , TABLE1 ,
922- Arrays .asList ("test_col1" , "test_col2 " ));
922+ Arrays .asList ("test_col1" , "test_col' 2 " ));
923923 }
924924 Assert .assertEquals (0 , tabColStats .size ());
925925
926926 ColumnStatisticsDesc statsDesc = new ColumnStatisticsDesc (true , DB1 , TABLE1 );
927927 ColumnStatisticsObj statsObj1 = new ColumnStatisticsObj ("test_col1" , "int" ,
928928 new ColumnStatisticsData (ColumnStatisticsData ._Fields .DECIMAL_STATS , new DecimalColumnStatsData (100 , 1000 )));
929- ColumnStatisticsObj statsObj2 = new ColumnStatisticsObj ("test_col2 " , "int" ,
929+ ColumnStatisticsObj statsObj2 = new ColumnStatisticsObj ("test_col' 2 " , "int" ,
930930 new ColumnStatisticsData (ColumnStatisticsData ._Fields .DECIMAL_STATS , new DecimalColumnStatsData (200 , 2000 )));
931931 ColumnStatistics colStats = new ColumnStatistics (statsDesc , Arrays .asList (statsObj1 , statsObj2 ));
932932 colStats .setEngine (ENGINE );
933933 objectStore .updateTableColumnStatistics (colStats , null , 0 );
934934
935935 try (AutoCloseable c = deadline ()) {
936936 tabColStats = objectStore .getTableColumnStatistics (DEFAULT_CATALOG_NAME , DB1 , TABLE1 ,
937- Arrays .asList ("test_col1" , "test_col2 " ));
937+ Arrays .asList ("test_col1" , "test_col' 2 " ));
938938 }
939939 Assert .assertEquals (1 , tabColStats .size ());
940940 Assert .assertEquals (2 , tabColStats .get (0 ).getStatsObjSize ());
941941
942942 objectStore .deleteTableColumnStatistics (DEFAULT_CATALOG_NAME , DB1 , TABLE1 , "test_col1" , ENGINE );
943943 try (AutoCloseable c = deadline ()) {
944944 tabColStats = objectStore .getTableColumnStatistics (DEFAULT_CATALOG_NAME , DB1 , TABLE1 ,
945- Arrays .asList ("test_col1" , "test_col2 " ));
945+ Arrays .asList ("test_col1" , "test_col' 2 " ));
946946 }
947947 Assert .assertEquals (1 , tabColStats .size ());
948948 Assert .assertEquals (1 , tabColStats .get (0 ).getStatsObjSize ());
949949
950- objectStore .deleteTableColumnStatistics (DEFAULT_CATALOG_NAME , DB1 , TABLE1 , "test_col2 " , ENGINE );
950+ objectStore .deleteTableColumnStatistics (DEFAULT_CATALOG_NAME , DB1 , TABLE1 , "test_col' 2 " , ENGINE );
951951 try (AutoCloseable c = deadline ()) {
952952 tabColStats = objectStore .getTableColumnStatistics (DEFAULT_CATALOG_NAME , DB1 , TABLE1 ,
953- Arrays .asList ("test_col1" , "test_col2 " ));
953+ Arrays .asList ("test_col1" , "test_col' 2 " ));
954954 }
955955 Assert .assertEquals (0 , tabColStats .size ());
956956 }
957957
958+ @ Test
959+ public void testDeleteTableColumnStatisticsWhenEngineHasSpecialCharacter () throws Exception {
960+ createPartitionedTable (true , true );
961+ objectStore .deleteTableColumnStatistics (DEFAULT_CATALOG_NAME , DB1 , TABLE1 , "test_col1" , "special '" );
962+ }
963+
958964 @ Test
959965 public void testPartitionStatisticsOps () throws Exception {
960966 createPartitionedTable (true , true );
@@ -1006,6 +1012,14 @@ public void testPartitionStatisticsOps() throws Exception {
10061012 Assert .assertEquals (0 , stat .size ());
10071013 }
10081014
1015+ @ Test
1016+ public void testDeletePartitionColumnStatisticsWhenEngineHasSpecialCharacter () throws Exception {
1017+ createPartitionedTable (true , true );
1018+ objectStore .deletePartitionColumnStatistics (DEFAULT_CATALOG_NAME , DB1 , TABLE1 ,
1019+ "test_part_col=a2" , List .of ("a2" ), null , "special '" );
1020+ }
1021+
1022+
10091023 @ Test
10101024 public void testAggrStatsUseDB () throws Exception {
10111025 Configuration conf2 = MetastoreConf .newMetastoreConf (conf );
@@ -1051,7 +1065,7 @@ private void createPartitionedTable(boolean withPrivileges, boolean withStatisti
10511065 .setDbName (DB1 )
10521066 .setTableName (TABLE1 )
10531067 .addCol ("test_col1" , "int" )
1054- .addCol ("test_col2 " , "int" )
1068+ .addCol ("test_col' 2 " , "int" )
10551069 .addPartCol ("test_part_col" , "int" )
10561070 .addCol ("test_bucket_col" , "int" , "test bucket col comment" )
10571071 .addCol ("test_skewed_col" , "int" , "test skewed col comment" )
@@ -1239,6 +1253,12 @@ protected Database getJdoResult(ObjectStore.GetHelper<Database> ctx) throws Meta
12391253 Assert .assertEquals (1 , directSqlErrors .getCount ());
12401254 }
12411255
1256+ @ Test (expected = MetaException .class )
1257+ public void testLockDbTableThrowsExceptionWhenTableIsNotAllowedToLock () throws Exception {
1258+ MetaStoreDirectSql metaStoreDirectSql = new MetaStoreDirectSql (objectStore .getPersistenceManager (), conf , null );
1259+ metaStoreDirectSql .lockDbTable ("TBLS" );
1260+ }
1261+
12421262 @ Deprecated
12431263 private static void dropAllStoreObjects (RawStore store )
12441264 throws MetaException , InvalidObjectException , InvalidInputException {
0 commit comments