-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* The non-streaming hint of insert into will use the streamin plan which is same as the plan of stream insert. It will also record the load info and return the label of insert stmt. * The partition is supportted in insert into stmt. The result which meet the target partitions will be loaded.
- Loading branch information
1 parent
5e245e0
commit 23c4323
Showing
7 changed files
with
214 additions
and
59 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
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
105 changes: 105 additions & 0 deletions
105
fe/src/main/java/org/apache/doris/load/loadv2/InsertLoadJob.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,105 @@ | ||
/* | ||
* 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.load.loadv2; | ||
|
||
import org.apache.doris.catalog.Catalog; | ||
import org.apache.doris.catalog.Database; | ||
import org.apache.doris.catalog.Table; | ||
import org.apache.doris.common.MetaNotFoundException; | ||
import org.apache.doris.load.EtlJobType; | ||
import org.apache.doris.load.FailMsg; | ||
|
||
import java.io.DataInput; | ||
import java.io.DataOutput; | ||
import java.io.IOException; | ||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
/** | ||
* The class is performed to record the finished info of insert load job. | ||
* It is created after txn is visible which belongs to insert load job. | ||
* The state of insert load job is always finished, so it will never be scheduled by JobScheduler. | ||
*/ | ||
public class InsertLoadJob extends LoadJob { | ||
|
||
private long tableId; | ||
|
||
// only for log replay | ||
public InsertLoadJob() { | ||
super(); | ||
this.jobType = EtlJobType.INSERT; | ||
} | ||
|
||
public InsertLoadJob(String label, long dbId, long tableId, long createTimestamp) { | ||
this.label = label; | ||
this.dbId = dbId; | ||
this.tableId = tableId; | ||
this.createTimestamp = createTimestamp; | ||
this.loadStartTimestamp = createTimestamp; | ||
this.finishTimestamp = System.currentTimeMillis(); | ||
this.state = JobState.FINISHED; | ||
this.progress = 100; | ||
this.jobType = EtlJobType.INSERT; | ||
} | ||
|
||
@Override | ||
protected Set<String> getTableNames() throws MetaNotFoundException { | ||
Database database = Catalog.getCurrentCatalog().getDb(dbId); | ||
if (database == null) { | ||
throw new MetaNotFoundException("Database " + dbId + "has been deleted"); | ||
} | ||
database.readLock(); | ||
try { | ||
Table table = database.getTable(tableId); | ||
if (table == null) { | ||
throw new MetaNotFoundException("Failed to find table " + tableId + " in db " + dbId); | ||
} | ||
return new HashSet<>(Arrays.asList(table.getName())); | ||
} finally { | ||
database.readUnlock(); | ||
} | ||
} | ||
|
||
@Override | ||
void executeJob() { | ||
} | ||
|
||
@Override | ||
public void onTaskFinished(TaskAttachment attachment) { | ||
} | ||
|
||
@Override | ||
public void onTaskFailed(long taskId, FailMsg failMsg) { | ||
} | ||
|
||
@Override | ||
public void write(DataOutput out) throws IOException { | ||
super.write(out); | ||
out.writeLong(tableId); | ||
} | ||
|
||
@Override | ||
public void readFields(DataInput in) throws IOException { | ||
super.readFields(in); | ||
tableId = in.readLong(); | ||
} | ||
} |
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
Oops, something went wrong.