-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[featurl](insert)add hive table sink definition
- Loading branch information
Showing
9 changed files
with
290 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...rc/main/java/org/apache/doris/nereids/trees/plans/commands/insert/HiveInsertExecutor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.apache.doris.nereids.trees.plans.commands.insert; | ||
|
||
import org.apache.doris.common.UserException; | ||
import org.apache.doris.datasource.hive.HMSExternalTable; | ||
import org.apache.doris.nereids.NereidsPlanner; | ||
import org.apache.doris.nereids.trees.plans.physical.PhysicalSink; | ||
import org.apache.doris.planner.DataSink; | ||
import org.apache.doris.planner.PlanFragment; | ||
import org.apache.doris.qe.ConnectContext; | ||
import org.apache.doris.qe.StmtExecutor; | ||
import org.apache.doris.transaction.TransactionStatus; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* Insert executor for olap table | ||
*/ | ||
public class HiveInsertExecutor extends AbstractInsertExecutor { | ||
private static final Logger LOG = LogManager.getLogger(HiveInsertExecutor.class); | ||
private static final long INVALID_TXN_ID = -1L; | ||
private long txnId = INVALID_TXN_ID; | ||
private TransactionStatus txnStatus = TransactionStatus.ABORTED; | ||
|
||
/** | ||
* constructor | ||
*/ | ||
public HiveInsertExecutor(ConnectContext ctx, HMSExternalTable table, | ||
String labelName, NereidsPlanner planner, | ||
Optional<InsertCommandContext> insertCtx) { | ||
super(ctx, table, labelName, planner, insertCtx); | ||
} | ||
|
||
public long getTxnId() { | ||
return txnId; | ||
} | ||
|
||
@Override | ||
public void beginTransaction() { | ||
|
||
} | ||
|
||
@Override | ||
protected void finalizeSink(PlanFragment fragment, DataSink sink, PhysicalSink physicalSink) { | ||
|
||
} | ||
|
||
@Override | ||
protected void beforeExec() { | ||
|
||
} | ||
|
||
@Override | ||
protected void onComplete() throws UserException { | ||
|
||
} | ||
|
||
@Override | ||
protected void onFail(Throwable t) { | ||
|
||
} | ||
|
||
@Override | ||
protected void afterExec(StmtExecutor executor) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...re/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHiveTableSink.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.apache.doris.nereids.trees.plans.physical; | ||
|
||
import org.apache.doris.nereids.memo.GroupExpression; | ||
import org.apache.doris.nereids.properties.LogicalProperties; | ||
import org.apache.doris.nereids.properties.PhysicalProperties; | ||
import org.apache.doris.nereids.trees.expressions.Expression; | ||
import org.apache.doris.nereids.trees.expressions.NamedExpression; | ||
import org.apache.doris.nereids.trees.plans.Plan; | ||
import org.apache.doris.nereids.trees.plans.PlanType; | ||
import org.apache.doris.nereids.trees.plans.algebra.Sink; | ||
import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor; | ||
import org.apache.doris.statistics.Statistics; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** abstract physical sink */ | ||
public class PhysicalHiveTableSink<CHILD_TYPE extends Plan> extends PhysicalSink<CHILD_TYPE> implements Sink { | ||
|
||
public PhysicalHiveTableSink(List<NamedExpression> outputExprs, | ||
Optional<GroupExpression> groupExpression, | ||
LogicalProperties logicalProperties, | ||
@Nullable PhysicalProperties physicalProperties, | ||
Statistics statistics, CHILD_TYPE child) { | ||
super(PlanType.PHYSICAL_HIVE_TABLE_SINK, outputExprs, groupExpression, | ||
logicalProperties, physicalProperties, statistics, child); | ||
} | ||
|
||
@Override | ||
public Plan withChildren(List<Plan> children) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(PlanVisitor<R, C> visitor, C context) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<? extends Expression> getExpressions() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Plan withGroupExpression(Optional<GroupExpression> groupExpression) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Plan withGroupExprLogicalPropChildren(Optional<GroupExpression> groupExpression, | ||
Optional<LogicalProperties> logicalProperties, List<Plan> children) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public PhysicalPlan withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties, Statistics statistics) { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
fe/fe-core/src/main/java/org/apache/doris/planner/HiveTableSink.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
// This file is copied from | ||
// https://github.com/apache/impala/blob/branch-2.9.0/fe/src/main/java/org/apache/impala/DataSink.java | ||
// and modified by Doris | ||
|
||
package org.apache.doris.planner; | ||
|
||
import org.apache.doris.datasource.hive.HMSExternalTable; | ||
import org.apache.doris.thrift.TDataSink; | ||
import org.apache.doris.thrift.TExplainLevel; | ||
|
||
public class HiveTableSink extends DataSink { | ||
|
||
public HiveTableSink(HMSExternalTable table) { | ||
super(); | ||
} | ||
|
||
@Override | ||
public String getExplainString(String prefix, TExplainLevel explainLevel) { | ||
return null; | ||
} | ||
|
||
@Override | ||
protected TDataSink toThrift() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public PlanNodeId getExchNodeId() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public DataPartition getOutputPartition() { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters