20 template <
typename SOURCE_TYPE,
typename TARGET_TYPE>
25 SOURCE_TYPE source_null_value =
26 static_cast<SOURCE_TYPE
>(inline_int_null_value<SOURCE_TYPE>());
28 using CasterFunc = std::function<TARGET_TYPE(SOURCE_TYPE, bool, TARGET_TYPE)>;
30 CasterFunc caster =
nullptr;
34 source_null_value =
static_cast<SOURCE_TYPE
>(inline_int_null_value<int64_t>());
35 caster =
checked_cast<SOURCE_TYPE, TARGET_TYPE, int64_t>;
38 source_null_value =
static_cast<SOURCE_TYPE
>(inline_int_null_value<int32_t>());
40 caster =
checked_cast<SOURCE_TYPE, TARGET_TYPE, int32_t>;
44 source_null_value =
static_cast<SOURCE_TYPE
>(inline_int_null_value<int16_t>());
46 caster =
checked_cast<SOURCE_TYPE, TARGET_TYPE, int16_t>;
50 source_null_value =
static_cast<SOURCE_TYPE
>(inline_int_null_value<int8_t>());
59 TARGET_TYPE target_null_value =
60 static_cast<TARGET_TYPE
>(inline_int_null_value<TARGET_TYPE>());
62 auto ret = std::make_unique<NumericValueConverter<SOURCE_TYPE, TARGET_TYPE>>(
72 ret->setValueCaster(std::move(caster));
84 std::unique_ptr<NumericValueConverter<double, double>>
87 return std::make_unique<NumericValueConverter<double, double>>(
92 std::unique_ptr<NumericValueConverter<float, float>>
95 return std::make_unique<NumericValueConverter<float, float>>(
99 template <
typename TARGET_TYPE>
104 TARGET_TYPE target_null_value =
105 static_cast<TARGET_TYPE
>(inline_int_null_value<TARGET_TYPE>());
109 target_null_value =
static_cast<TARGET_TYPE
>(inline_int_null_value<int32_t>());
112 target_null_value =
static_cast<TARGET_TYPE
>(inline_int_null_value<uint16_t>());
115 target_null_value =
static_cast<TARGET_TYPE
>(inline_int_null_value<uint8_t>());
121 return std::make_unique<DictionaryValueConverter<TARGET_TYPE>>(
141 bool dictEncodedSource =
144 if (dictEncodedSource) {
147 return std::make_unique<StringValueConverter>(param.
target,
156 return factory.
create(param);
157 }
else if (2 == size) {
159 return factory.
create(param);
160 }
else if (1 == size) {
162 return factory.
create(param);
166 throw std::runtime_error(
"Unsupported text column type");
170 template <
typename ELEMENT_FACTORY>
174 std::unique_ptr<ArrayValueConverter<typename ELEMENT_FACTORY::ConverterType>>
create(
185 auto elementConverter =
element_factory_.create(elementConverterFactoryParam);
186 return std::make_unique<ArrayValueConverter<typename ELEMENT_FACTORY::ConverterType>>(
197 const static std::map<std::tuple<SQLTypes, EncodingType>,
198 std::function<std::unique_ptr<TargetValueConverter>(
200 array_converter_factories{
233 auto factory = array_converter_factories.find(
234 {elem_type.get_type(), elem_type.get_compression()});
236 if (factory != array_converter_factories.end()) {
237 return factory->second(param);
240 throw std::runtime_error(
"Unsupported array column type");
244 template <
typename CONVERTER,
class Enable =
void>
251 template <
typename CONVERTER>
254 typename std::enable_if_t<std::is_same_v<GeoPolygonValueConverter, CONVERTER> ||
255 std::is_same_v<GeoMultiPolygonValueConverter, CONVERTER>>> {
264 std::function<std::unique_ptr<TargetValueConverter>(
292 if (factory != factories.end()) {
293 return factory->second(param);
295 throw std::runtime_error(
"Unsupported column type: " +
std::unique_ptr< TargetValueConverter > operator()(ConverterCreateParameter param)
const TargetMetaInfo source
HOST DEVICE int get_size() const
std::unique_ptr< TargetValueConverter > operator()(ConverterCreateParameter param)
std::unique_ptr< ArrayValueConverter< typename ELEMENT_FACTORY::ConverterType > > create(ConverterCreateParameter param)
StringDictionaryProxy * literals_dictionary
const ColumnDescriptor * target
HOST DEVICE SQLTypes get_type() const
std::unique_ptr< ConverterType > create(ConverterCreateParameter param)
std::unique_ptr< ConverterType > create(ConverterCreateParameter param)
const Catalog_Namespace::Catalog & target_cat
ELEMENT_FACTORY element_factory_
HOST DEVICE EncodingType get_compression() const
std::unique_ptr< TargetValueConverter > operator()(ConverterCreateParameter param)
constexpr float inline_fp_null_value< float >()
RETURN_TYPE checked_cast(SOURCE_TYPE val, bool check_null, RETURN_TYPE null_value)
constexpr double inline_fp_null_value< double >()
std::string get_type_name() const
std::unique_ptr< TargetValueConverter > operator()(ConverterCreateParameter param)
std::unique_ptr< TargetValueConverter > operator()(ConverterCreateParameter param)
SQLTypeInfo get_elem_type() const
std::unique_ptr< TargetValueConverter > operator()(ConverterCreateParameter param)
std::unique_ptr< TargetValueConverter > create(ConverterCreateParameter param)
StringDictionaryProxy * source_dictionary_proxy
const shared::StringDictKey & getStringDictKey() const
std::unique_ptr< TargetValueConverter > operator()(ConverterCreateParameter param)