@@ -196,19 +196,17 @@ func (p *ExecutionPlanner) compileColumn(ctx context.Context, col *parser.Column
196196 switch strings .ToLower (typeName ) {
197197 case dax .BaseTypeBool :
198198 column .fos = append (column .fos , pilosa .OptFieldTypeBool ())
199- case dax .BaseTypeDecimal :
200199
200+ case dax .BaseTypeDecimal :
201201 // if we don't have a scale, it's an error
202202 if col .Type .Scale == nil {
203203 return nil , sql3 .NewErrDecimalScaleExpected (col .Type .Name .NamePos .Line , col .Type .Name .NamePos .Column )
204204 }
205-
206205 // get the scale value
207206 scale , err = strconv .ParseInt (col .Type .Scale .Value , 10 , 64 )
208207 if err != nil {
209208 return nil , err
210209 }
211-
212210 // Adjust min/max to fit within the scaled min/max.
213211 scaledMin , scaledMax := pql .MinMax (scale )
214212 if scaledMax .LessThan (max ) {
@@ -217,30 +215,35 @@ func (p *ExecutionPlanner) compileColumn(ctx context.Context, col *parser.Column
217215 if scaledMin .GreaterThan (min ) {
218216 min = scaledMin
219217 }
220-
221218 column .fos = append (column .fos , pilosa .OptFieldTypeDecimal (scale , min , max ))
219+
222220 case dax .BaseTypeID :
223221 column .fos = append (column .fos , pilosa .OptFieldTypeMutex (cacheType , cacheSize ))
222+
224223 case dax .BaseTypeIDSet :
225- if timeQuantum != "" {
226- column . fos = append ( column . fos , pilosa . OptFieldTypeTime ( timeQuantum , ttl ))
227- } else {
228- column .fos = append (column .fos , pilosa .OptFieldTypeSet ( cacheType , cacheSize ))
229- }
224+ column . fos = append ( column . fos , pilosa . OptFieldTypeSet ( cacheType , cacheSize ))
225+
226+ case dax . BaseTypeIDSetQ :
227+ column .fos = append (column .fos , pilosa .OptFieldTypeTime ( timeQuantum , ttl ))
228+
230229 case dax .BaseTypeInt :
231230 column .fos = append (column .fos , pilosa .OptFieldTypeInt (min .ToInt64 (0 ), max .ToInt64 (0 )))
231+
232232 case dax .BaseTypeString :
233233 column .fos = append (column .fos , pilosa .OptFieldTypeMutex (cacheType , cacheSize ))
234234 column .fos = append (column .fos , pilosa .OptFieldKeys ())
235+
235236 case dax .BaseTypeStringSet :
236- if timeQuantum != "" {
237- column .fos = append (column .fos , pilosa .OptFieldTypeTime (timeQuantum , ttl ))
238- } else {
239- column .fos = append (column .fos , pilosa .OptFieldTypeSet (cacheType , cacheSize ))
240- }
237+ column .fos = append (column .fos , pilosa .OptFieldTypeSet (cacheType , cacheSize ))
241238 column .fos = append (column .fos , pilosa .OptFieldKeys ())
239+
240+ case dax .BaseTypeStringSetQ :
241+ column .fos = append (column .fos , pilosa .OptFieldTypeTime (timeQuantum , ttl ))
242+ column .fos = append (column .fos , pilosa .OptFieldKeys ())
243+
242244 case dax .BaseTypeTimestamp :
243245 column .fos = append (column .fos , pilosa .OptFieldTypeTimestamp (epoch , timeUnit ))
246+
244247 }
245248 return column , nil
246249}
@@ -392,8 +395,8 @@ func (p *ExecutionPlanner) analyzeColumn(typeName string, col *parser.ColumnDefi
392395 handledConstraints [parser .TIMEUNIT ] = struct {}{}
393396
394397 case * parser.TimeQuantumConstraint :
395- //make sure we have a set type
396- if ! (strings .EqualFold (typeName , dax .BaseTypeStringSet ) || strings .EqualFold (typeName , dax .BaseTypeIDSet )) {
398+ //make sure we have one of the time quantum types
399+ if ! (strings .EqualFold (typeName , dax .BaseTypeStringSetQ ) || strings .EqualFold (typeName , dax .BaseTypeIDSetQ )) {
397400 return sql3 .NewErrBadColumnConstraint (col .Name .NamePos .Line , col .Name .NamePos .Column , "TIMEQUANTUM" , typeName )
398401 }
399402 //check the type of the expression
0 commit comments