-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Support insert overwrite #6282
[Feature] Support insert overwrite #6282
Conversation
112ce6b
to
92ed7c9
Compare
Please change the title and obey the rule. |
Can you give the rule's Link? I'm not sure where can I find it. |
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJob.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJob.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobManager.java
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobManager.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/sql/analyzer/InsertAnalyzer.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/transaction/DatabaseTransactionMgr.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobManager.java
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJob.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/persist/OperationType.java
Outdated
Show resolved
Hide resolved
3089ac9
to
0c8f5b3
Compare
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobRunner.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobRunner.java
Show resolved
Hide resolved
run starrocks_fe_unittest |
1 similar comment
run starrocks_fe_unittest |
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobRunner.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobState.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobManager.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobManager.java
Outdated
Show resolved
Hide resolved
run starrocks_fe_unittest |
c1b9b2f
to
05483de
Compare
fe/fe-core/src/main/java/com/starrocks/load/lock/LockTarget.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/persist/CreateInsertOverwriteJobInfo.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobManager.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobManager.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobManager.java
Outdated
Show resolved
Hide resolved
insertStmt.setOriginalTargetPartitionIds(insertStmt.getTargetPartitionIds()); | ||
insertStmt.setTargetPartitionNames(partitionNames); | ||
insertStmt.setTargetPartitionIds(newPartitionIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why need db.lock here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only one insert for all related partition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think targetTable.getPartition should be called in read lock
fe/fe-core/src/main/java/com/starrocks/load/InsertOverwriteJobRunner.java
Show resolved
Hide resolved
private InsertOverwriteJobState jobState; | ||
|
||
@SerializedName(value = "sourcePartitionNames") | ||
private List<String> sourcePartitionNames; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you already have partitionid, why you need partition names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modify it to use partition ids
@@ -1670,6 +1670,31 @@ public void replaceTempPartitions(List<String> partitionNames, List<String> temp | |||
} | |||
} | |||
|
|||
// used for unpartitioned table in insert overwrite | |||
// replace partition with temp partition | |||
public void replacePartition(String sourcePartitionName, String tempPartitionName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It it strange to give partition names for unpartitioned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unpartitioned table's partition also has a name, it is default to the table name. Here I have to add a tmp partition for table, so I need to give the tmp partition a name. I think it is ok.
1. rename CreateInsertOverwriteJobInfo 2. use partition id to replace name 3. optimize log 4. extract partition utils
495618d
to
d443ebd
Compare
run starrocks_fe_unittest |
2 similar comments
run starrocks_fe_unittest |
run starrocks_fe_unittest |
[FE PR Coverage check]😞 fail : 312 / 543 (57.46%) file detail
|
Signed-off-by: 絵空事スピリット <wanglichen@starrocks.com>
Signed-off-by: 絵空事スピリット <wanglichen@starrocks.com> (cherry picked from commit a6629bd) Co-authored-by: 絵空事スピリット <wanglichen@starrocks.com>
What type of PR is this:
Which issues of this PR fixes :
Fixes #4798
Problem Summary(Required) :
Support insert overwrite for OlapTable. use as following:
insert overwrite tableA select xxx from tableB;
insert overwrite tableA partitions(p1, p2) select xxx from tableB;
The design idea is create mirror temporary partitions and load new data into the temporary partitions. when all data is loaded, swap temporary partitions and original partitions.
The core points are: