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

Method processDimensions

query/aql_compiler.go:1861–1920  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1859}
1860
1861func (qc *AQLQueryContext) processDimensions() {
1862 // Copy dimension ASTs.
1863 qc.OOPK.Dimensions = make([]expr.Expr, len(qc.Query.Dimensions))
1864 for i, dim := range qc.Query.Dimensions {
1865 // TODO: support numeric bucketizer.
1866 qc.OOPK.Dimensions[i] = dim.ExprParsed
1867 if dim.ExprParsed.Type() == expr.GeoShape {
1868 qc.Error = utils.StackError(nil,
1869 "GeoShape can not be used for dimension: %s", dim.Expr)
1870 return
1871 }
1872 }
1873
1874 if qc.OOPK.geoIntersection != nil {
1875 gc := &geoTableUsageCollector{
1876 geoIntersection: *qc.OOPK.geoIntersection,
1877 }
1878 // Check whether measure and dimensions are referencing any geo table columns.
1879 expr.Walk(gc, qc.OOPK.Measure)
1880
1881 if gc.useGeoTable {
1882 qc.Error = utils.StackError(nil,
1883 "Geo table column is not allowed to be used in measure: %s", qc.OOPK.Measure.String())
1884 return
1885 }
1886
1887 foundGeoJoin := false
1888 for i, dimExpr := range qc.OOPK.Dimensions {
1889 geoDimExpr, err := qc.matchAndRewriteGeoDimension(dimExpr)
1890 if err != nil {
1891 qc.Error = err
1892 return
1893 }
1894
1895 if geoDimExpr != nil {
1896 if foundGeoJoin {
1897 qc.Error = utils.StackError(nil,
1898 "Only one geo dimension allowed: %s", dimExpr.String())
1899 return
1900 }
1901 foundGeoJoin = true
1902 qc.OOPK.Dimensions[i] = geoDimExpr
1903 qc.OOPK.geoIntersection.dimIndex = i
1904 }
1905 }
1906 }
1907
1908 // Collect column usage from measure and dimensions
1909 expr.Walk(columnUsageCollector{
1910 tableScanners: qc.TableScanners,
1911 usages: columnUsedByAllBatches,
1912 }, qc.OOPK.Measure)
1913
1914 for _, dim := range qc.OOPK.Dimensions {
1915 expr.Walk(columnUsageCollector{
1916 tableScanners: qc.TableScanners,
1917 usages: columnUsedByAllBatches,
1918 }, dim)

Callers 2

CompileMethod · 0.95

Calls 5

StackErrorFunction · 0.92
WalkFunction · 0.92
TypeMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected