MCPcopy Index your code
hub / github.com/uber/aresdb / sortDimensionColumns

Method sortDimensionColumns

query/aql_compiler.go:1928–1957  ·  view source on GitHub ↗

Sort dimension columns based on the data width in bytes dimension columns in OOPK will not be reordered, but a mapping from original id to ordered offsets (value and validity) in dimension vector will be stored. GeoUUID dimension will be 1 bytes. VarRef expression will use column data length, others

()

Source from the content-addressed store, hash-verified

1926// GeoUUID dimension will be 1 bytes. VarRef expression will use column data length,
1927// others will be default to 4 bytes.
1928func (qc *AQLQueryContext) sortDimensionColumns() {
1929 orderedIndex := 0
1930 numDimensions := len(qc.OOPK.Dimensions)
1931 qc.OOPK.DimensionVectorIndex = make([]int, numDimensions)
1932 byteWidth := 1 << uint(len(qc.OOPK.NumDimsPerDimWidth)-1)
1933 for byteIndex := range qc.OOPK.NumDimsPerDimWidth {
1934 for originIndex, dim := range qc.OOPK.Dimensions {
1935 dataBytes := common.GetDimensionDataBytes(dim)
1936 if dataBytes == byteWidth {
1937 // record value offset, null offset pair
1938 // null offsets will have to add total dim bytes later
1939 qc.OOPK.DimensionVectorIndex[originIndex] = orderedIndex
1940 qc.OOPK.NumDimsPerDimWidth[byteIndex]++
1941 qc.OOPK.DimRowBytes += dataBytes
1942 orderedIndex++
1943 }
1944 }
1945 byteWidth >>= 1
1946 }
1947 // plus one byte per dimension column for validity
1948 qc.OOPK.DimRowBytes += numDimensions
1949
1950 if !qc.IsNonAggregationQuery {
1951 // no dimension size checking for non-aggregation query
1952 if qc.OOPK.DimRowBytes > C.MAX_DIMENSION_BYTES {
1953 qc.Error = utils.StackError(nil, "maximum dimension bytes: %d, got: %d", C.MAX_DIMENSION_BYTES, qc.OOPK.DimRowBytes)
1954 return
1955 }
1956 }
1957}
1958
1959func (qc *AQLQueryContext) sortUsedColumns() {
1960 for _, scanner := range qc.TableScanners {

Callers 2

CompileMethod · 0.95

Calls 2

GetDimensionDataBytesFunction · 0.92
StackErrorFunction · 0.92

Tested by

no test coverage detected