forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNative.cpp
More file actions
513 lines (457 loc) · 22.9 KB
/
Copy pathNative.cpp
File metadata and controls
513 lines (457 loc) · 22.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
#include <DataTypes/Native.h>
#include <Columns/ColumnDecimal.h>
#if USE_EMBEDDED_COMPILER
# if defined(__powerpc64__)
# undef CR1
# undef CR2
# undef CR3
# endif
# include <llvm/IR/IRBuilder.h>
# include <DataTypes/DataTypeDateTime64.h>
# include <DataTypes/DataTypeNullable.h>
# include <DataTypes/DataTypeTime64.h>
# include <DataTypes/DataTypesDecimal.h>
# include <Columns/ColumnConst.h>
# include <Columns/ColumnNullable.h>
namespace DB
{
namespace ErrorCodes
{
extern const int NOT_IMPLEMENTED;
extern const int LOGICAL_ERROR;
}
bool typeIsSigned(const IDataType & type)
{
WhichDataType data_type(type);
return data_type.isInt() || data_type.isFloat() || data_type.isEnum() || data_type.isDate32() || data_type.isDecimal()
|| data_type.isDateTime64();
}
llvm::Type * toNullableType(llvm::IRBuilderBase & builder, llvm::Type * type)
{
auto * is_null_type = builder.getInt1Ty();
return llvm::StructType::get(type, is_null_type);
}
bool canBeNativeType(const IDataType & type)
{
WhichDataType data_type(type);
if (data_type.isNullable())
{
const auto & data_type_nullable = static_cast<const DataTypeNullable&>(type);
return canBeNativeType(*data_type_nullable.getNestedType());
}
return (data_type.isInt() || data_type.isUInt()
|| data_type.isNativeFloat()
|| data_type.isDate() || data_type.isDate32()
|| data_type.isDateTime() || data_type.isDateTime64()
|| data_type.isTime() || data_type.isTime64()
|| data_type.isEnum() || data_type.isDecimal())
&& type.getSizeOfValueInMemory() <= MAX_NATIVE_INT_SIZE;
}
bool canBeNativeType(const DataTypePtr & type)
{
return canBeNativeType(*type);
}
llvm::Type * toNativeType(llvm::IRBuilderBase & builder, const IDataType & type)
{
WhichDataType data_type(type);
if (data_type.isNullable())
{
const auto & data_type_nullable = static_cast<const DataTypeNullable&>(type);
auto * nested_type = toNativeType(builder, *data_type_nullable.getNestedType());
return toNullableType(builder, nested_type);
}
/// LLVM doesn't have unsigned types, it has unsigned instructions.
if (data_type.isInt8() || data_type.isUInt8())
return builder.getInt8Ty();
if (data_type.isInt16() || data_type.isUInt16() || data_type.isDate())
return builder.getInt16Ty();
if (data_type.isInt32() || data_type.isUInt32() || data_type.isDate32() || data_type.isDateTime() || data_type.isDecimal32() || data_type.isTime())
return builder.getInt32Ty();
if (data_type.isInt64() || data_type.isUInt64() || data_type.isDecimal64() || data_type.isDateTime64() || data_type.isTime64())
return builder.getInt64Ty();
if (data_type.isInt128() || data_type.isUInt128() || data_type.isDecimal128())
return builder.getInt128Ty();
if (data_type.isInt256() || data_type.isUInt256() || data_type.isDecimal256())
return builder.getIntNTy(256);
if (data_type.isFloat32())
return builder.getFloatTy();
if (data_type.isFloat64())
return builder.getDoubleTy();
if (data_type.isEnum8())
return builder.getInt8Ty();
if (data_type.isEnum16())
return builder.getInt16Ty();
throw Exception(ErrorCodes::LOGICAL_ERROR, "Invalid cast from {} to native type", type.getName());
}
llvm::Type * toNativeType(llvm::IRBuilderBase & builder, const DataTypePtr & type)
{
return toNativeType(builder, *type);
}
llvm::Value * nativeBoolCast(llvm::IRBuilderBase & b, const DataTypePtr & from_type, llvm::Value * value)
{
if (from_type->isNullable())
{
auto * inner = nativeBoolCast(b, removeNullable(from_type), b.CreateExtractValue(value, {0}));
return b.CreateAnd(b.CreateNot(b.CreateExtractValue(value, {1})), inner);
}
auto * zero = llvm::Constant::getNullValue(value->getType());
if (value->getType()->isIntegerTy())
return b.CreateICmpNE(value, zero);
if (value->getType()->isFloatingPointTy())
return b.CreateFCmpUNE(value, zero);
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Cannot cast non-number {} to bool", from_type->getName());
}
llvm::Value * nativeBoolCast(llvm::IRBuilderBase & b, const ValueWithType & value_with_type)
{
return nativeBoolCast(b, value_with_type.type, value_with_type.value);
}
llvm::Value * nativeCast(llvm::IRBuilderBase & b, const DataTypePtr & from_type, llvm::Value * value, const DataTypePtr & to_type)
{
if (from_type->equals(*to_type))
{
return value;
}
if (from_type->isNullable() && to_type->isNullable())
{
auto * inner = nativeCast(b, removeNullable(from_type), b.CreateExtractValue(value, {0}), to_type);
return b.CreateInsertValue(inner, b.CreateExtractValue(value, {1}), {1});
}
if (from_type->isNullable())
{
return nativeCast(b, removeNullable(from_type), b.CreateExtractValue(value, {0}), to_type);
}
if (to_type->isNullable())
{
auto * to_native_type = toNativeType(b, to_type);
auto * inner = nativeCast(b, from_type, value, removeNullable(to_type));
return b.CreateInsertValue(llvm::Constant::getNullValue(to_native_type), inner, {0});
}
auto * from_native_type = toNativeType(b, from_type);
auto * to_native_type = toNativeType(b, to_type);
/// Handle scale conversion for DateTime/DateTime64/Time/Time64 types.
/// When converting between types with different scales (e.g., DateTime with implicit
/// scale 0 to DateTime64 with scale 3), we need to multiply/divide by the appropriate
/// power of 10, not just cast the integer value.
/// Note: Decimal types are NOT handled here because JIT-compiled aggregate functions
/// (e.g., avg) already manage Decimal scale conversion themselves.
{
auto get_effective_scale = [](const DataTypePtr & type) -> std::optional<UInt32>
{
WhichDataType which(type);
if (which.isDateTime() || which.isTime())
return 0u;
if (which.isDateTime64())
return typeid_cast<const DataTypeDateTime64 *>(type.get())->getScale();
if (which.isTime64())
return typeid_cast<const DataTypeTime64 *>(type.get())->getScale();
return std::nullopt;
};
auto from_scale = get_effective_scale(from_type);
auto to_scale = get_effective_scale(to_type);
if (from_scale && to_scale && *from_scale != *to_scale)
{
/// First widen/narrow the integer type if needed.
if (from_native_type != to_native_type)
value = b.CreateIntCast(value, to_native_type, typeIsSigned(*from_type));
UInt32 scale_diff = (*to_scale > *from_scale) ? (*to_scale - *from_scale) : (*from_scale - *to_scale);
unsigned bit_width = to_native_type->getIntegerBitWidth();
llvm::APInt scale_factor(bit_width, 1);
for (UInt32 i = 0; i < scale_diff; ++i)
scale_factor *= 10;
auto * scale_constant = llvm::ConstantInt::get(b.getContext(), scale_factor);
if (*to_scale > *from_scale)
value = b.CreateMul(value, scale_constant);
else
value = b.CreateSDiv(value, scale_constant);
return value;
}
}
if (from_native_type == to_native_type)
return value;
if (from_native_type->isIntegerTy() && to_native_type->isFloatingPointTy())
return typeIsSigned(*from_type) ? b.CreateSIToFP(value, to_native_type) : b.CreateUIToFP(value, to_native_type);
if (from_native_type->isFloatingPointTy() && to_native_type->isIntegerTy())
return typeIsSigned(*to_type) ? b.CreateFPToSI(value, to_native_type) : b.CreateFPToUI(value, to_native_type);
if (from_native_type->isIntegerTy() && to_native_type->isIntegerTy())
return b.CreateIntCast(value, to_native_type, typeIsSigned(*from_type));
if (from_native_type->isFloatingPointTy() && to_native_type->isFloatingPointTy())
return b.CreateFPCast(value, to_native_type);
throw Exception(ErrorCodes::LOGICAL_ERROR,
"Invalid cast to native value from type {} to type {}",
from_type->getName(),
to_type->getName());
}
llvm::Value * nativeCast(llvm::IRBuilderBase & b, const ValueWithType & value, const DataTypePtr & to_type)
{
return nativeCast(b, value.type, value.value, to_type);
}
llvm::Value * nativeCastWithDecimalScale(
llvm::IRBuilderBase & b, const DataTypePtr & from_type, llvm::Value * value, const DataTypePtr & to_type)
{
if (from_type->equals(*to_type))
return value;
if (from_type->isNullable() && to_type->isNullable())
{
auto * inner_value = b.CreateExtractValue(value, {0});
auto * is_null = b.CreateExtractValue(value, {1});
auto * inner = nativeCastWithDecimalScale(b, removeNullable(from_type), inner_value, removeNullable(to_type));
auto * to_native_type = toNativeType(b, to_type);
llvm::Value * result = llvm::Constant::getNullValue(to_native_type);
result = b.CreateInsertValue(result, inner, {0});
return b.CreateInsertValue(result, is_null, {1});
}
if (from_type->isNullable())
{
return nativeCastWithDecimalScale(b, removeNullable(from_type), b.CreateExtractValue(value, {0}), to_type);
}
if (to_type->isNullable())
{
auto * to_native_type = toNativeType(b, to_type);
auto * inner = nativeCastWithDecimalScale(b, from_type, value, removeNullable(to_type));
return b.CreateInsertValue(llvm::Constant::getNullValue(to_native_type), inner, {0});
}
WhichDataType from_w(*from_type);
WhichDataType to_w(*to_type);
/// Only intercept conversions involving `Decimal` here. Everything else
/// — including `DateTime` / `DateTime64` / `Time` / `Time64` scale lifts —
/// is already handled correctly by `nativeCast`.
if (to_w.isDecimal() || from_w.isDecimal())
{
auto * from_native_type = toNativeType(b, from_type);
auto * to_native_type = toNativeType(b, to_type);
const UInt32 to_scale = to_w.isDecimal() ? getDecimalScale(*to_type) : 0;
const UInt32 from_scale = from_w.isDecimal() ? getDecimalScale(*from_type) : 0;
/// Build LLVM integer constant for `10^n` of the requested bit width.
auto pow10_int_const = [&](unsigned bit_width, UInt32 n) -> llvm::ConstantInt *
{
llvm::APInt v(bit_width, 1);
for (UInt32 i = 0; i < n; ++i)
v *= 10;
return llvm::cast<llvm::ConstantInt>(llvm::ConstantInt::get(b.getContext(), v));
};
/// Build LLVM floating-point constant for `10^n` from an `APInt` of the requested bit width.
/// This goes through `APFloat::convertFromAPInt` rather than `APInt::getZExtValue` so that
/// it stays correct when `10^n` does not fit in 64 bits (e.g. `Decimal128` with `scale = 38`,
/// or `Decimal256` with even larger scales).
auto pow10_fp_const = [&](unsigned bit_width, UInt32 n, llvm::Type * fp_type) -> llvm::Constant *
{
llvm::APInt v(bit_width, 1);
for (UInt32 i = 0; i < n; ++i)
v *= 10;
llvm::APFloat fp(fp_type->getFltSemantics());
fp.convertFromAPInt(v, /*IsSigned=*/false, llvm::APFloat::rmNearestTiesToEven);
return llvm::ConstantFP::get(b.getContext(), fp);
};
if (to_w.isDecimal())
{
if (from_w.isDecimal())
{
/// `Decimal` → `Decimal` (possibly different scale and/or precision).
/// Widen/narrow the integer storage first, then adjust scale.
auto * widened = (from_native_type == to_native_type)
? value
: b.CreateIntCast(value, to_native_type, /*isSigned=*/true);
if (from_scale == to_scale)
return widened;
const UInt32 diff = (to_scale > from_scale) ? (to_scale - from_scale) : (from_scale - to_scale);
auto * factor = pow10_int_const(to_native_type->getIntegerBitWidth(), diff);
return (to_scale > from_scale)
? b.CreateMul(widened, factor)
: b.CreateSDiv(widened, factor);
}
if (from_w.isInt() || from_w.isUInt() || from_w.isEnum() || from_w.isDate() || from_w.isDate32())
{
/// Integer → `Decimal`: widen to `Decimal`'s underlying integer type,
/// then multiply by `10^to_scale` to lift the value into `Decimal` scale.
auto * widened = (from_native_type == to_native_type)
? value
: b.CreateIntCast(value, to_native_type, typeIsSigned(*from_type));
if (to_scale == 0)
return widened;
auto * factor = pow10_int_const(to_native_type->getIntegerBitWidth(), to_scale);
return b.CreateMul(widened, factor);
}
if (from_w.isFloat32() || from_w.isFloat64())
{
/// Float → `Decimal`: multiply by `10^to_scale` in floating point first,
/// then truncate to the target integer storage type.
if (to_scale == 0)
return b.CreateFPToSI(value, to_native_type);
/// `10^to_scale` may not be exactly representable as a float for very large scales,
/// but this matches the precision of the non-JIT path which performs the same
/// `value * 10^scale` multiplication in `Float64`. Construct the multiplier through
/// `APFloat::convertFromAPInt` so it stays correct when `10^to_scale` exceeds 64 bits
/// (`Decimal128` with `to_scale >= 20`, `Decimal256` with even larger scales).
auto * factor_fp = pow10_fp_const(to_native_type->getIntegerBitWidth(), to_scale, value->getType());
auto * multiplied = b.CreateFMul(value, factor_fp);
return b.CreateFPToSI(multiplied, to_native_type);
}
/// Fall through to `nativeCast` for unusual sources (e.g. `DateTime64` → `Decimal`).
}
else if (from_w.isDecimal())
{
if (to_w.isInt() || to_w.isUInt() || to_w.isEnum() || to_w.isDate() || to_w.isDate32())
{
/// `Decimal` → integer: divide by `10^from_scale`, then narrow.
if (from_scale == 0)
return (from_native_type == to_native_type)
? value
: b.CreateIntCast(value, to_native_type, /*isSigned=*/true);
auto * factor = pow10_int_const(from_native_type->getIntegerBitWidth(), from_scale);
auto * divided = b.CreateSDiv(value, factor);
return (from_native_type == to_native_type)
? divided
: b.CreateIntCast(divided, to_native_type, /*isSigned=*/true);
}
if (to_w.isFloat32() || to_w.isFloat64())
{
/// `Decimal` → float: convert to `Float64`, divide by `10^from_scale`,
/// then narrow to the target float type if needed. Construct the divider through
/// `APFloat::convertFromAPInt` so it stays correct when `10^from_scale` exceeds
/// 64 bits (`Decimal128` with `from_scale >= 20`, `Decimal256` with even larger scales).
auto * as_double = b.CreateSIToFP(value, b.getDoubleTy());
if (from_scale == 0)
return to_w.isFloat32() ? b.CreateFPCast(as_double, to_native_type) : as_double;
auto * divider = pow10_fp_const(from_native_type->getIntegerBitWidth(), from_scale, b.getDoubleTy());
auto * divided = b.CreateFDiv(as_double, divider);
return to_w.isFloat32() ? b.CreateFPCast(divided, to_native_type) : divided;
}
/// Fall through to `nativeCast` for unusual targets.
}
}
return nativeCast(b, from_type, value, to_type);
}
llvm::Value * nativeCastWithDecimalScale(llvm::IRBuilderBase & b, const ValueWithType & value, const DataTypePtr & to_type)
{
return nativeCastWithDecimalScale(b, value.type, value.value, to_type);
}
llvm::Constant * getColumnNativeValue(llvm::IRBuilderBase & builder, const DataTypePtr & column_type, const IColumn & column, size_t index)
{
if (const auto * constant = typeid_cast<const ColumnConst *>(&column))
return getColumnNativeValue(builder, column_type, constant->getDataColumn(), 0);
auto * type = toNativeType(builder, column_type);
WhichDataType column_data_type(column_type);
if (column_data_type.isNullable())
{
const auto & nullable_data_type = assert_cast<const DataTypeNullable &>(*column_type);
const auto & nullable_column = assert_cast<const ColumnNullable &>(column);
auto * value = getColumnNativeValue(builder, nullable_data_type.getNestedType(), nullable_column.getNestedColumn(), index);
auto * is_null = llvm::ConstantInt::get(type->getContainedType(1), nullable_column.isNullAt(index));
return llvm::ConstantStruct::get(static_cast<llvm::StructType *>(type), value, is_null);
}
auto get_numeric_constant = [&type]<typename T>(const IColumn & column_, size_t index_) -> llvm::Constant *
{
const auto & column_vector_decimal = assert_cast<const ColumnVectorOrDecimal<T> &>(column_);
const auto & element = column_vector_decimal.getElement(index_);
if constexpr (std::is_floating_point_v<T>)
{
return llvm::ConstantFP::get(type, static_cast<double>(element));
}
else if constexpr (is_integer<T>)
{
if constexpr (std::is_integral_v<T>)
return llvm::ConstantInt::get(type, static_cast<uint64_t>(element), is_signed_v<T>);
else
{
llvm::APInt value(type->getIntegerBitWidth(), element.items);
return llvm::ConstantInt::get(type, value);
}
}
else if constexpr (is_decimal<T>)
{
if constexpr (!is_over_big_decimal<T>)
return llvm::ConstantInt::get(type, static_cast<uint64_t>(element.value), true);
else
{
llvm::APInt value(type->getIntegerBitWidth(), element.value.items);
return llvm::ConstantInt::get(type, value);
}
}
};
#define GET_NUMERIC_CONSTANT(TYPE, DTYPE) \
if (column_data_type.is##TYPE()) \
{ \
return get_numeric_constant.operator()<DTYPE>(column, index); \
}
GET_NUMERIC_CONSTANT(Float32, Float32)
GET_NUMERIC_CONSTANT(Float64, Float64)
GET_NUMERIC_CONSTANT(Int8, Int8)
GET_NUMERIC_CONSTANT(Int16, Int16)
GET_NUMERIC_CONSTANT(Int32, Int32)
GET_NUMERIC_CONSTANT(Time, Int32)
GET_NUMERIC_CONSTANT(Time64, Time64)
GET_NUMERIC_CONSTANT(Int64, Int64)
GET_NUMERIC_CONSTANT(UInt8, UInt8)
GET_NUMERIC_CONSTANT(UInt16, UInt16)
GET_NUMERIC_CONSTANT(UInt32, UInt32)
GET_NUMERIC_CONSTANT(UInt64, UInt64)
GET_NUMERIC_CONSTANT(Enum8, Int8)
GET_NUMERIC_CONSTANT(Enum16, Int16)
GET_NUMERIC_CONSTANT(Date, UInt16)
GET_NUMERIC_CONSTANT(Date32, Int32)
GET_NUMERIC_CONSTANT(DateTime, UInt32)
GET_NUMERIC_CONSTANT(DateTime64, DateTime64)
GET_NUMERIC_CONSTANT(Int128, Int128)
GET_NUMERIC_CONSTANT(Int256, Int256)
GET_NUMERIC_CONSTANT(UInt128, UInt128)
GET_NUMERIC_CONSTANT(UInt256, UInt256)
GET_NUMERIC_CONSTANT(Decimal32, Decimal32)
GET_NUMERIC_CONSTANT(Decimal64, Decimal64)
GET_NUMERIC_CONSTANT(Decimal128, Decimal128)
GET_NUMERIC_CONSTANT(Decimal256, Decimal256)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Cannot get native value for column with type {}", column_type->getName());
#undef GET_NUMERIC_CONSTANT
}
llvm::Constant * getNativeValue(llvm::IRBuilderBase & builder, const DataTypePtr & column_type, const Field & field)
{
ColumnPtr column = column_type->createColumnConst(1, field);
return getColumnNativeValue(builder, column_type, *column, 0);
}
template <typename ToType>
llvm::Type * toNativeType(llvm::IRBuilderBase & builder)
{
if constexpr (std::is_same_v<ToType, Int8> || std::is_same_v<ToType, UInt8>)
return builder.getInt8Ty();
else if constexpr (std::is_same_v<ToType, Int16> || std::is_same_v<ToType, UInt16>)
return builder.getInt16Ty();
else if constexpr (std::is_same_v<ToType, Int32> || std::is_same_v<ToType, UInt32> || std::is_same_v<ToType, Decimal32>)
return builder.getInt32Ty();
else if constexpr (
std::is_same_v<ToType, Int64> || std::is_same_v<ToType, UInt64> || std::is_same_v<ToType, DateTime64>
|| std::is_same_v<ToType, Decimal64>)
return builder.getInt64Ty();
else if constexpr (std::is_same_v<ToType, Float32>)
return builder.getFloatTy();
else if constexpr (std::is_same_v<ToType, Float64>)
return builder.getDoubleTy();
else if constexpr (std::is_same_v<ToType, Int128> || std::is_same_v<ToType, UInt128> || std::is_same_v<ToType, Decimal128>)
/// There is one problem: LLVM uses "preferred alignment" for this type as 16 bytes,
/// and will generate aligned loads/stores by default
/// While our Int128, UInt128 types have only 8 bytes alignment.
/// When working with values of these types in LLVM, don't forget to do setAlignment(llvm::Align(8)) for all loads/stores.
return builder.getInt128Ty();
else if constexpr (std::is_same_v<ToType, Int256> || std::is_same_v<ToType, UInt256> || std::is_same_v<ToType, Decimal256>)
return builder.getIntNTy(256);
throw Exception(ErrorCodes::LOGICAL_ERROR, "Invalid cast to native type");
}
template llvm::Type * toNativeType<Int8>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<UInt8>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<Int16>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<UInt16>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<Int32>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<UInt32>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<Int64>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<UInt64>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<Int128>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<UInt128>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<Int256>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<UInt256>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<Float32>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<Float64>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<DateTime64>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<Decimal32>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<Decimal64>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<Decimal128>(llvm::IRBuilderBase &);
template llvm::Type * toNativeType<Decimal256>(llvm::IRBuilderBase &);
}
#endif