(val interface{}, isValid bool)
| 210 | } |
| 211 | |
| 212 | func makeConstantInput(val interface{}, isValid bool) C.InputVector { |
| 213 | var constVector C.ConstantVector |
| 214 | constVector.IsValid = C.bool(isValid) |
| 215 | |
| 216 | switch val.(type) { |
| 217 | case float64, float32: |
| 218 | floatVal := val.(float64) |
| 219 | *(*C.float)(unsafe.Pointer(&constVector.Value)) = C.float(floatVal) |
| 220 | constVector.DataType = C.ConstFloat |
| 221 | case *expr.GeopointLiteral: |
| 222 | geopoint := val.(*expr.GeopointLiteral).Val |
| 223 | *(*C.GeoPointT)(unsafe.Pointer(&constVector.Value)) = *(*C.GeoPointT)(unsafe.Pointer(&geopoint[0])) |
| 224 | constVector.DataType = C.ConstGeoPoint |
| 225 | case *expr.NumberLiteral: |
| 226 | t := val.(*expr.NumberLiteral) |
| 227 | if t.Type() == expr.Float { |
| 228 | *(*C.float)(unsafe.Pointer(&constVector.Value)) = C.float(t.Val) |
| 229 | constVector.DataType = C.ConstFloat |
| 230 | } else { |
| 231 | *(*C.int32_t)(unsafe.Pointer(&constVector.Value)) = C.int32_t(t.Int) |
| 232 | constVector.DataType = C.ConstInt |
| 233 | } |
| 234 | default: |
| 235 | intVal := val.(int) |
| 236 | *(*C.int32_t)(unsafe.Pointer(&constVector.Value)) = C.int32_t(intVal) |
| 237 | constVector.DataType = C.ConstInt |
| 238 | } |
| 239 | |
| 240 | var vector C.InputVector |
| 241 | *(*C.ConstantVector)(unsafe.Pointer(&vector.Vector)) = constVector |
| 242 | vector.Type = C.ConstantInput |
| 243 | return vector |
| 244 | } |
| 245 | |
| 246 | func makeScratchSpaceInput(values unsafe.Pointer, nulls unsafe.Pointer, dataType C.enum_DataType) C.InputVector { |
| 247 | var scratchSpaceVector C.ScratchSpaceVector |
no test coverage detected