MCPcopy
hub / github.com/uber/aresdb / setTimefilter

Method setTimefilter

query/sql/sql_parser.go:1438–1473  ·  view source on GitHub ↗
(ctx []antlrgen.IExpressionContext)

Source from the content-addressed store, hash-verified

1436}
1437
1438func (v *ASTBuilder) setTimefilter(ctx []antlrgen.IExpressionContext) {
1439 column := util.TrimQuote(v.getText(ctx[0]))
1440 from := util.TrimQuote(v.getText(ctx[1]))
1441 to := util.TrimQuote(v.getText(ctx[2]))
1442 timezone := util.TrimQuote(v.getText(ctx[3]))
1443
1444 if v.SQL2AqlCtx.timeFilter != (queryCom.TimeFilter{}) {
1445 if v.SQL2AqlCtx.timeFilter.Column != column {
1446 location := v.getLocation(ctx[0])
1447 panic(fmt.Errorf("different timefilter on %s at (line:%d, col:%d)",
1448 column, location.Line, location.CharPosition))
1449 }
1450 if v.SQL2AqlCtx.timeFilter.From != from {
1451 location := v.getLocation(ctx[1])
1452 panic(fmt.Errorf("different timefilter from %s at (line:%d, col:%d)",
1453 from, location.Line, location.CharPosition))
1454 }
1455 if v.SQL2AqlCtx.timeFilter.To != to {
1456 location := v.getLocation(ctx[2])
1457 panic(fmt.Errorf("different timefilter to %s at (line:%d, col:%d)",
1458 to, location.Line, location.CharPosition))
1459 }
1460 if len(v.SQL2AqlCtx.timezone) != 0 && v.SQL2AqlCtx.timezone != timezone {
1461 location := v.getLocation(ctx[2])
1462 panic(fmt.Errorf("different timefilter timezone %s at (line:%d, col:%d)",
1463 timezone, location.Line, location.CharPosition))
1464 }
1465 return
1466 }
1467 v.SQL2AqlCtx.timeFilter = queryCom.TimeFilter{
1468 Column: column,
1469 From: from,
1470 To: to,
1471 }
1472 v.SQL2AqlCtx.timezone = timezone
1473}
1474
1475func (v *ASTBuilder) setTimeNow(ctx []antlrgen.IExpressionContext) {
1476 column := util.TrimQuote(v.getText(ctx[0]))

Callers 1

VisitFunctionCallMethod · 0.95

Calls 4

getTextMethod · 0.95
getLocationMethod · 0.95
TrimQuoteFunction · 0.92
ErrorfMethod · 0.65

Tested by

no test coverage detected