Skip to content

Commit

Permalink
feat: merge and replace load method
Browse files Browse the repository at this point in the history
  • Loading branch information
deryrahman committed Oct 11, 2024
1 parent 42a6804 commit d5d1894
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions max2max/internal/loader/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ func NewMergeLoader(logger *slog.Logger) *mergeLoader {
}
}

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

func (l *mergeLoader) GetPartitionedQuery(tableID, query string, partitionName []string) string {
return "-- TODO merge loader"
func (l *mergeLoader) GetPartitionedQuery(_, query string, _ []string) string {
return query
}
8 changes: 5 additions & 3 deletions max2max/internal/loader/replace.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package loader

import (
"fmt"
"log/slog"
"strings"
)

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

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

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

0 comments on commit d5d1894

Please sign in to comment.