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

Public Member Functions

 StringColumnDescriptor (std::string col_type, SQLTypes sql_type, std::string pfix)
 
bool skip_test (std::string name) override
 
std::string get_column_definition () override
 
std::string get_column_value (int row) override
 
bool check_column_value (int row, const TDatum *value) override
 
 StringColumnDescriptor (std::string col_type, SQLTypes sql_type, std::string pfix)
 
bool skip_test (std::string name) override
 
std::string get_column_definition () override
 
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 column_definition
 
std::string prefix
 
SQLTypes rs_type
 

Detailed Description

Definition at line 231 of file CtasIntegrationTest.cpp.

Constructor & Destructor Documentation

◆ StringColumnDescriptor() [1/2]

StringColumnDescriptor::StringColumnDescriptor ( std::string  col_type,
SQLTypes  sql_type,
std::string  pfix 
)
inline

Definition at line 236 of file CtasIntegrationTest.cpp.

237  : column_definition(col_type), prefix(pfix){};

◆ StringColumnDescriptor() [2/2]

StringColumnDescriptor::StringColumnDescriptor ( std::string  col_type,
SQLTypes  sql_type,
std::string  pfix 
)
inline

Definition at line 190 of file CtasUpdateTest.cpp.

191  : column_definition(col_type), rs_type(sql_type), prefix(pfix){};

Member Function Documentation

◆ check_column_value() [1/2]

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

Implements TestColumnDescriptor.

Definition at line 205 of file CtasUpdateTest.cpp.

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

207  {
208  if (!(type.get_type() == rs_type || type.get_type() == kTEXT)) {
209  return false;
210  }
211 
212  const auto mapd_as_str_p = boost::get<NullableString>(value);
213  if (nullptr == mapd_as_str_p) {
214  return false;
215  }
216 
217  const auto mapd_str_p = boost::get<std::string>(mapd_as_str_p);
218  if (nullptr == mapd_str_p) {
219  return 0 == row;
220  }
221 
222  const auto mapd_val = *mapd_str_p;
223  if (row == 0) {
224  if (mapd_val == "") {
225  return true;
226  }
227  } else if (mapd_val == (prefix + "_" + std::to_string(row))) {
228  return true;
229  }
230 
231  LOG(ERROR) << "row: " << std::to_string(row) << " "
232  << (prefix + "_" + std::to_string(row)) << " vs. " << mapd_val;
233  return false;
234  }
#define LOG(tag)
Definition: Logger.h:182
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:319
std::string to_string(char const *&&v)
Definition: sqltypes.h:54
+ Here is the call graph for this function:

◆ check_column_value() [2/2]

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

Implements TestColumnDescriptor.

Definition at line 251 of file CtasIntegrationTest.cpp.

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

251  {
252  std::string mapd_val;
253 
254  if (!checked_get(row, value, mapd_val, std::string(""))) {
255  return 0 == row;
256  }
257 
258  if (row == 0) {
259  if (mapd_val == "") {
260  return true;
261  }
262  } else if (mapd_val == (prefix + "_" + std::to_string(row))) {
263  return true;
264  }
265 
266  LOG(ERROR) << "row: " << std::to_string(row) << " "
267  << (prefix + "_" + std::to_string(row)) << " vs. " << mapd_val;
268  return false;
269  }
#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:

◆ get_column_definition() [1/2]

std::string StringColumnDescriptor::get_column_definition ( )
inlineoverridevirtual

Implements TestColumnDescriptor.

Definition at line 197 of file CtasUpdateTest.cpp.

197 { return column_definition; };

◆ get_column_definition() [2/2]

std::string StringColumnDescriptor::get_column_definition ( )
inlineoverridevirtual

Implements TestColumnDescriptor.

Definition at line 243 of file CtasIntegrationTest.cpp.

243 { return column_definition; };

◆ get_column_value() [1/2]

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

Implements TestColumnDescriptor.

Definition at line 198 of file CtasUpdateTest.cpp.

References to_string().

198  {
199  if (0 == row) {
200  return "null";
201  }
202 
203  return "'" + prefix + "_" + std::to_string(row) + "'";
204  };
std::string to_string(char const *&&v)
+ Here is the call graph for this function:

◆ get_column_value() [2/2]

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

Implements TestColumnDescriptor.

Definition at line 244 of file CtasIntegrationTest.cpp.

References to_string().

244  {
245  if (0 == row) {
246  return "null";
247  }
248 
249  return "'" + prefix + "_" + std::to_string(row) + "'";
250  };
std::string to_string(char const *&&v)
+ Here is the call graph for this function:

◆ skip_test() [1/2]

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

Reimplemented from TestColumnDescriptor.

Definition at line 193 of file CtasUpdateTest.cpp.

193  {
194  return "Array.UpdateColumnByLiteral" == name;
195  }

◆ skip_test() [2/2]

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

Reimplemented from TestColumnDescriptor.

Definition at line 239 of file CtasIntegrationTest.cpp.

239  {
240  return "Array.UpdateColumnByLiteral" == name;
241  }

Member Data Documentation

◆ column_definition

std::string StringColumnDescriptor::column_definition
private

Definition at line 232 of file CtasIntegrationTest.cpp.

◆ prefix

std::string StringColumnDescriptor::prefix
private

Definition at line 233 of file CtasIntegrationTest.cpp.

◆ rs_type

SQLTypes StringColumnDescriptor::rs_type
private

Definition at line 186 of file CtasUpdateTest.cpp.


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