OmniSciDB  04ee39c94c
ImportTest.cpp File Reference
#include "TestHelpers.h"
#include "../Import/Importer.h"
#include <algorithm>
#include <limits>
#include <string>
#include <gtest/gtest.h>
#include <boost/algorithm/string.hpp>
#include <boost/program_options.hpp>
#include "../Catalog/Catalog.h"
#include "../Parser/parser.h"
#include "../QueryEngine/ResultSet.h"
#include "../QueryRunner/QueryRunner.h"
#include "../Shared/geo_types.h"
#include "boost/filesystem.hpp"
+ Include dependency graph for ImportTest.cpp:

Go to the source code of this file.

Classes

class  anonymous_namespace{ImportTest.cpp}::ImportTestMiniSort
 
class  anonymous_namespace{ImportTest.cpp}::ImportTestMixedVarlen
 
class  anonymous_namespace{ImportTest.cpp}::ImportTestDate
 
class  anonymous_namespace{ImportTest.cpp}::ImportTestLegacyDate
 
class  anonymous_namespace{ImportTest.cpp}::ImportTestDateArray
 
class  anonymous_namespace{ImportTest.cpp}::ImportTestTimestamps
 
class  anonymous_namespace{ImportTest.cpp}::ImportTest
 
class  anonymous_namespace{ImportTest.cpp}::ImportTestSharded
 
class  anonymous_namespace{ImportTest.cpp}::ImportTestShardedText
 
class  anonymous_namespace{ImportTest.cpp}::ImportTestShardedText8
 
class  anonymous_namespace{ImportTest.cpp}::GeoImportTest
 
class  anonymous_namespace{ImportTest.cpp}::GeoGDALImportTest
 

Namespaces

 anonymous_namespace{ImportTest.cpp}
 
 anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}
 

Macros

#define BASE_PATH   "./tmp"
 
#define SKIP_ALL_ON_AGGREGATOR()
 

Typedefs

using anonymous_namespace{ImportTest.cpp}::QR = QueryRunner::QueryRunner
 

Functions

void anonymous_namespace{ImportTest.cpp}::run_ddl_statement (const string &input_str)
 
std::shared_ptr< ResultSetanonymous_namespace{ImportTest.cpp}::run_query (const string &query_str)
 
bool anonymous_namespace{ImportTest.cpp}::compare_agg (const int64_t cnt, const double avg)
 
bool anonymous_namespace{ImportTest.cpp}::import_test_common (const string &query_str, const int64_t cnt, const double avg)
 
bool anonymous_namespace{ImportTest.cpp}::import_test_common_geo (const string &query_str, const std::string &table, const int64_t cnt, const double avg)
 
void anonymous_namespace{ImportTest.cpp}::import_test_geofile_importer (const std::string &file_str, const std::string &table_name, const bool compression, const bool create_table=true)
 
bool anonymous_namespace{ImportTest.cpp}::import_test_local (const string &filename, const int64_t cnt, const double avg)
 
bool anonymous_namespace{ImportTest.cpp}::import_test_local_geo (const string &filename, const string &other_options, const int64_t cnt, const double avg)
 
std::string anonymous_namespace{ImportTest.cpp}::TypeToString (SQLTypes type)
 
void anonymous_namespace{ImportTest.cpp}::d (const SQLTypes expected_type, const std::string &str)
 
 anonymous_namespace{ImportTest.cpp}::TEST (Detect, DateTime)
 
 anonymous_namespace{ImportTest.cpp}::TEST (Detect, Numeric)
 
void anonymous_namespace{ImportTest.cpp}::create_minisort_table_on_column (const std::string &column_name)
 
void anonymous_namespace{ImportTest.cpp}::check_minisort_on_expects (const std::string &table_name, const std::vector< int > &expects)
 
void anonymous_namespace{ImportTest.cpp}::test_minisort_on_column (const std::string &column_name, const std::vector< int > expects)
 
void anonymous_namespace{ImportTest.cpp}::create_minisort_table_on_column_with_ctas (const std::string &column_name)
 
void anonymous_namespace{ImportTest.cpp}::test_minisort_on_column_with_ctas (const std::string &column_name, const std::vector< int > expects)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_none)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_int)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_float)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_int_array)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_string_array)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_string_2b)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_date)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_date_2b)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_time)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_time_4b)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_varlen_array)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, on_geo_point)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_none)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_int)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_float)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_int_array)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_string_array)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_string_2b)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_date)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_date_2b)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_time)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_time_4b)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_varlen_array)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMiniSort, ctas_on_geo_point)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestMixedVarlen, Fix_failed_import_arrays_after_geos)
 
std::string anonymous_namespace{ImportTest.cpp}::convert_date_to_string (int64_t d)
 
void anonymous_namespace{ImportTest.cpp}::run_mixed_dates_test ()
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestDate, ImportMixedDates)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestLegacyDate, ImportMixedDates)
 
void anonymous_namespace{ImportTest.cpp}::decode_str_array (const TargetValue &r, std::vector< std::string > &arr)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestDateArray, ImportMixedDateArrays)
 
std::string anonymous_namespace{ImportTest.cpp}::convert_timestamp_to_string (const time_t timeval, const int dimen)
 
void anonymous_namespace{ImportTest.cpp}::run_mixed_timestamps_test ()
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestTimestamps, ImportMixedTimestamps)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, One_csv_file)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, One_csv_file_no_newline)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, Many_csv_file)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, Many_csv_file_no_newline)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, One_gz_file)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, One_bz2_file)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, One_tar_with_many_csv_files)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, One_tgz_with_many_csv_files)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, One_rar_with_many_csv_files)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, One_zip_with_many_csv_files)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, One_7z_with_many_csv_files)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTest, One_tgz_with_many_csv_files_no_newline)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestSharded, One_csv_file)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestShardedText, One_csv_file)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (ImportTestShardedText8, One_csv_file)
 
void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_import ()
 
void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_gdal_point_import ()
 
void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_gdal_mpoly_import ()
 
void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_num_rows (const std::string &project_columns, const size_t num_expected_rows)
 
void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_gdal_point_tv_import ()
 
void anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::check_geo_gdal_mpoly_tv_import ()
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, CSV_Import)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, CSV_Import_Empties)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, CSV_Import_Degenerate)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, Geo_CSV_Local_Type_Geometry)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, Geo_CSV_Local_Type_Geography)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, Geo_CSV_Local_Type_Other)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, Geo_CSV_Local_Encoding_NONE)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, Geo_CSV_Local_Encoding_GEOINT32)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, Geo_CSV_Local_Encoding_Other)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, Geo_CSV_Local_SRID_LonLat)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, Geo_CSV_Local_SRID_Mercator)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoImportTest, Geo_CSV_Local_SRID_Other)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Geojson_Point_Import)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Geojson_MultiPolygon_Import)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Geojson_MultiPolygon_Import_Empties)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Geojson_MultiPolygon_Import_Degenerate)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Shapefile_Point_Import)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Shapefile_MultiPolygon_Import)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Shapefile_Point_Import_Compressed)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Shapefile_MultiPolygon_Import_Compressed)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Shapefile_Point_Import_3857)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Shapefile_MultiPolygon_Import_3857)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Geojson_MultiPolygon_Append)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, Geodatabase_Simple)
 
 anonymous_namespace{ImportTest.cpp}::TEST_F (GeoGDALImportTest, KML_Simple)
 
int main (int argc, char **argv)
 

Variables

bool g_use_date_in_days_default_encoding
 
size_t g_leaf_count
 
bool anonymous_namespace{ImportTest.cpp}::g_aggregator {false}
 
size_t anonymous_namespace{ImportTest.cpp}::g_num_leafs {1}
 
bool anonymous_namespace{ImportTest.cpp}::g_hoist_literals {true}
 
const char * anonymous_namespace{ImportTest.cpp}::create_table_mini_sort
 
const char * anonymous_namespace{ImportTest.cpp}::create_table_mixed_varlen
 
const char * anonymous_namespace{ImportTest.cpp}::create_table_date
 
const char * anonymous_namespace{ImportTest.cpp}::create_table_date_arr
 
const char * anonymous_namespace{ImportTest.cpp}::create_table_timestamps
 
const char * anonymous_namespace{ImportTest.cpp}::create_table_trips
 
const char * anonymous_namespace{ImportTest.cpp}::create_table_trips_sharded
 
const char * anonymous_namespace{ImportTest.cpp}::create_table_trips_dict_sharded_text
 
const char * anonymous_namespace{ImportTest.cpp}::create_table_trips_dict_sharded_text_8bit
 
const char * anonymous_namespace{ImportTest.cpp}::anonymous_namespace{ImportTest.cpp}::create_table_geo
 

Macro Definition Documentation

◆ BASE_PATH

#define BASE_PATH   "./tmp"

Definition at line 37 of file ImportTest.cpp.

Referenced by main().

◆ SKIP_ALL_ON_AGGREGATOR

#define SKIP_ALL_ON_AGGREGATOR ( )
Value:
if (g_aggregator) { \
LOG(ERROR) << "Tests not valid in distributed mode"; \
return; \
}
bool g_aggregator
Definition: ExecuteTest.cpp:46

Definition at line 52 of file ImportTest.cpp.

Referenced by anonymous_namespace{ImportTest.cpp}::TEST_F().

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 1449 of file ImportTest.cpp.

References BASE_PATH, logger::ERROR, logger::LogOptions::get_options(), QueryRunner::QueryRunner::init(), logger::init(), LOG, logger::LogOptions::max_files_, QueryRunner::QueryRunner::reset(), and run.

1449  {
1450  testing::InitGoogleTest(&argc, argv);
1451 
1452  namespace po = boost::program_options;
1453 
1454  po::options_description desc("Options");
1455 
1456  // these two are here to allow passing correctly google testing parameters
1457  desc.add_options()("gtest_list_tests", "list all tests");
1458  desc.add_options()("gtest_filter", "filters tests, use --help for details");
1459 
1460  desc.add_options()(
1461  "test-help",
1462  "Print all ImportTest specific options (for gtest options use `--help`).");
1463 
1464  logger::LogOptions log_options(argv[0]);
1465  log_options.max_files_ = 0; // stderr only by default
1466  desc.add(log_options.get_options());
1467 
1468  po::variables_map vm;
1469  po::store(po::command_line_parser(argc, argv).options(desc).run(), vm);
1470  po::notify(vm);
1471 
1472  if (vm.count("test-help")) {
1473  std::cout << "Usage: ImportTest" << std::endl << std::endl;
1474  std::cout << desc << std::endl;
1475  return 0;
1476  }
1477 
1478  logger::init(log_options);
1479 
1481 
1482  int err{0};
1483  try {
1484  err = RUN_ALL_TESTS();
1485  } catch (const std::exception& e) {
1486  LOG(ERROR) << e.what();
1487  }
1488  QR::reset();
1489  return err;
1490 }
#define LOG(tag)
Definition: Logger.h:182
static QueryRunner * init(const char *db_path, const std::string &udf_filename="", const size_t max_gpu_mem=0, const int reserved_gpu_mem=256<< 20)
Definition: QueryRunner.h:70
void init(LogOptions const &log_opts)
Definition: Logger.cpp:260
#define BASE_PATH
Definition: ImportTest.cpp:37
static bool run
+ Here is the call graph for this function:

Variable Documentation

◆ g_leaf_count

size_t g_leaf_count

◆ g_use_date_in_days_default_encoding