danny0405 commented on code in PR #13060:
URL: https://github.com/apache/hudi/pull/13060#discussion_r2026498805
##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/ITTestHoodieDataSource.java:
##########
@@ -1321,6 +1321,49 @@ void testBulkInsertWithPartitionBucketIndex(String
operationType, String tableTy
assertEquals(expected.stream().sorted().collect(Collectors.toList()),
actual.stream().sorted().collect(Collectors.toList()));
}
+ @Test
+ void tesQueryWithPartitionBucketIndexPruning() {
+ String operationType = "upsert";
+ String tableType = "MERGE_ON_READ";
+ TableEnvironment tableEnv = batchTableEnv;
+ // csv source
+ String csvSourceDDL = TestConfigurations.getCsvSourceDDL("csv_source",
"test_source_5.data");
+ tableEnv.executeSql(csvSourceDDL);
+ String catalogName = "hudi_" + operationType;
+ String hudiCatalogDDL = catalog(catalogName)
+ .catalogPath(tempFile.getAbsolutePath())
+ .end();
+
+ tableEnv.executeSql(hudiCatalogDDL);
+ String dbName = "hudi";
+ tableEnv.executeSql("create database " + catalogName + "." + dbName);
+ String basePath = tempFile.getAbsolutePath() + "/hudi/hoodie_sink";
+
+ String hoodieTableDDL = sql(catalogName + ".hudi.hoodie_sink")
+ .option(FlinkOptions.PATH, basePath)
+ .option(FlinkOptions.TABLE_TYPE, tableType)
+ .option(FlinkOptions.OPERATION, operationType)
+ .option(FlinkOptions.WRITE_BULK_INSERT_SHUFFLE_INPUT, true)
+ .option(FlinkOptions.INDEX_TYPE, "BUCKET")
+ .option(FlinkOptions.HIVE_STYLE_PARTITIONING, "true")
+ .option(FlinkOptions.BUCKET_INDEX_NUM_BUCKETS, "1")
+ .option(FlinkOptions.BUCKET_INDEX_PARTITION_RULE, "regex")
+ .option(FlinkOptions.BUCKET_INDEX_PARTITION_EXPRESSIONS,
"partition=(par1|par2),2")
+ .end();
+ tableEnv.executeSql(hoodieTableDDL);
+
+ String insertInto = "insert into " + catalogName + ".hudi.hoodie_sink
select * from csv_source";
+ execInsertSql(tableEnv, insertInto);
+
+ List<Row> result1 = CollectionUtil.iterableToList(
Review Comment:
use `execSelectSql(TableEnvironment tEnv, String select)`
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]