MCPcopy Create free account
hub / github.com/apache/orc / TEST

Function TEST

tools/test/TestCSVFileImport.cc:29–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#include <fstream>
28
29TEST(TestCSVFileImport, test10rows) {
30 // create an ORC file from importing the CSV file
31 const std::string pgm1 = findProgram("tools/src/csv-import");
32 const std::string csvFile = findExample("TestCSVFileImport.test10rows.csv");
33 const std::string orcFile = "/tmp/test_csv_import_test_10_rows.orc";
34 const std::string schema = "'struct<_a:bigint,b_:string,c_col:double>'";
35 std::string output;
36 std::string error;
37
38 EXPECT_EQ(0, runProgram({pgm1, schema, csvFile, orcFile}, output, error));
39 EXPECT_EQ("", error);
40
41 // verify the ORC file content
42 const std::string pgm2 = findProgram("tools/src/orc-contents");
43 const std::string expected =
44 "{\"_a\": 0, \"b_\": \"a\", \"c_col\": 0}\n"
45 "{\"_a\": 1, \"b_\": \"b\", \"c_col\": 1.1}\n"
46 "{\"_a\": 2, \"b_\": \"c\", \"c_col\": 2.2}\n"
47 "{\"_a\": 3, \"b_\": \"d\", \"c_col\": null}\n"
48 "{\"_a\": 4, \"b_\": null, \"c_col\": 4.4}\n"
49 "{\"_a\": null, \"b_\": \"f\", \"c_col\": 5.5}\n"
50 "{\"_a\": null, \"b_\": null, \"c_col\": null}\n"
51 "{\"_a\": 7, \"b_\": \"h\", \"c_col\": 7.7}\n"
52 "{\"_a\": 8, \"b_\": \"i\", \"c_col\": 8.8}\n"
53 "{\"_a\": 9, \"b_\": \"j\", \"c_col\": 9.9}\n";
54 EXPECT_EQ(0, runProgram({pgm2, orcFile}, output, error));
55 EXPECT_EQ(expected, output);
56 EXPECT_EQ("", error);
57}
58
59TEST(TestCSVFileImport, testTimezoneOption) {
60 // create an ORC file from importing the CSV file

Callers

nothing calls this directly

Calls 5

findProgramFunction · 0.85
findExampleFunction · 0.85
runProgramFunction · 0.85
closeMethod · 0.65
resizeMethod · 0.45

Tested by

no test coverage detected