Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion mc2mc/internal/client/odps.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ func NewODPSClient(logger *slog.Logger, client *odps.Odps) *odpsClient {
// with capability to do graceful shutdown by terminating task instance
// when context is cancelled.
func (c *odpsClient) ExecSQL(ctx context.Context, query string) error {
taskIns, err := c.client.ExecSQl(query)
hints := addHints(query)
taskIns, err := c.client.ExecSQlWithHints(query, hints)
if err != nil {
return errors.WithStack(err)
}
Expand Down Expand Up @@ -82,3 +83,14 @@ func wait(taskIns *odps.Instance) <-chan error {
}(errChan)
return errChan
}

func addHints(query string) map[string]string {
multisql := strings.Contains(query, ";")
if multisql {
return map[string]string{
"odps.sql.submit.mode": "script",
}
}

return nil
}
Loading