本文整理汇总了Golang中parser.QuerySpec.IsRegex方法的典型用法代码示例。如果您正苦于以下问题:Golang QuerySpec.IsRegex方法的具体用法?Golang QuerySpec.IsRegex怎么用?Golang QuerySpec.IsRegex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parser.QuerySpec
的用法示例。
在下文中一共展示了QuerySpec.IsRegex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: shouldQuerySequentially
func (self *CoordinatorImpl) shouldQuerySequentially(shards []*cluster.ShardData, querySpec *parser.QuerySpec) bool {
// if the query isn't a select, then it doesn't matter
if querySpec.SelectQuery != nil {
return false
}
// if the query is a regex, we can't predic the number of responses
// we get back
if querySpec.IsRegex() {
return true
}
groupByClause := querySpec.SelectQuery().GetGroupByClause()
// if there's no group by clause, then we're returning raw points
// with some math done on them, thus we can't predict the number of
// points
if groupByClause == nil {
return true
}
// if there's a group by clause but no group by interval, we can't
// predict the cardinality of the columns used in the group by
// interval, thus we can't predict the number of responses returned
// from the shard
if querySpec.GetGroupByInterval() == nil {
return true
}
// if there's a group by time and other columns, then the previous
// logic holds
if len(groupByClause.Elems) > 1 {
return true
}
// parallel querying only if we're querying a single series, with
// group by time only
return false
}
示例2: shouldQuerySequentially
func (self *CoordinatorImpl) shouldQuerySequentially(shards []*cluster.ShardData, querySpec *parser.QuerySpec) bool {
// if the query isn't a select, then it doesn't matter
if querySpec.SelectQuery() == nil {
return false
}
// if the query is a regex, we can't predic the number of responses
// we get back
if querySpec.IsRegex() {
return true
}
groupByClause := querySpec.SelectQuery().GetGroupByClause()
// if there's no group by clause, then we're returning raw points
// with some math done on them, thus we can't predict the number of
// points
if groupByClause == nil {
return true
}
// if there's a group by clause but no group by interval, we can't
// predict the cardinality of the columns used in the group by
// interval, thus we can't predict the number of responses returned
// from the shard
if querySpec.GetGroupByInterval() == nil {
return true
}
// if there's a group by time and other columns, then the previous
// logic holds
if len(groupByClause.Elems) > 1 {
return true
}
if !self.shouldAggregateLocally(shards, querySpec) {
return true
}
for _, shard := range shards {
bufferSize := shard.QueryResponseBufferSize(querySpec, self.config.LevelDbPointBatchSize)
// if the number of repsonses is too big, do a sequential querying
if bufferSize > self.config.ClusterMaxResponseBufferSize {
return true
}
}
// parallel querying only if we're querying a single series, with
// group by time only
return false
}