OmniSciDB
a5dc49c757
|
#include <algorithm>
#include <cassert>
#include <cctype>
#include <charconv>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <limits>
#include <stdexcept>
#include <string>
#include "DateConverters.h"
#include "DateTimeParser.h"
#include "Logger/Logger.h"
#include "QueryEngine/DateTimeUtils.h"
#include "StringTransform.h"
#include "misc.h"
#include "sqltypes.h"
Go to the source code of this file.
Namespaces | |
anonymous_namespace{Datum.cpp} | |
Functions | |
int64_t | anonymous_namespace{Datum.cpp}::convert_decimal_value_to_scale_internal (const int64_t decimal_value, int const dscale) |
int64_t | parse_numeric (const std::string_view s, SQLTypeInfo &ti) |
template<typename T > | |
T | anonymous_namespace{Datum.cpp}::minValue (unsigned const fieldsize) |
template<typename T > | |
T | anonymous_namespace{Datum.cpp}::maxValue (unsigned const fieldsize) |
std::string | anonymous_namespace{Datum.cpp}::toString (SQLTypeInfo const &ti, unsigned const fieldsize) |
template<typename T , typename U = long double> | |
T | anonymous_namespace{Datum.cpp}::parseFloatAsInteger (std::string_view s, SQLTypeInfo const &ti) |
bool | anonymous_namespace{Datum.cpp}::hasCommonSuffix (char const *const ptr, char const *const end) |
template<typename T > | |
T | anonymous_namespace{Datum.cpp}::parseInteger (std::string_view s, SQLTypeInfo const &ti) |
SQLTypes | anonymous_namespace{Datum.cpp}::get_type_for_datum (const SQLTypeInfo &ti) |
Datum | NullDatum (const SQLTypeInfo &ti) |
bool | IsNullDatum (const Datum datum, const SQLTypeInfo &ti) |
Datum | StringToDatum (const std::string_view s, SQLTypeInfo &ti) |
bool | DatumEqual (const Datum a, const Datum b, const SQLTypeInfo &ti) |
std::string | DatumToString (Datum d, const SQLTypeInfo &ti) |
int64_t | extract_int_type_from_datum (const Datum datum, const SQLTypeInfo &ti) |
double | extract_fp_type_from_datum (const Datum datum, const SQLTypeInfo &ti) |
SQLTypes | decimal_to_int_type (const SQLTypeInfo &ti) |
SQLTypes | string_dict_to_int_type (const SQLTypeInfo &ti) |
int8_t * | append_datum (int8_t *buf, const Datum &d, const SQLTypeInfo &ti) |
int64_t | convert_decimal_value_to_scale (const int64_t decimal_value, const SQLTypeInfo &type_info, const SQLTypeInfo &new_type_info) |
int8_t* append_datum | ( | int8_t * | buf, |
const Datum & | d, | ||
const SQLTypeInfo & | ti | ||
) |
Definition at line 580 of file Datum.cpp.
References Datum::bigintval, Datum::boolval, Datum::doubleval, Datum::floatval, SQLTypeInfo::get_type(), Datum::intval, SQLTypeInfo::is_dict_encoded_string(), kBIGINT, kBOOLEAN, kDATE, kDECIMAL, kDOUBLE, kFLOAT, kINT, kNUMERIC, kSMALLINT, kTIME, kTIMESTAMP, kTINYINT, Datum::smallintval, string_dict_to_int_type(), Datum::tinyintval, run_benchmark_import::type, and UNREACHABLE.
Referenced by RelAlgExecutor::executeSimpleInsert(), import_export::NullArray(), import_export::StringToArray(), and import_export::TDatumToArrayDatum().
int64_t convert_decimal_value_to_scale | ( | const int64_t | decimal_value, |
const SQLTypeInfo & | type_info, | ||
const SQLTypeInfo & | new_type_info | ||
) |
Definition at line 624 of file Datum.cpp.
References anonymous_namespace{Datum.cpp}::convert_decimal_value_to_scale_internal(), and SQLTypeInfo::get_scale().
Referenced by import_export::TypedImportBuffer::addDefaultValues(), Analyzer::Constant::cast_number(), anonymous_namespace{ArrowImporter.h}::ArrowValue< arrow::Decimal128 >::operator DATA_TYPE(), parse_numeric(), anonymous_namespace{TypedDataAccessors.h}::put_scalar(), and ddl_utils::anonymous_namespace{DdlUtils.cpp}::validate_literal().
bool DatumEqual | ( | const Datum | a, |
const Datum | b, | ||
const SQLTypeInfo & | ti | ||
) |
Definition at line 408 of file Datum.cpp.
References Datum::bigintval, Datum::boolval, Datum::doubleval, Datum::floatval, SQLTypeInfo::get_compression(), SQLTypeInfo::get_type(), Datum::intval, kBIGINT, kBOOLEAN, kCHAR, kDATE, kDECIMAL, kDOUBLE, kENCODING_DICT, kFLOAT, kINT, kINTERVAL_DAY_TIME, kINTERVAL_YEAR_MONTH, kLINESTRING, kMULTILINESTRING, kMULTIPOINT, kMULTIPOLYGON, kNUMERIC, kPOINT, kPOLYGON, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, kVARCHAR, Datum::smallintval, Datum::stringval, and Datum::tinyintval.
Referenced by IsNullDatum(), ChunkMetadata::operator==(), FixedLengthArrayNoneEncoder::resetChunkStats(), and ArrayNoneEncoder::resetChunkStats().
std::string DatumToString | ( | Datum | d, |
const SQLTypeInfo & | ti | ||
) |
Definition at line 460 of file Datum.cpp.
References Datum::bigintval, Datum::boolval, CHECK_EQ, CHECK_LE, CHECK_LT, Datum::doubleval, Datum::floatval, shared::formatDate(), shared::formatDateTime(), shared::formatHMS(), SQLTypeInfo::get_dimension(), SQLTypeInfo::get_scale(), SQLTypeInfo::get_type(), SQLTypeInfo::get_type_name(), Datum::intval, kBIGINT, kBOOLEAN, kCHAR, kDATE, kDECIMAL, kDOUBLE, kFLOAT, kINT, kINTERVAL_DAY_TIME, kINTERVAL_YEAR_MONTH, kNUMERIC, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, kVARCHAR, Datum::smallintval, Datum::stringval, Datum::tinyintval, to_string(), and SQLTypeInfo::to_string().
Referenced by anonymous_namespace{TableFunctionExecutionContext.cpp}::append_literal_buffer(), Analyzer::Constant::cast_to_string(), foreign_storage::datetime_to_string(), foreign_storage::TypedParquetInPlaceEncoder< V, V >::integralTypeToString(), anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >::operator DATA_TYPE(), operator<<(), import_export::anonymous_namespace{QueryExporterCSV.cpp}::target_value_to_string(), Analyzer::Constant::toString(), Timestamp::toString(), Fragmenter_Namespace::InsertOrderFragmenter::updateChunkStats(), and ScalarExprToSql::visitConstant().
SQLTypes decimal_to_int_type | ( | const SQLTypeInfo & | ti | ) |
Definition at line 561 of file Datum.cpp.
References get_int_type_by_size(), and SQLTypeInfo::get_size().
Referenced by import_export::TypedImportBuffer::add_value(), WindowFunctionContext::buildAggregationTreeForPartition(), CodeGenerator::codegen(), CodeGenerator::codegenIntConst(), anonymous_namespace{LogicalIR.cpp}::contains_unsafe_division(), extract_int_type_from_datum(), import_export::Loader::fillShardRow(), anonymous_namespace{ColumnIR.cpp}::get_col_decoder(), import_export::anonymous_namespace{Importer.cpp}::get_type_for_datum(), anonymous_namespace{Datum.cpp}::get_type_for_datum(), CgenState::getOrAddLiteral(), ChunkMetadata::isPlaceholder(), ResultSet::makeTargetValue(), import_export::TypedImportBuffer::pop_value(), import_export::TDatumToDatum(), anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitBinOper(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitUOper().
double extract_fp_type_from_datum | ( | const Datum | datum, |
const SQLTypeInfo & | ti | ||
) |
Definition at line 549 of file Datum.cpp.
References Datum::doubleval, Datum::floatval, SQLTypeInfo::get_type(), kDOUBLE, kFLOAT, and run_benchmark_import::type.
Referenced by extract_max_stat_fp_type(), and extract_min_stat_fp_type().
int64_t extract_int_type_from_datum | ( | const Datum | datum, |
const SQLTypeInfo & | ti | ||
) |
Definition at line 523 of file Datum.cpp.
References Datum::bigintval, CHECK_EQ, decimal_to_int_type(), SQLTypeInfo::get_compression(), SQLTypeInfo::get_type(), Datum::intval, SQLTypeInfo::is_decimal(), kBIGINT, kBOOLEAN, kCHAR, kDATE, kENCODING_DICT, kINT, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, kVARCHAR, Datum::smallintval, Datum::tinyintval, and run_benchmark_import::type.
Referenced by extract_max_stat_int_type(), extract_min_stat_int_type(), StringOps_Namespace::StringOpInfo::getIntLiteral(), ChunkMetadata::isPlaceholder(), and StringOps_Namespace::operator<<().
bool IsNullDatum | ( | const Datum | datum, |
const SQLTypeInfo & | ti | ||
) |
Definition at line 331 of file Datum.cpp.
References DatumEqual(), and NullDatum().
Referenced by anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitStringOper().
Datum NullDatum | ( | const SQLTypeInfo & | ti | ) |
Definition at line 288 of file Datum.cpp.
References Datum::bigintval, Datum::boolval, Datum::doubleval, Datum::floatval, import_export::anonymous_namespace{Importer.cpp}::get_type_for_datum(), inline_fixed_encoding_null_val(), Datum::intval, kBIGINT, kBOOLEAN, kDATE, kDOUBLE, kFLOAT, kINT, kLINESTRING, kMULTILINESTRING, kMULTIPOINT, kMULTIPOLYGON, kPOINT, kPOLYGON, kSMALLINT, kTIME, kTIMESTAMP, kTINYINT, NULL_DOUBLE, NULL_FLOAT, Datum::smallintval, Datum::tinyintval, and run_benchmark_import::type.
Referenced by StringOps_Namespace::compute_jaro_winkler_score(), IsNullDatum(), import_export::NullArray(), and import_export::StringToArray().
int64_t parse_numeric | ( | const std::string_view | s, |
SQLTypeInfo & | ti | ||
) |
Definition at line 112 of file Datum.cpp.
References convert_decimal_value_to_scale(), anonymous_namespace{Datum.cpp}::convert_decimal_value_to_scale_internal(), SQLTypeInfo::get_dimension(), SQLTypeInfo::get_scale(), kNUMERIC, run_benchmark_import::result, SQLTypeInfo::set_dimension(), SQLTypeInfo::set_notnull(), and SQLTypeInfo::set_scale().
Referenced by StringToDatum().
SQLTypes string_dict_to_int_type | ( | const SQLTypeInfo & | ti | ) |
Definition at line 565 of file Datum.cpp.
References CHECK, SQLTypeInfo::get_size(), SQLTypeInfo::is_dict_encoded_string(), kINT, kNULLT, kSMALLINT, kTINYINT, and UNREACHABLE.
Referenced by append_datum(), import_export::anonymous_namespace{Importer.cpp}::get_type_for_datum(), anonymous_namespace{Datum.cpp}::get_type_for_datum(), and foreign_storage::ParquetFixedLengthArrayEncoder::setNullFixedLengthArraySentinel().
Datum StringToDatum | ( | const std::string_view | s, |
SQLTypeInfo & | ti | ||
) |
Definition at line 339 of file Datum.cpp.
References Datum::bigintval, Datum::boolval, Datum::doubleval, Datum::floatval, SQLTypeInfo::get_dimension(), SQLTypeInfo::get_type(), SQLTypeInfo::get_type_name(), Datum::intval, kARRAY, kBIGINT, kBOOLEAN, kCOLUMN, kCOLUMN_LIST, kDATE, kDECIMAL, kDOUBLE, kFLOAT, kINT, kLINESTRING, kMULTILINESTRING, kMULTIPOINT, kMULTIPOLYGON, kNUMERIC, kPOINT, kPOLYGON, kSMALLINT, kTIME, kTIMESTAMP, kTINYINT, parse_numeric(), Datum::smallintval, Datum::tinyintval, and to_upper().
Referenced by import_export::TypedImportBuffer::add_value(), import_export::TypedImportBuffer::addDefaultValues(), Parser::FixedPtLiteral::analyze(), Analyzer::Constant::cast_from_string(), data_conversion::StringViewToScalarEncoder< DataType, MetadataType >::convert(), anonymous_namespace{ArrowImporter.h}::ArrowValue< std::string >::operator DATA_TYPE(), populate_TColumn(), import_export::StringToArray(), and ddl_utils::anonymous_namespace{DdlUtils.cpp}::validate_literal().