Skip to content

Commit

Permalink
support force_jni_scanner for hudi in fe
Browse files Browse the repository at this point in the history
  • Loading branch information
suxiaogang223 committed Nov 25, 2024
1 parent b26c594 commit d0c8116
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.doris.planner.ListPartitionPrunerV2;
import org.apache.doris.planner.PlanNodeId;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.SessionVariable;
import org.apache.doris.spi.Split;
import org.apache.doris.statistics.StatisticalType;
import org.apache.doris.thrift.TExplainLevel;
Expand Down Expand Up @@ -113,6 +114,7 @@ public class HudiScanNode extends HiveScanNode {
private boolean incrementalRead = false;
private TableScanParams scanParams;
private IncrementalRelation incrementalRelation;
private SessionVariable sessionVariable;

/**
* External file scan node for Query Hudi table
Expand All @@ -123,7 +125,8 @@ public class HudiScanNode extends HiveScanNode {
* need to do priv check
*/
public HudiScanNode(PlanNodeId id, TupleDescriptor desc, boolean needCheckColumnPriv,
Optional<TableScanParams> scanParams, Optional<IncrementalRelation> incrementalRelation) {
Optional<TableScanParams> scanParams, Optional<IncrementalRelation> incrementalRelation,
SessionVariable sessionVariable) {
super(id, desc, "HUDI_SCAN_NODE", StatisticalType.HUDI_SCAN_NODE, needCheckColumnPriv);
isCowOrRoTable = hmsTable.isHoodieCowTable();
if (LOG.isDebugEnabled()) {
Expand All @@ -138,11 +141,12 @@ public HudiScanNode(PlanNodeId id, TupleDescriptor desc, boolean needCheckColumn
this.scanParams = scanParams.orElse(null);
this.incrementalRelation = incrementalRelation.orElse(null);
this.incrementalRead = (this.scanParams != null && this.scanParams.incrementalRead());
this.sessionVariable = sessionVariable;
}

@Override
public TFileFormatType getFileFormatType() throws UserException {
if (isCowOrRoTable) {
if (!sessionVariable.isForceJniScanner() && isCowOrRoTable) {
return super.getFileFormatType();
} else {
// Use jni to read hudi table in BE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public PlanFragment visitPhysicalHudiScan(PhysicalHudiScan fileScan, PlanTransla
+ " for Hudi table");
PhysicalHudiScan hudiScan = (PhysicalHudiScan) fileScan;
ScanNode scanNode = new HudiScanNode(context.nextPlanNodeId(), tupleDescriptor, false,
hudiScan.getScanParams(), hudiScan.getIncrementalRelation());
hudiScan.getScanParams(), hudiScan.getIncrementalRelation(), ConnectContext.get().getSessionVariable());
if (fileScan.getTableSnapshot().isPresent()) {
((FileQueryScanNode) scanNode).setQueryTableSnapshot(fileScan.getTableSnapshot().get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,7 @@ private PlanNode createScanNode(Analyzer analyzer, TableRef tblRef, SelectStmt s
+ "please set enable_nereids_planner = true to enable new optimizer");
}
scanNode = new HudiScanNode(ctx.getNextNodeId(), tblRef.getDesc(), true,
Optional.empty(), Optional.empty());
Optional.empty(), Optional.empty(), ConnectContext.get().getSessionVariable());
break;
case ICEBERG:
scanNode = new IcebergScanNode(ctx.getNextNodeId(), tblRef.getDesc(), true);
Expand Down

0 comments on commit d0c8116

Please sign in to comment.