Skip to content

Commit 7a132f0

Browse files
authored
feat: merge and replace load (#39)
feat: merge and replace load method
1 parent 42a6804 commit 7a132f0

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

max2max/internal/loader/merge.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ func NewMergeLoader(logger *slog.Logger) *mergeLoader {
1414
}
1515
}
1616

17-
func (l *mergeLoader) GetQuery(tableID, query string) string {
18-
return "-- TODO merge loader"
17+
func (l *mergeLoader) GetQuery(_, query string) string {
18+
return query
1919
}
2020

21-
func (l *mergeLoader) GetPartitionedQuery(tableID, query string, partitionName []string) string {
22-
return "-- TODO merge loader"
21+
func (l *mergeLoader) GetPartitionedQuery(_, query string, _ []string) string {
22+
return query
2323
}

max2max/internal/loader/replace.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package loader
22

33
import (
4+
"fmt"
45
"log/slog"
6+
"strings"
57
)
68

79
type replaceLoader struct {
@@ -15,9 +17,9 @@ func NewReplaceLoader(logger *slog.Logger) *replaceLoader {
1517
}
1618

1719
func (l *replaceLoader) GetQuery(tableID, query string) string {
18-
return "-- TODO replace loader"
20+
return fmt.Sprintf("INSERT OVERWRITE TABLE %s %s", tableID, query)
1921
}
2022

21-
func (l *replaceLoader) GetPartitionedQuery(tableID, query string, partitionName []string) string {
22-
return "-- TODO replace loader"
23+
func (l *replaceLoader) GetPartitionedQuery(tableID, query string, partitionNames []string) string {
24+
return fmt.Sprintf("INSERT OVERWRITE TABLE %s PARTITION (%s) %s", tableID, strings.Join(partitionNames, ", "), query)
2325
}

0 commit comments

Comments
 (0)