lirui-apache commented on a change in pull request #10381: [FLINK-14513][hive] 
Implement listPartitionsByFilter to HiveCatalog
URL: https://github.com/apache/flink/pull/10381#discussion_r355102710
 
 

 ##########
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/util/HiveTableUtil.java
 ##########
 @@ -138,4 +148,88 @@ public static Partition createHivePartition(String 
dbName, String tableName, Lis
                return partition;
        }
 
+       /**
+        * Generates a filter string for partition columns from the given 
filter expressions.
+        *
+        * @param partColNames The names of all partition columns
+        * @param expressions  The filter expressions in CNF form
+        * @return a filter string equivalent to the expressions, or null if 
the expressions can't be handled
+        */
+       public static String makePartitionFilter(List<String> partColNames, 
List<Expression> expressions) {
+               List<String> filters = new ArrayList<>(expressions.size());
+               ExpressionExtractor extractor = new 
ExpressionExtractor(partColNames);
+               for (Expression expression : expressions) {
+                       String str = expression.accept(extractor);
+                       if (str == null) {
 
 Review comment:
   I changed the public method to return an Optional.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to