Definition at line 558 of file DdlUtils.cpp.
References CHECK, convert_decimal_value_to_scale(), Geospatial::GeoTypesFactory::createGeoType(), SQLTypeInfo::get_elem_type(), SQLTypeInfo::get_max_strlen(), SQLTypeInfo::get_size(), SQLTypeInfo::get_type(), kARRAY, kBIGINT, kBOOLEAN, kCHAR, kDATE, kDECIMAL, kDOUBLE, kFLOAT, kINT, Geospatial::GeoBase::kLINESTRING, kLINESTRING, Geospatial::GeoBase::kMULTILINESTRING, kMULTILINESTRING, Geospatial::GeoBase::kMULTIPOINT, kMULTIPOINT, Geospatial::GeoBase::kMULTIPOLYGON, kMULTIPOLYGON, kNUMERIC, Geospatial::GeoBase::kPOINT, kPOINT, Geospatial::GeoBase::kPOLYGON, kPOLYGON, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, kVARCHAR, split(), StringToDatum(), to_string(), to_upper(), DecimalOverflowValidator::validate(), and DateDaysOverflowValidator::validate().
Referenced by ddl_utils::validate_and_set_default_value().
579 validator.validate(d.bigintval);
588 validator.validate(converted_val);
595 throw std::runtime_error(
"String too long for column " + column_name +
" was " +
601 if (val.front() !=
'{' || val.back() !=
'}') {
602 throw std::runtime_error(column_name +
603 ": arrays should start and end with curly braces");
605 std::vector<std::string> elements =
split(val.substr(1, val.length() - 2),
", ");
608 size_t expected_size = column_type.
get_size() / sti.get_size();
609 size_t actual_size = elements.size();
610 if (actual_size != expected_size) {
611 throw std::runtime_error(
"Fixed length array column " + column_name +
617 for (
const auto& element : elements) {
634 const bool validate_with_geos_if_available =
false;
636 val, validate_with_geos_if_available);
638 throw std::runtime_error(
"Unexpected geo literal '" + val +
"' for column " +
641 if (!geo->transform(column_type)) {
642 throw std::runtime_error(
"Cannot transform SRID for literal '" + val +
643 "' for column " + column_name);
645 auto sql_type = column_type.
get_type();
646 auto geo_type = geo->getType();
658 throw std::runtime_error(
"Geo literal '" + val +
659 "' doesn't match the type "
660 "of column column " +
665 throw std::runtime_error(
"Unexpected geo literal '" + val +
"' for column " +
666 column_name +
": " + e.what());
670 CHECK(
false) <<
"validate_literal() does not support type "
HOST DEVICE int get_size() const
void validate_literal(const std::string &val, SQLTypeInfo column_type, const std::string &column_name)
HOST DEVICE SQLTypes get_type() const
Datum StringToDatum(const std::string_view s, SQLTypeInfo &ti)
static std::unique_ptr< GeoBase > createGeoType(const std::string &wkt_or_wkb_hex, const bool validate_with_geos_if_available)
int64_t convert_decimal_value_to_scale(const int64_t decimal_value, const SQLTypeInfo &type_info, const SQLTypeInfo &new_type_info)
HOST DEVICE size_t get_max_strlen() const
SQLTypeInfo get_elem_type() const