OmniSciDB  c07336695a
GeoPolygonColumnDescriptor Class Reference
+ Inheritance diagram for GeoPolygonColumnDescriptor:
+ Collaboration diagram for GeoPolygonColumnDescriptor:

Public Member Functions

 GeoPolygonColumnDescriptor (SQLTypes sql_type=kPOLYGON)
 
bool skip_test (std::string name) override
 
std::string get_column_definition () override
 
std::string getColumnWktStringValue (int row)
 
std::string get_column_value (int row) override
 
bool check_column_value (int row, const TDatum *value) override
 
 GeoPolygonColumnDescriptor (SQLTypes sql_type=kPOLYGON)
 
bool skip_test (std::string name) override
 
std::string get_column_definition () override
 
std::string getColumnWktStringValue (int row)
 
std::string get_column_value (int row) override
 
bool check_column_value (int row, const SQLTypeInfo &type, const ScalarTargetValue *value) override
 
- Public Member Functions inherited from TestColumnDescriptor
virtual std::string get_update_column_value (int row)
 
virtual ~TestColumnDescriptor ()=default
 
virtual std::string get_update_column_value (int row)
 
virtual bool check_column_value (const int row, const SQLTypeInfo &type, const TargetValue *value)
 
virtual ~TestColumnDescriptor ()=default
 

Private Attributes

std::string prefix
 
SQLTypes rs_type
 

Detailed Description

Definition at line 526 of file CtasIntegrationTest.cpp.

Constructor & Destructor Documentation

◆ GeoPolygonColumnDescriptor() [1/2]

GeoPolygonColumnDescriptor::GeoPolygonColumnDescriptor ( SQLTypes  sql_type = kPOLYGON)
inline

Definition at line 530 of file CtasIntegrationTest.cpp.

530 {};

◆ GeoPolygonColumnDescriptor() [2/2]

GeoPolygonColumnDescriptor::GeoPolygonColumnDescriptor ( SQLTypes  sql_type = kPOLYGON)
inline

Definition at line 558 of file CtasUpdateTest.cpp.

558 : rs_type(sql_type){};

Member Function Documentation

◆ check_column_value() [1/2]

bool GeoPolygonColumnDescriptor::check_column_value ( int  row,
const TDatum *  value 
)
inlineoverridevirtual

Implements TestColumnDescriptor.

Definition at line 550 of file CtasIntegrationTest.cpp.

References checked_get(), logger::ERROR, LOG, and to_string().

550  {
551  std::string mapd_val;
552  if (!checked_get(row, value, mapd_val, std::string(""))) {
553  return false;
554  }
555 
556  if (mapd_val == getColumnWktStringValue(row)) {
557  return true;
558  }
559 
560  LOG(ERROR) << "row: " << std::to_string(row) << " " << getColumnWktStringValue(row)
561  << " vs. " << mapd_val;
562  return false;
563  }
std::string getColumnWktStringValue(int row)
#define LOG(tag)
Definition: Logger.h:182
std::string to_string(char const *&&v)
bool checked_get(size_t row, const SOURCE_TYPE *boost_variant, RETURN_TYPE &val, RETURN_TYPE null_value)
+ Here is the call graph for this function:

◆ check_column_value() [2/2]

bool GeoPolygonColumnDescriptor::check_column_value ( int  row,
const SQLTypeInfo type,
const ScalarTargetValue value 
)
inlineoverridevirtual

Implements TestColumnDescriptor.

Definition at line 578 of file CtasUpdateTest.cpp.

References logger::ERROR, SQLTypeInfoCore< TYPE_FACET_PACK >::get_type(), LOG, and to_string().

580  {
581  if (!(type.get_type() == rs_type)) {
582  return false;
583  }
584 
585  const auto mapd_as_str_p = boost::get<NullableString>(value);
586  if (nullptr == mapd_as_str_p) {
587  return false;
588  }
589 
590  const auto mapd_str_p = boost::get<std::string>(mapd_as_str_p);
591  if (nullptr == mapd_str_p) {
592  return false;
593  }
594 
595  const auto mapd_val = *mapd_str_p;
596  if (mapd_val == getColumnWktStringValue(row)) {
597  return true;
598  }
599 
600  LOG(ERROR) << "row: " << std::to_string(row) << " " << getColumnWktStringValue(row)
601  << " vs. " << mapd_val;
602  return false;
603  }
std::string getColumnWktStringValue(int row)
#define LOG(tag)
Definition: Logger.h:182
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:319
std::string to_string(char const *&&v)
+ Here is the call graph for this function:

◆ get_column_definition() [1/2]

std::string GeoPolygonColumnDescriptor::get_column_definition ( )
inlineoverridevirtual

Implements TestColumnDescriptor.

Definition at line 534 of file CtasIntegrationTest.cpp.

534 { return "POLYGON"; };

◆ get_column_definition() [2/2]

std::string GeoPolygonColumnDescriptor::get_column_definition ( )
inlineoverridevirtual

Implements TestColumnDescriptor.

Definition at line 562 of file CtasUpdateTest.cpp.

562 { return "POLYGON"; };

◆ get_column_value() [1/2]

std::string GeoPolygonColumnDescriptor::get_column_value ( int  row)
inlineoverridevirtual

Implements TestColumnDescriptor.

Definition at line 546 of file CtasIntegrationTest.cpp.

546  {
547  return "'" + getColumnWktStringValue(row) + "'";
548  };
std::string getColumnWktStringValue(int row)

◆ get_column_value() [2/2]

std::string GeoPolygonColumnDescriptor::get_column_value ( int  row)
inlineoverridevirtual

Implements TestColumnDescriptor.

Definition at line 574 of file CtasUpdateTest.cpp.

574  {
575  return "'" + getColumnWktStringValue(row) + "'";
576  };
std::string getColumnWktStringValue(int row)

◆ getColumnWktStringValue() [1/2]

std::string GeoPolygonColumnDescriptor::getColumnWktStringValue ( int  row)
inline

Definition at line 536 of file CtasIntegrationTest.cpp.

References to_string().

536  {
537  std::string polygon =
538  "POLYGON ((0 " + std::to_string(row) + ",4 " + std::to_string(row) + ",4 " +
539  std::to_string(row + 4) + ",0 " + std::to_string(row + 4) + ",0 " +
540  std::to_string(row) + "),(1 " + std::to_string(row + 1) + ",1 " +
541  std::to_string(row + 2) + ",2 " + std::to_string(row + 2) + ",2 " +
542  std::to_string(row + 1) + ",1 " + std::to_string(row + 1) + "))";
543  return polygon;
544  }
std::string to_string(char const *&&v)
+ Here is the call graph for this function:

◆ getColumnWktStringValue() [2/2]

std::string GeoPolygonColumnDescriptor::getColumnWktStringValue ( int  row)
inline

Definition at line 564 of file CtasUpdateTest.cpp.

References to_string().

564  {
565  std::string polygon =
566  "POLYGON ((0 " + std::to_string(row) + ",4 " + std::to_string(row) + ",4 " +
567  std::to_string(row + 4) + ",0 " + std::to_string(row + 4) + ",0 " +
568  std::to_string(row) + "),(1 " + std::to_string(row + 1) + ",1 " +
569  std::to_string(row + 2) + ",2 " + std::to_string(row + 2) + ",2 " +
570  std::to_string(row + 1) + ",1 " + std::to_string(row + 1) + "))";
571  return polygon;
572  }
std::string to_string(char const *&&v)
+ Here is the call graph for this function:

◆ skip_test() [1/2]

bool GeoPolygonColumnDescriptor::skip_test ( std::string  name)
inlineoverridevirtual

Reimplemented from TestColumnDescriptor.

Definition at line 532 of file CtasIntegrationTest.cpp.

532 { return "CreateTableAsSelect" != name; }

◆ skip_test() [2/2]

bool GeoPolygonColumnDescriptor::skip_test ( std::string  name)
inlineoverridevirtual

Reimplemented from TestColumnDescriptor.

Definition at line 560 of file CtasUpdateTest.cpp.

560 { return "CreateTableAsSelect" != name; }

Member Data Documentation

◆ prefix

std::string GeoPolygonColumnDescriptor::prefix
private

Definition at line 527 of file CtasIntegrationTest.cpp.

◆ rs_type

SQLTypes GeoPolygonColumnDescriptor::rs_type
private

Definition at line 554 of file CtasUpdateTest.cpp.


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