|
5 | 5 | e "errors" |
6 | 6 | "fmt" |
7 | 7 | "log/slog" |
| 8 | + "net/url" |
8 | 9 | "strings" |
9 | 10 | "time" |
10 | 11 |
|
@@ -46,7 +47,7 @@ func (c *odpsClient) ExecSQL(ctx context.Context, query string, additionalHints |
46 | 47 | } |
47 | 48 |
|
48 | 49 | // generate log view |
49 | | - url, err := odps.NewLogView(c.client).GenerateLogView(taskIns, c.logViewRetentionInDays*24) |
| 50 | + url, err := c.generateLogView(taskIns) |
50 | 51 | if err != nil { |
51 | 52 | err = e.Join(err, taskIns.Terminate()) |
52 | 53 | return errors.WithStack(err) |
@@ -109,6 +110,28 @@ func (c *odpsClient) GetOrderedColumns(tableID string) ([]string, error) { |
109 | 110 | return columnNames, nil |
110 | 111 | } |
111 | 112 |
|
| 113 | +// generateLogView generates the log view for the given task instance |
| 114 | +func (c *odpsClient) generateLogView(taskIns *odps.Instance) (string, error) { |
| 115 | + u, err := c.client.LogView().GenerateLogView(taskIns, c.logViewRetentionInDays*24) |
| 116 | + if err != nil { |
| 117 | + return "", errors.WithStack(err) |
| 118 | + } |
| 119 | + |
| 120 | + // change query parameter h to http://service.id-all.maxcompute.aliyun-inc.com |
| 121 | + parsedURL, err := url.Parse(u) |
| 122 | + if err != nil { |
| 123 | + return "", errors.WithStack(err) |
| 124 | + } |
| 125 | + q := parsedURL.Query() |
| 126 | + q.Set("h", "http://service.id-all.maxcompute.aliyun-inc.com/api") |
| 127 | + |
| 128 | + // reconstruct the URL with the new query parameter |
| 129 | + parsedURL.RawQuery = q.Encode() |
| 130 | + u = parsedURL.String() |
| 131 | + |
| 132 | + return u, nil |
| 133 | +} |
| 134 | + |
112 | 135 | // wait waits for the task instance to finish on a separate goroutine |
113 | 136 | func (c *odpsClient) wait(taskIns *odps.Instance) <-chan error { |
114 | 137 | errChan := make(chan error) |
|
0 commit comments