id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1 value |
|---|---|---|
c172500 | }
text := fmt.Sprintf("GroupBy(%s)", strings.Join(serializeGroupBy(rowsQueries...), ","))
return NewPQLBaseQuery(text, idx, nil)
} | |
c172501 | must be non-negative"))
}
text := fmt.Sprintf("GroupBy(%s,limit=%d)", strings.Join(serializeGroupBy(rowsQueries...), ","), limit)
return NewPQLBaseQuery(text, idx, nil)
} | |
c172502 | be at least one rows query"))
}
filterText := filterQuery.serialize().String()
text := fmt.Sprintf("GroupBy(%s,filter=%s)", strings.Join(serializeGroupBy(rowsQueries...), ","), filterText)
return NewPQLBaseQuery(text, idx, nil)
} | |
c172503 | options.cacheType = cacheType
options.cacheSize = cacheSize
}
} | |
c172504 | options.fieldType = FieldTypeInt
options.min = min
options.max = max
}
} | |
c172505 | = quantum
if len(opts) > 0 && opts[0] {
options.noStandardView = true
}
}
} | |
c172506 | options.cacheType = cacheType
options.cacheSize = cacheSize
}
} | |
c172507 |
}
text := fmt.Sprintf("Row(%s=%s)", f.name, rowStr)
q := NewPQLRowQuery(text, f.index, nil)
return q
} | |
c172508 | {
return NewPQLBaseQuery("", f.index, err)
}
text := fmt.Sprintf("Set(%s,%s=%s)", colStr, f.name, rowStr)
q := NewPQLBaseQuery(text, f.index, nil)
q.hasKeys = f.options.keys || f.index.options.keys
return q
} | |
c172509 | timestamp.Format(timeFormat))
q := NewPQLBaseQuery(text, f.index, nil)
q.hasKeys = f.options.keys || f.index.options.keys
return q
} | |
c172510 | != nil {
return NewPQLBaseQuery("", f.index, err)
}
text := fmt.Sprintf("ClearRow(%s=%s)", f.name, rowStr)
q := NewPQLBaseQuery(text, f.index, nil)
return q
} | |
c172511 | NewPQLRowQuery(fmt.Sprintf("TopN(%s,%s,n=%d)",
f.name, row.serialize(), n), f.index, nil)
return q
} | |
c172512 |
return f.filterAttrTopN(n, row, attrName, attrValues...)
} | |
c172513 | if err != nil {
return NewPQLBaseQuery("", f.index, err)
}
return NewPQLBaseQuery(fmt.Sprintf("Store(%s,%s=%s)", row.serialize().String(), f.name, rowStr), f.index, nil)
} | |
c172514 | f.name)
q := NewPQLRowQuery(text, f.index, nil)
q.hasKeys = f.options.keys || f.index.options.keys
return q
} | |
c172515 | nil)
q.hasKeys = f.options.keys || f.index.options.keys
return q
} | |
c172516 | if err != nil {
return NewPQLBaseQuery("", f.index, err)
}
q := fmt.Sprintf("Set(%s, %s=%d)", colStr, f.name, value)
return NewPQLBaseQuery(q, f.index, nil)
} | |
c172517 |
index: index,
pql: pql,
err: err,
}
} | |
c172518 | return NewPQLRowsQuery(text, f.index, nil)
} | |
c172519 | := fmt.Sprintf("Rows(field='%s',limit=%d)", f.name, limit)
return NewPQLRowsQuery(text, f.index, nil)
} | |
c172520 | if len(qr.ResultList) == 0 {
return nil
}
return qr.ResultList[0]
} | |
c172521 | `json:"columns"`
Keys []string `json:"keys"`
}{
Attributes: b.Attributes,
Columns: columns,
Keys: keys,
})
} | |
c172522 | {
return nil, err
}
uri.SetPort(port)
return uri, nil
} | |
c172523 | return &URI{error: err}, err
}
return uri, err
} | |
c172524 | errors.New("invalid scheme")
}
u.scheme = scheme
return nil
} | |
c172525 | errors.New("invalid host")
}
u.host = host
return nil
} | |
c172526 | scheme = scheme[:index]
}
return fmt.Sprintf("%s://%s:%d", scheme, u.host, u.port)
} | |
c172527 |
u.host == other.host &&
u.port == other.port
} | |
c172528 | labelRegex.Match([]byte(label))
} | |
c172529 | keyRegex.Match([]byte(key))
} | |
c172530 | return newClientWithURI(&uriCopy, clientOptions), nil
} else if clientOptions.manualServerAddress {
return nil, ErrSingleServerAddressRequired
}
cluster = NewClusterWithHost(u...)
case *Cluster:
cluster = u
case nil:
cluster = NewClusterWithHost()
default:
return nil, ErrAddrURIClusterExpected
}
return newClientWithCluster(cluster, clientOptions), nil
} | |
c172531 | if err != nil {
return nil, errors.Wrap(err, "making request data")
}
useCoordinator := serializedQuery.HasWriteKeys()
path := fmt.Sprintf("/index/%s/query", query.Index().name)
_, buf, err := c.httpRequest("POST", path, data, defaultProtobufHeaders(), useCoordinator)
if err != nil {
return nil, err
}
iqr := &pbuf.QueryResponse{}
err = proto.Unmarshal(buf, iqr)
if err != nil {
return nil, err
}
queryResponse, err := newQueryResponseFromInternal(iqr)
if err != nil {
return nil, err
}
return queryResponse, nil
} | |
c172532 | != nil {
if response != nil && response.StatusCode == 409 {
return ErrIndexExists
}
return err
}
return nil
} | |
c172533 | data, nil, false)
if err != nil {
if response != nil && response.StatusCode == 409 {
return ErrFieldExists
}
return err
}
return nil
} | |
c172534 | err == ErrIndexExists {
return nil
}
return err
} | |
c172535 | err == ErrFieldExists {
return nil
}
return err
} | |
c172536 |
_, _, err := c.httpRequest("DELETE", path, nil, nil, false)
return err
} | |
c172537 | fmt.Sprintf("/index/%s/field/%s", field.index.name, field.name)
_, _, err := c.httpRequest("DELETE", path, nil, nil, false)
return err
} | |
c172538 |
if err != nil {
return err
}
return c.syncSchema(schema, serverSchema)
} | |
c172539 | NewSchema()
for _, indexInfo := range indexes {
index := schema.indexWithOptions(indexInfo.Name, indexInfo.ShardWidth, indexInfo.Options.asIndexOptions())
for _, fieldInfo := range indexInfo.Fields {
index.fieldWithOptions(fieldInfo.Name, fieldInfo.Options.asFieldOptions())
}
}
return schema, nil
} | |
c172540 | c.readSchema()
if err != nil {
return err
}
for _, index := range indexes {
if index.Name != field.index.name {
continue
}
indexCopy := field.index.copy()
indexCopy.shardWidth = index.ShardWidth
field = field.copy()
field.index = indexCopy
break
}
if field.index.shardWidth == 0 {
// the index does not have shard width, use the default
field.index.shardWidth = DefaultShardWidth
}
}
return c.importManager.run(field, iterator, importOptions)
} | |
c172541 | shardURIs, err := c.statusToNodeShardsForIndex(status, field.index.Name())
if err != nil {
return nil, err
}
return newExportReader(c, shardURIs, field), nil
} | |
c172542 | := Status{}
err = json.Unmarshal(data, &status)
if err != nil {
return Status{}, errors.Wrap(err, "unmarshaling /status data")
}
return status, nil
} | |
c172543 | response == nil {
return nil, nil, ErrTriedMaxHosts
}
defer response.Body.Close()
warning := response.Header.Get("warning")
if warning != "" {
c.logger.Println(warning)
}
// TODO: Optimize buffer creation
buf, err := ioutil.ReadAll(response.Body)
if err != nil {
return nil, nil, err
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
err := NewError(fmt.Sprintf("Server error (%d) %s: %s", response.StatusCode, response.Status, string(buf)))
return response, buf, err
}
return response, buf, nil
} | |
c172544 | {
req, err := makeRequest(host, method, path, headers, reader)
if err != nil {
return nil, errors.Wrap(err, "building request")
}
return c.client.Do(req)
} | |
c172545 | nil, ErrNoFragmentNodes
}
node := fragmentNodes[0]
uri := &URI{
host: node.Host,
port: node.Port,
scheme: node.Scheme,
}
result[uint64(shard)] = uri
}
} else {
return nil, ErrNoShard
}
return result, nil
} | |
c172546 |
// wait on importers asynchronously in case they return early with errors
waitErrCh := make(chan error)
go func() {
waitErrCh <- eg.Wait()
close(waitErrCh)
}()
// populate work channel
dec := newImportLogDecoder(r)
var err error
for {
log := importLog{}
err = dec.Decode(&log)
if err != nil {
err = errors.Wrap(err, "decoding")
break
}
select {
case work <- &log:
continue
case err = <-waitErrCh:
err = errors.Wrap(err, "waiting")
}
break
}
// close work channel (now workers can exit)
close(work)
<-waitErrCh // make sure workers are complete
if errors.Cause(err) == io.EOF {
return nil
}
return err
} | |
c172547 | 'D':
return t.Format("20060102")
case 'H':
return t.Format("2006010215")
default:
return ""
}
} | |
c172548 |
return func(options *ClientOptions) error {
options.SocketTimeout = timeout
return nil
}
} | |
c172549 |
return func(options *ClientOptions) error {
options.ConnectTimeout = timeout
return nil
}
} | |
c172550 |
options.PoolSizePerRoute = size
return nil
}
} | |
c172551 |
options.TotalPoolSize = size
return nil
}
} | |
c172552 |
options.TLSConfig = config
return nil
}
} | |
c172553 |
options.manualServerAddress = enabled
return nil
}
} | |
c172554 | {
return func(options *ClientOptions) error {
options.importLogWriter = loc
return nil
}
} | |
c172555 |
options.ColumnAttrs = enable
return nil
}
} | |
c172556 | *QueryOptions) error {
options.Shards = append(options.Shards, shards...)
return nil
}
} | |
c172557 |
options.ExcludeRowAttrs = enable
return nil
}
} | |
c172558 |
options.ExcludeColumns = enable
return nil
}
} | |
c172559 |
options.threadCount = count
return nil
}
} | |
c172560 |
options.batchSize = batchSize
return nil
}
} | |
c172561 | *ImportOptions) error {
options.statusChan = statusChan
return nil
}
} | |
c172562 |
options.clear = clear
return nil
}
} | |
c172563 |
options.wantRoaring = &enable
return nil
}
} | |
c172564 | behavior. The client option expresses it
// positively because that's easier for API users.
options.skipSort = !sorting
return nil
}
} | |
c172565 | defer resp.Body.Close()
r.body, err = ioutil.ReadAll(resp.Body)
if err != nil {
return 0, errors.Wrap(err, "reading response body")
}
r.bodyIndex = 0
}
n = copy(p, r.body[r.bodyIndex:])
r.bodyIndex += n
if n >= len(r.body) {
r.body = nil
r.currentShard++
}
return
} | |
c172566 | return nil, errors.New("Invalid column ID")
}
}
timestamp := 0
if len(parts) == 3 {
if timestampFormat == "" {
timestamp, err = strconv.Atoi(parts[2])
if err != nil {
return nil, err
}
} else {
t, err := time.Parse(timestampFormat, parts[2])
if err != nil {
return nil, err
}
timestamp = int(t.Unix())
}
}
column.Timestamp = int64(timestamp)
return column, nil
}
} | |
c172567 | 0,
scanner: bufio.NewScanner(reader),
unmarshaller: unmarshaller,
}
} | |
c172568 | NewIterator(reader, ColumnUnmarshaller(format))
} | |
c172569 | return NewIterator(reader, ColumnUnmarshallerWithTimestamp(format, timestampFormat))
} | |
c172570 | NewIterator(reader, FieldValueUnmarshaller(format))
} | |
c172571 | return nil, fmt.Errorf("%s at line: %d", err.Error(), c.line)
}
return rc, nil
}
}
err := c.scanner.Err()
if err != nil {
return nil, err
}
return nil, io.EOF
} | |
c172572 | errors.New("Invalid column ID at line: %d")
}
return pilosa.FieldValue{
ColumnID: uint64(columnID),
Value: value,
}, nil
case ColumnKey:
return pilosa.FieldValue{
ColumnKey: parts[0],
Value: value,
}, nil
default:
return nil, fmt.Errorf("Invalid format: %d", format)
}
}
} | |
c172573 | != "" {
result.Delim = b.Delim
}
if b.Glue != "" {
result.Glue = b.Glue
}
if b.Prefix != "" {
result.Prefix = b.Prefix
}
if b.Empty != "" {
result.Empty = b.Empty
}
if b.NoTrim {
result.NoTrim = true
}
return &result
} | |
c172574 | columns && i < len(widths); i++ {
if i == columns-1 {
buf.WriteString("%s\n")
} else {
fmt.Fprintf(buf, "%%-%ds%s", widths[i], c.Glue)
}
}
return buf.String()
} | |
c172575 | = strings.TrimSpace(field)
}
// Apply the empty value, if configured.
if value == "" && config.Empty != "" {
value = config.Empty
}
elements[i] = value
}
return elements
} | |
c172576 |
if len(widths) <= i {
widths = append(widths, l)
} else if widths[i] < l {
widths[i] = l
}
}
}
return widths
} | |
c172577 |
numElems := len(elems)
stringfmt, ok := fmtCache[numElems]
if !ok {
stringfmt = stringFormat(conf, widths, numElems)
fmtCache[numElems] = stringfmt
}
fmt.Fprintf(buf, stringfmt, elems...)
}
// Get the string result
result := buf.String()
// Remove trailing newline without removing leading/trailing space
if n := len(result); n > 0 && result[n-1] == '\n' {
result = result[:n-1]
}
return result
} | |
c172578 | if u.Scheme == "" {
u.Scheme = "http"
}
u.Host = host
}
return err
} | |
c172579 | error {
path, err := m.RevertValid(values)
if err == nil {
u.Path = path
}
return err
} | |
c172580 |
return nil, fmt.Errorf("mux: unbalanced braces in %q", s)
}
}
}
if level != 0 {
return nil, fmt.Errorf("mux: unbalanced braces in %q", s)
}
return idxs, nil
} | |
c172581 | mergeValues(result.Values, m.Values(getHost(r)))
} | |
c172582 | v := range u2 {
u1[k] = append(u1[k], v...)
}
return u1
} | |
c172583 | if t1 != t2 {
u, _ := url.Parse(r.URL.String())
if t1 {
u.Path += "/"
} else {
u.Path = u.Path[:len(u.Path)-1]
}
return http.RedirectHandler(u.String(), 301)
}
return nil
} | |
c172584 | new(bytes.Buffer)}
tpl.write(re)
return &Regexp{
compiled: compiled,
template: tpl.buffer.String(),
groups: tpl.groups,
indices: tpl.indices,
}, nil
} | |
c172585 | r.compiled.MatchString(s)
} | |
c172586 | values.Add(v, match[r.indices[k]])
}
return values
}
return nil
} | |
c172587 |
"(expected a total of %d variables)", v, len(r.groups))
}
vars[k] = values[v][0]
values[v] = values[v][1:]
}
return fmt.Sprintf(r.template, vars...), nil
} | |
c172588 |
return "", err
}
if !r.compiled.MatchString(reverse) {
return "", fmt.Errorf("Resulting string doesn't match the regexp: %q",
reverse)
}
return reverse, nil
} | |
c172589 | t.buffer.WriteString("%s")
}
for _, sub := range re.Sub {
t.write(sub)
}
t.level--
case syntax.OpConcat:
for _, sub := range re.Sub {
t.write(sub)
}
}
} | |
c172590 | || len(c.buf) == 0 {
c.buf = make([]byte, defaultBufSize)
}
c.debugf("New: bufSize=%d\n", len(c.buf))
return c
} | |
c172591 | NewMultiple(buf, options, nil, true)
} | |
c172592 | return false, err1
}
h2, err2 := c.getHash(path2, maxSize)
if err2 != nil {
return false, err2
}
if !bytes.Equal(h1, h2) {
return false, nil // hashes mismatch
}
// hashes match
if !c.hashMatchCompare {
return true, nil // accept hash match without byte-by-byte comparison
}
// do byte-by-byte comparison
c.debugf("CompareFile(%s,%s): hash match, will compare bytes\n", path1, path2)
}
// Use our maxSize to avoid triggering the defaultMaxSize for files.
// We still need to preserve the error returning properties of the
// input amount exceeding MaxSize, so we can't use LimitedReader.
c.resetDebugging()
eq, err := c.compareReader(r1, r2, maxSize)
c.printDebugCompareReader()
return eq, err
} | |
c172593 | if err != nil {
return n1, err
}
}
return n1, nil
} | |
c172594 | more bytes from the original readers, to determine
// if we should return an error for exceeding the MaxSize read limit.
n, _ := readPartial(c, r, buf, 0, len(buf))
return n == 0
} | |
c172595 | services.Frontends = append(services.Frontends, s)
// case "BACKEND":
// services.Backends = append(services.Backends, s)
// default:
// services.Listeners = append(services.Listeners, s)
// }
// }
return stats, nil
} | |
c172596 | {
return nil, fmt.Errorf("error decoding response: %s", err)
}
return info, nil
} | |
c172597 | + "\n"))
if err != nil {
return nil, err
}
_, err = io.Copy(result, h.conn)
if err != nil {
return nil, err
}
if strings.HasPrefix(result.String(), "Unknown command") {
return nil, fmt.Errorf("Unknown command: %s", cmd)
}
return result, nil
} | |
c172598 | {
return true
}
return false
} | |
c172599 | {
return false, nil
}
return false, err
}
return true, nil
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.