Skip to content

Commit

Permalink
fix force_jni_reader for HudiScanNode
Browse files Browse the repository at this point in the history
  • Loading branch information
suxiaogang223 committed Nov 25, 2024
1 parent d0c8116 commit f60e589
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public HudiScanNode(PlanNodeId id, TupleDescriptor desc, boolean needCheckColumn

@Override
public TFileFormatType getFileFormatType() throws UserException {
if (!sessionVariable.isForceJniScanner() && isCowOrRoTable) {
if (canUseNativeReader()) {
return super.getFileFormatType();
} else {
// Use jni to read hudi table in BE
Expand Down Expand Up @@ -265,6 +265,10 @@ private void setHudiParams(TFileRangeDesc rangeDesc, HudiSplit hudiSplit) {
rangeDesc.setTableFormatParams(tableFormatFileDesc);
}

private boolean canUseNativeReader() {
return !sessionVariable.isForceJniScanner() && isCowOrRoTable;
}

private List<HivePartition> getPrunedPartitions(
HoodieTableMetaClient metaClient, Option<String> snapshotTimestamp) throws AnalysisException {
List<Type> partitionColumnTypes = hmsTable.getPartitionColumnTypes();
Expand Down Expand Up @@ -322,7 +326,7 @@ private List<HivePartition> getPrunedPartitions(
}

private List<Split> getIncrementalSplits() {
if (isCowOrRoTable) {
if (canUseNativeReader()) {
List<Split> splits = incrementalRelation.collectSplits();
noLogsSplitNum.addAndGet(splits.size());
return splits;
Expand Down Expand Up @@ -351,7 +355,7 @@ private void getPartitionSplits(HivePartition partition, List<Split> splits) thr
HoodieTableFileSystemView fileSystemView = new HoodieTableFileSystemView(hudiClient,
timeline, statuses);

if (isCowOrRoTable) {
if (canUseNativeReader()) {
fileSystemView.getLatestBaseFilesBeforeOrOn(partitionName, queryInstant).forEach(baseFile -> {
noLogsSplitNum.incrementAndGet();
String filePath = baseFile.getPath();
Expand Down

0 comments on commit f60e589

Please sign in to comment.