OmniSciDB
cde582ebc3
|
Constants for Builtin SQL Types supported by HEAVY.AI. More...
#include "../Logger/Logger.h"
#include "funcannotations.h"
#include <cassert>
#include <ctime>
#include <memory>
#include <ostream>
#include <sstream>
#include <string>
#include <type_traits>
#include <vector>
#include "InlineNullValues.h"
#include <string_view>
#include "../QueryEngine/DateAdd.h"
#include "../QueryEngine/DateTruncate.h"
#include "../QueryEngine/ExtractFromTime.h"
Go to the source code of this file.
Classes | |
struct | VarlenDatum |
struct | DoNothingDeleter |
struct | FreeDeleter |
struct | HostArrayDatum |
struct | DeviceArrayDatum |
union | Datum |
union | DataBlockPtr |
class | SQLTypeInfo |
struct | SqlLiteralArg |
Macros | |
#define | IS_INTEGER(T) (((T) == kINT) || ((T) == kSMALLINT) || ((T) == kBIGINT) || ((T) == kTINYINT)) |
#define | IS_NUMBER(T) |
#define | IS_STRING(T) (((T) == kTEXT) || ((T) == kVARCHAR) || ((T) == kCHAR)) |
#define | IS_GEO(T) (((T) == kPOINT) || ((T) == kLINESTRING) || ((T) == kPOLYGON) || ((T) == kMULTIPOLYGON)) |
#define | IS_INTERVAL(T) ((T) == kINTERVAL_DAY_TIME || (T) == kINTERVAL_YEAR_MONTH) |
#define | IS_DECIMAL(T) ((T) == kNUMERIC || (T) == kDECIMAL) |
#define | IS_GEO_POLY(T) (((T) == kPOLYGON) || ((T) == kMULTIPOLYGON)) |
#define | TRANSIENT_DICT_ID 0 |
#define | TRANSIENT_DICT(ID) (-(ID)) |
#define | REGULAR_DICT(TRANSIENTID) (-(TRANSIENTID)) |
Typedefs | |
using | ArrayDatum = std::conditional_t< is_cuda_compiler(), DeviceArrayDatum, HostArrayDatum > |
using | StringOffsetT = int32_t |
using | ArrayOffsetT = int32_t |
Enumerations | |
enum | SQLTypes { kNULLT = 0, kBOOLEAN = 1, kCHAR = 2, kVARCHAR = 3, kNUMERIC = 4, kDECIMAL = 5, kINT = 6, kSMALLINT = 7, kFLOAT = 8, kDOUBLE = 9, kTIME = 10, kTIMESTAMP = 11, kBIGINT = 12, kTEXT = 13, kDATE = 14, kARRAY = 15, kINTERVAL_DAY_TIME = 16, kINTERVAL_YEAR_MONTH = 17, kPOINT = 18, kLINESTRING = 19, kPOLYGON = 20, kMULTIPOLYGON = 21, kTINYINT = 22, kGEOMETRY = 23, kGEOGRAPHY = 24, kEVAL_CONTEXT_TYPE = 25, kVOID = 26, kCURSOR = 27, kCOLUMN = 28, kCOLUMN_LIST = 29, kSQLTYPE_LAST = 30 } |
enum | EncodingType { kENCODING_NONE = 0, kENCODING_FIXED = 1, kENCODING_RL = 2, kENCODING_DIFF = 3, kENCODING_DICT = 4, kENCODING_SPARSE = 5, kENCODING_GEOINT = 6, kENCODING_DATE_IN_DAYS = 7, kENCODING_LAST = 8 } |
Constants for Builtin SQL Types supported by HEAVY.AI.
Definition in file sqltypes.h.
Definition at line 254 of file sqltypes.h.
#define IS_GEO | ( | T | ) | (((T) == kPOINT) || ((T) == kLINESTRING) || ((T) == kPOLYGON) || ((T) == kMULTIPOLYGON)) |
Definition at line 251 of file sqltypes.h.
Referenced by spatial_type::Distance::codegenLoads(), Catalog_Namespace::Catalog::expandGeoColumn(), SQLTypeInfo::get_type_name(), Executor::getColLazyFetchInfo(), anonymous_namespace{DdlCommandExecutor.cpp}::JsonColumnSqlType::getParam1(), anonymous_namespace{DdlCommandExecutor.cpp}::JsonColumnSqlType::getParam2(), EmbeddedDatabase::DBEngineImpl::getTableDetails(), import_export::import_thread_delimited(), SQLTypeInfo::is_geometry(), SQLTypeInfo::is_varlen(), ResultSet::isGeoColOnGpu(), DBHandler::populateThriftColumnType(), foreign_storage::TextFileBufferParser::processGeoColumn(), foreign_storage::TextFileBufferParser::processInvalidGeoColumn(), ThriftSerializers::target_meta_info_to_thrift(), thrift_to_name(), SQLTypeInfo::transforms(), RelAlgTranslator::translateGeoColumn(), RelAlgTranslator::translateGeoFunctionArg(), type_info_from_thrift(), ThriftSerializers::type_info_to_thrift(), ddl_utils::validate_and_set_type(), and anonymous_namespace{RelAlgExecutor.cpp}::RexUsedInputsVisitor::visitInput().
#define IS_GEO_POLY | ( | T | ) | (((T) == kPOLYGON) || ((T) == kMULTIPOLYGON)) |
Definition at line 255 of file sqltypes.h.
Referenced by CodeGenerator::codegenOverlaps(), foreign_storage::AbstractTextFileDataWrapper::createRenderGroupAnalyzers(), foreign_storage::ParquetDataWrapper::createRenderGroupAnalyzers(), DBHandler::fillGeoColumns(), import_export::Importer::importDelimited(), import_export::Importer::importGDALGeo(), Parser::InsertIntoTableAsSelectStmt::populateData(), foreign_storage::TextFileBufferParser::processGeoColumn(), foreign_storage::GeospatialEncoder::processGeoElement(), and RelAlgTranslator::translateUnaryGeoFunction().
#define IS_INTEGER | ( | T | ) | (((T) == kINT) || ((T) == kSMALLINT) || ((T) == kBIGINT) || ((T) == kTINYINT)) |
Definition at line 245 of file sqltypes.h.
Referenced by Analyzer::StringOper::check_operand_types(), anonymous_namespace{ArrowResultSetConverter.cpp}::get_physical_type(), getArrowImportType(), StringOps_Namespace::StringOpInfo::getIntLiteral(), StringOps_Namespace::StringOpInfo::intLiteralArgAtIdxExists(), SQLTypeInfo::is_integer(), StringOps_Namespace::StringOpInfo::isLiteralArgNull(), StringOps_Namespace::operator<<(), import_export::parse_add_metadata_columns(), and ddl_utils::validate_and_set_fixed_encoding().
#define IS_INTERVAL | ( | T | ) | ((T) == kINTERVAL_DAY_TIME || (T) == kINTERVAL_YEAR_MONTH) |
Definition at line 253 of file sqltypes.h.
Referenced by SQLTypeInfo::is_timeinterval().
#define IS_NUMBER | ( | T | ) |
Definition at line 247 of file sqltypes.h.
Referenced by SQLTypeInfo::is_number(), and anonymous_namespace{EquiJoinCondition.cpp}::make_composite_equals_impl().
Definition at line 250 of file sqltypes.h.
Referenced by import_export::TypedImportBuffer::add_value(), import_export::TypedImportBuffer::add_values(), import_export::TypedImportBuffer::addDefaultValues(), import_export::TypedImportBuffer::clear(), foreign_storage::TextFileBufferParser::convertImportBuffersToDataBlocks(), Encoder::Create(), import_export::fill_missing_columns(), import_export::Loader::fillShardRow(), import_export::Detector::find_best_encodings(), import_export::TypedImportBuffer::get_data_block_pointers(), import_export::Loader::getStringDict(), StringOps_Namespace::StringOpInfo::getStringLiteral(), foreign_storage::anonymous_namespace{InternalSystemDataWrapper.cpp}::initialize_import_buffers(), SQLTypeInfo::is_string(), SQLTypeInfo::is_string_array(), SQLTypeInfo::is_subtype_dict_encoded_string(), SQLTypeInfo::is_varlen(), StringOps_Namespace::StringOpInfo::isLiteralArgNull(), anonymous_namespace{EquiJoinCondition.cpp}::make_composite_equals_impl(), StringOps_Namespace::operator<<(), foreign_storage::ParseBufferRequest::ParseBufferRequest(), import_export::TypedImportBuffer::pop_value(), StringOps_Namespace::StringOpInfo::stringLiteralArgAtIdxExists(), import_export::TypedImportBuffer::TypedImportBuffer(), and import_export::TypedImportBuffer::~TypedImportBuffer().
#define REGULAR_DICT | ( | TRANSIENTID | ) | (-(TRANSIENTID)) |
Definition at line 261 of file sqltypes.h.
Referenced by RowSetMemoryOwner::getOrAddStringDictProxy().
#define TRANSIENT_DICT | ( | ID | ) | (-(ID)) |
Definition at line 260 of file sqltypes.h.
Referenced by Analyzer::Expr::add_cast(), Analyzer::UOper::add_cast(), Analyzer::CaseExpr::add_cast(), Parser::common_string_type(), Analyzer::BinOper::common_string_type(), SQLTypeInfo::operator!=(), and SQLTypeInfo::operator==().
#define TRANSIENT_DICT_ID 0 |
Definition at line 259 of file sqltypes.h.
Referenced by Analyzer::Expr::add_cast(), Analyzer::CaseExpr::add_cast(), Parser::QuerySpec::analyze_group_by(), CodeGenerator::codegenDictLike(), CodeGenerator::codegenDictRegexp(), RelAlgExecutor::createTableFunctionWorkUnit(), Parser::get_str_dict_cast_type(), getExpressionRange(), StringDictionaryGenerations::getGeneration(), Analyzer::StringOper::hasNoneEncodedTextArg(), pre_translate_string_ops(), anonymous_namespace{RelAlgExecutor.cpp}::set_transient_dict(), RelAlgTranslator::translateArrayFunction(), RelAlgTranslator::translateStringOper(), RelAlgTranslator::translateUoper(), and anonymous_namespace{ExpressionRewrite.cpp}::ArrayElementStringLiteralEncodingVisitor::visitArrayOper().
using ArrayDatum = std::conditional_t<is_cuda_compiler(), DeviceArrayDatum, HostArrayDatum> |
Definition at line 208 of file sqltypes.h.
using ArrayOffsetT = int32_t |
Definition at line 1114 of file sqltypes.h.
using StringOffsetT = int32_t |
Definition at line 1113 of file sqltypes.h.
enum EncodingType |
Enumerator | |
---|---|
kENCODING_NONE | |
kENCODING_FIXED | |
kENCODING_RL | |
kENCODING_DIFF | |
kENCODING_DICT | |
kENCODING_SPARSE | |
kENCODING_GEOINT | |
kENCODING_DATE_IN_DAYS | |
kENCODING_LAST |
Definition at line 233 of file sqltypes.h.
enum SQLTypes |
Definition at line 38 of file sqltypes.h.
int8_t* append_datum | ( | int8_t * | buf, |
const Datum & | d, | ||
const SQLTypeInfo & | ti | ||
) |
Definition at line 512 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 556 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 | , |
const Datum | , | ||
const SQLTypeInfo & | ti | ||
) |
Definition at line 342 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, kMULTIPOLYGON, kNUMERIC, kPOINT, kPOLYGON, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, kVARCHAR, Datum::smallintval, Datum::stringval, and Datum::tinyintval.
Referenced by ChunkMetadata::operator==(), FixedLengthArrayNoneEncoder::resetChunkStats(), and ArrayNoneEncoder::resetChunkStats().
std::string DatumToString | ( | Datum | d, |
const SQLTypeInfo & | ti | ||
) |
Definition at line 392 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 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(), Fragmenter_Namespace::InsertOrderFragmenter::updateChunkStats(), and ScalarExprToSql::visitConstant().
SQLTypes decimal_to_int_type | ( | const SQLTypeInfo & | ) |
Definition at line 493 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(), 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 481 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 455 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<<().
|
inline |
Definition at line 1118 of file sqltypes.h.
References kARRAY.
Referenced by ext_arg_type_to_type_info().
|
inline |
Definition at line 1138 of file sqltypes.h.
References kCOLUMN_LIST.
Referenced by bind_function(), and table_functions::anonymous_namespace{TableFunctionsFactory.cpp}::ext_arg_pointer_type_to_type_info().
|
inline |
Definition at line 1124 of file sqltypes.h.
References kCOLUMN.
Referenced by bind_function(), table_functions::anonymous_namespace{TableFunctionsFactory.cpp}::ext_arg_pointer_type_to_type_info(), and ext_arg_type_to_type_info().
|
inline |
Definition at line 1130 of file sqltypes.h.
References kCOLUMN.
|
inline |
Definition at line 1069 of file sqltypes.h.
References kBIGINT, kINT, kSMALLINT, kTINYINT, and UNREACHABLE.
Referenced by anonymous_namespace{RelAlgExecutor.cpp}::anonymous_namespace{RelAlgExecutor.cpp}::conditionally_change_arg_to_int_type(), and decimal_to_int_type().
|
inline |
Definition at line 1087 of file sqltypes.h.
References SQLTypeInfo::get_comp_param(), SQLTypeInfo::get_compression(), SQLTypeInfo::get_dimension(), SQLTypeInfo::get_notnull(), SQLTypeInfo::get_scale(), SQLTypeInfo::get_subtype(), SQLTypeInfo::get_type(), kARRAY, kENCODING_DATE_IN_DAYS, kENCODING_FIXED, and kENCODING_NONE.
Referenced by anonymous_namespace{ColumnFetcher.cpp}::columnarize_result(), anonymous_namespace{ColumnarResults.cpp}::fixed_encoding_nullable_val(), anonymous_namespace{RelAlgExecutor.cpp}::get_logical_type_for_expr(), anonymous_namespace{TypedDataAccessors.h}::NullSentinelSupplier::get_null_sentinel_for_type(), get_nullable_logical_type_info(), target_info::get_target_info_impl(), TableOptimizer::getDeletedColumnStats(), PerfectJoinHashTable::getHashJoinArgs(), getLeafColumnRange(), Parser::CaseExpr::normalize(), TableOptimizer::recomputeColumnMetadata(), Fragmenter_Namespace::InsertOrderFragmenter::updateChunkStats(), and Fragmenter_Namespace::InsertOrderFragmenter::updateColumns().
|
inline |
Definition at line 1108 of file sqltypes.h.
References get_logical_type_info(), and get_nullable_type_info().
Referenced by anonymous_namespace{RelAlgExecutor.cpp}::get_logical_type_for_expr(), and RelAlgTranslator::translateArrayFunction().
|
inline |
Definition at line 1102 of file sqltypes.h.
References SQLTypeInfo::set_notnull().
Referenced by CodeGenerator::createInValuesBitmap(), Analyzer::Constant::do_cast(), and get_nullable_logical_type_info().
|
inline |
Definition at line 199 of file sqltypes.h.
constexpr auto is_datetime | ( | SQLTypes | type | ) |
Definition at line 263 of file sqltypes.h.
References kDATE, kTIME, and kTIMESTAMP.
Referenced by ColumnDescriptor::getDefaultValueLiteral(), SQLTypeInfo::is_time(), ArrowForeignStorageBase::replaceNullValues(), RexLiteral::RexLiteral(), and ddl_utils::validate_and_set_fixed_encoding().
|
inline |
Definition at line 143 of file sqltypes.h.
References toString().
SQLTypes string_dict_to_int_type | ( | const SQLTypeInfo & | ) |
Definition at line 497 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(), and foreign_storage::ParquetFixedLengthArrayEncoder::setNullFixedLengthArraySentinel().
Datum StringToDatum | ( | std::string_view | s, |
SQLTypeInfo & | ti | ||
) |
Definition at line 275 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, 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(), anonymous_namespace{ArrowImporter.h}::ArrowValue< std::string >::operator DATA_TYPE(), populate_TColumn(), import_export::StringToArray(), and ddl_utils::anonymous_namespace{DdlUtils.cpp}::validate_literal().
|
inline |
Definition at line 74 of file sqltypes.h.
References logger::FATAL, kARRAY, kBIGINT, kBOOLEAN, kCHAR, kCOLUMN, kCOLUMN_LIST, kCURSOR, kDATE, kDECIMAL, kDOUBLE, kEVAL_CONTEXT_TYPE, kFLOAT, kGEOGRAPHY, kGEOMETRY, kINT, kINTERVAL_DAY_TIME, kINTERVAL_YEAR_MONTH, kLINESTRING, kMULTIPOLYGON, kNULLT, kNUMERIC, kPOINT, kPOLYGON, kSMALLINT, kSQLTYPE_LAST, kTEXT, kTIME, kTIMESTAMP, kTINYINT, kVARCHAR, kVOID, LOG, and run_benchmark_import::type.