Skip to content

Commit

Permalink
feat: add replace load method capability
Browse files Browse the repository at this point in the history
  • Loading branch information
deryrahman committed Sep 30, 2024
1 parent 845ea13 commit c281e97
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions max2max/internal/loader/replace.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
package loader

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

type replaceLoader struct {
logger *slog.Logger
}

func NewReplaceLoader(logger *slog.Logger) *replaceLoader {
func NewReplaceLoader(logger *slog.Logger) (*replaceLoader, error) {
return &replaceLoader{
logger: logger,
}
}, nil
}

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 c281e97

Please sign in to comment.