alexeykudinkin commented on code in PR #6046:
URL: https://github.com/apache/hudi/pull/6046#discussion_r971302485
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/clustering/run/strategy/MultipleSparkJobExecutionStrategy.java:
##########
@@ -273,6 +330,60 @@ private HoodieData<HoodieRecord<T>>
readRecordsForGroupBaseFiles(JavaSparkContex
.map(record -> transform(record, writeConfig)));
}
+ /**
+ * Get dataset of all records for the group. This includes all records from
file slice (Apply updates from log files, if any).
+ */
+ private Dataset<Row> readRecordsForGroupAsRow(JavaSparkContext jsc,
+ HoodieClusteringGroup
clusteringGroup,
+ String instantTime) {
+ List<ClusteringOperation> clusteringOps =
clusteringGroup.getSlices().stream()
+ .map(ClusteringOperation::create).collect(Collectors.toList());
+ boolean hasLogFiles = clusteringOps.stream().anyMatch(op ->
op.getDeltaFilePaths().size() > 0);
+ SQLContext sqlContext = new SQLContext(jsc.sc());
+
+ String[] baseFilePaths = clusteringOps
+ .stream()
+ .map(op -> {
+ ArrayList<String> readPaths = new ArrayList<>();
+ if (op.getBootstrapFilePath() != null) {
+ readPaths.add(op.getBootstrapFilePath());
+ }
+ if (op.getDataFilePath() != null) {
+ readPaths.add(op.getDataFilePath());
+ }
+ return readPaths;
+ })
+ .flatMap(Collection::stream)
+ .filter(path -> !path.isEmpty())
+ .toArray(String[]::new);
+ String[] deltaPaths = clusteringOps
+ .stream()
+ .filter(op -> !op.getDeltaFilePaths().isEmpty())
+ .flatMap(op -> op.getDeltaFilePaths().stream())
+ .toArray(String[]::new);
+
+ Dataset<Row> inputRecords;
+ if (hasLogFiles) {
+ String compactionFractor =
Option.ofNullable(getWriteConfig().getString("compaction.memory.fraction"))
+ .orElse("0.75");
+ String[] paths = CollectionUtils.combine(baseFilePaths, deltaPaths);
+ inputRecords = sqlContext.read()
Review Comment:
Good call. We shouldn't be moving any of these classes, we can use
`SparkAdapter` to provide us w/ an interface to access it
--
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]