Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::CSVCast Class Reference

Classes

struct  TryCastDateOperator
struct  TryCastTimestampOperator

Static Public Member Functions

static bool TryCastDateVector (const map< LogicalTypeId, CSVOption< StrpTimeFormat > > &options, Vector &input_vector, Vector &result_vector, idx_t count, CastParameters &parameters, idx_t &line_error, bool nullify_error=false)
static bool TryCastTimestampVector (const map< LogicalTypeId, CSVOption< StrpTimeFormat > > &options, Vector &input_vector, Vector &result_vector, idx_t count, CastParameters &parameters, bool nullify_error=false)
static bool TryCastFloatingVectorCommaSeparated (const CSVReaderOptions &options, Vector &input_vector, Vector &result_vector, idx_t count, CastParameters &parameters, const LogicalType &result_type, idx_t &line_error)
static bool TryCastDecimalVectorCommaSeparated (const CSVReaderOptions &options, Vector &input_vector, Vector &result_vector, idx_t count, CastParameters &parameters, const LogicalType &result_type, idx_t &line_error)

Static Private Member Functions

template<class OP, class T>
static bool TemplatedTryCastFloatingVector (const CSVReaderOptions &options, Vector &input_vector, Vector &result_vector, idx_t count, CastParameters &parameters, idx_t &line_error)
template<class OP, class T>
static bool TemplatedTryCastDecimalVector (const CSVReaderOptions &options, Vector &input_vector, Vector &result_vector, idx_t count, CastParameters &parameters, uint8_t width, uint8_t scale, idx_t &line_error)
template<class OP, class T>
static bool TemplatedTryCastDateVector (const map< LogicalTypeId, CSVOption< StrpTimeFormat > > &options, Vector &input_vector, Vector &result_vector, idx_t count, CastParameters &parameters, idx_t &line_error, bool nullify_error)

Member Function Documentation

◆ TemplatedTryCastFloatingVector()

template<class OP, class T>
bool duckdb::CSVCast::TemplatedTryCastFloatingVector ( const CSVReaderOptions & options,
Vector & input_vector,
Vector & result_vector,
idx_t count,
CastParameters & parameters,
idx_t & line_error )
inlinestaticprivate
169151 {
169152 D_ASSERT(input_vector.GetType().id() == LogicalTypeId::VARCHAR);
169153 bool all_converted = true;
169154 idx_t row = 0;
169155 UnaryExecutor::Execute<string_t, T>(input_vector, result_vector, count, [&](string_t input) {
169156 T result;
169157 if (!OP::Operation(input, result, parameters)) {
169158 line_error = row;
169159 all_converted = false;
169160 } else {
169161 row++;
169162 }
169163 return result;
169164 });
169165 return all_converted;
169166 }
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ TemplatedTryCastDecimalVector()

template<class OP, class T>
bool duckdb::CSVCast::TemplatedTryCastDecimalVector ( const CSVReaderOptions & options,
Vector & input_vector,
Vector & result_vector,
idx_t count,
CastParameters & parameters,
uint8_t width,
uint8_t scale,
idx_t & line_error )
inlinestaticprivate
169171 {
169172 D_ASSERT(input_vector.GetType().id() == LogicalTypeId::VARCHAR);
169173 bool all_converted = true;
169174 auto &validity_mask = FlatVector::Validity(result_vector);
169175 idx_t cur_line = 0;
169176 UnaryExecutor::Execute<string_t, T>(input_vector, result_vector, count, [&](string_t input) {
169177 T result;
169178 if (!OP::Operation(input, result, parameters, width, scale)) {
169179 if (all_converted) {
169180 line_error = cur_line;
169181 }
169182 validity_mask.SetInvalid(cur_line);
169183 all_converted = false;
169184 cur_line++;
169185 } else {
169186 cur_line++;
169187 }
169188 return result;
169189 });
169190 return all_converted;
169191 }

◆ TemplatedTryCastDateVector()

template<class OP, class T>
bool duckdb::CSVCast::TemplatedTryCastDateVector ( const map< LogicalTypeId, CSVOption< StrpTimeFormat > > & options,
Vector & input_vector,
Vector & result_vector,
idx_t count,
CastParameters & parameters,
idx_t & line_error,
bool nullify_error )
inlinestaticprivate
169210 {
169211 D_ASSERT(input_vector.GetType().id() == LogicalTypeId::VARCHAR);
169212 bool all_converted = true;
169213 idx_t cur_line = 0;
169214 auto &validity_mask = FlatVector::Validity(result_vector);
169215 UnaryExecutor::Execute<string_t, T>(input_vector, result_vector, count, [&](string_t input) {
169216 T result;
169217 if (!OP::Operation(options, input, result, *parameters.error_message)) {
169218 if (all_converted) {
169219 line_error = cur_line;
169220 }
169221 if (nullify_error) {
169222 validity_mask.SetInvalid(cur_line);
169223 }
169224 all_converted = false;
169225 }
169226 cur_line++;
169227 return result;
169228 });
169229 return all_converted;
169230 }

◆ TryCastDateVector()

bool duckdb::CSVCast::TryCastDateVector ( const map< LogicalTypeId, CSVOption< StrpTimeFormat > > & options,
Vector & input_vector,
Vector & result_vector,
idx_t count,
CastParameters & parameters,
idx_t & line_error,
bool nullify_error = false )
inlinestatic
169235 {
169236 return TemplatedTryCastDateVector<TryCastDateOperator, date_t>(options, input_vector, result_vector, count,
169237 parameters, line_error, nullify_error);
169238 }

◆ TryCastTimestampVector()

bool duckdb::CSVCast::TryCastTimestampVector ( const map< LogicalTypeId, CSVOption< StrpTimeFormat > > & options,
Vector & input_vector,
Vector & result_vector,
idx_t count,
CastParameters & parameters,
bool nullify_error = false )
inlinestatic
169241 {
169242 idx_t line_error;
169243 return TemplatedTryCastDateVector<TryCastTimestampOperator, timestamp_t>(
169244 options, input_vector, result_vector, count, parameters, line_error, nullify_error);
169245 }

◆ TryCastFloatingVectorCommaSeparated()

bool duckdb::CSVCast::TryCastFloatingVectorCommaSeparated ( const CSVReaderOptions & options,
Vector & input_vector,
Vector & result_vector,
idx_t count,
CastParameters & parameters,
const LogicalType & result_type,
idx_t & line_error )
inlinestatic
169248 {
169249 switch (result_type.InternalType()) {
169251 return TemplatedTryCastFloatingVector<TryCastErrorMessageCommaSeparated, double>(
169252 options, input_vector, result_vector, count, parameters, line_error);
169253 case PhysicalType::FLOAT:
169254 return TemplatedTryCastFloatingVector<TryCastErrorMessageCommaSeparated, float>(
169255 options, input_vector, result_vector, count, parameters, line_error);
169256 default:
169257 throw InternalException("Unimplemented physical type for floating");
169258 }
169259 }
@ FLOAT
4-byte floating point value
Definition duckdb.hpp:2773
@ DOUBLE
8-byte floating point value
Definition duckdb.hpp:2776

◆ TryCastDecimalVectorCommaSeparated()

bool duckdb::CSVCast::TryCastDecimalVectorCommaSeparated ( const CSVReaderOptions & options,
Vector & input_vector,
Vector & result_vector,
idx_t count,
CastParameters & parameters,
const LogicalType & result_type,
idx_t & line_error )
inlinestatic
169263 {
169264 auto width = DecimalType::GetWidth(result_type);
169265 auto scale = DecimalType::GetScale(result_type);
169266 switch (result_type.InternalType()) {
169267 case PhysicalType::INT16:
169268 return TemplatedTryCastDecimalVector<TryCastToDecimalCommaSeparated, int16_t>(
169269 options, input_vector, result_vector, count, parameters, width, scale, line_error);
169270 case PhysicalType::INT32:
169271 return TemplatedTryCastDecimalVector<TryCastToDecimalCommaSeparated, int32_t>(
169272 options, input_vector, result_vector, count, parameters, width, scale, line_error);
169273 case PhysicalType::INT64:
169274 return TemplatedTryCastDecimalVector<TryCastToDecimalCommaSeparated, int64_t>(
169275 options, input_vector, result_vector, count, parameters, width, scale, line_error);
169276 case PhysicalType::INT128:
169277 return TemplatedTryCastDecimalVector<TryCastToDecimalCommaSeparated, hugeint_t>(
169278 options, input_vector, result_vector, count, parameters, width, scale, line_error);
169279 default:
169280 throw InternalException("Unimplemented physical type for decimal");
169281 }
169282 }
void scale(cv::Mat &mat, const cv::Mat &range, const T min, const T max)
@ INT64
Signed 64-bit little-endian integer.
Definition duckdb.hpp:2767
@ INT16
Signed 16-bit little-endian integer.
Definition duckdb.hpp:2755
@ INT32
Signed 32-bit little-endian integer.
Definition duckdb.hpp:2761

The documentation for this class was generated from the following file: