dongjoon-hyun commented on a change in pull request #1044:
URL: https://github.com/apache/orc/pull/1044#discussion_r809336355
##########
File path: tools/test/TestCSVFileImport.cc
##########
@@ -90,3 +92,36 @@ TEST (TestCSVFileImport, testTimezoneOption) {
EXPECT_EQ("", error);
}
}
+
+TEST (TestCSVFileImport, testLongString) {
+ // create an ORC file from importing the CSV file
+ const std::string pgm1 = findProgram("tools/src/csv-import");
+ const std::string csvFile = "/tmp/test_csv_import_test_long_string.csv";
+ const std::string orcFile = "/tmp/test_csv_import_test_long_string.orc";
+ const std::string schema = "'struct<_a:string,b_:binary,_c:varchar(10)>'";
+ std::string output;
+ std::string error;
+
+ std::ofstream csvFileStream(csvFile, std::ios::binary | std::ios::out |
std::ios::trunc);
+ if(csvFileStream.is_open())
+ {
+ std::string longStr;
+ longStr.resize(4 * 1024 * 1024 + 1, 'x');
+ csvFileStream << "str1," << longStr << ",var1\n";
+ csvFileStream << "str2," << longStr << ",var2\n";
+ csvFileStream.close();
+ }
+
+ EXPECT_EQ(0, runProgram({pgm1, schema, csvFile, orcFile}, output, error));
+ EXPECT_EQ("", error);
+
+ // verify the ORC file content
+ const std::string pgm2 = findProgram("tools/src/orc-contents");
+ std::string option = "--columns=0,2";
+ const std::string expected =
+ "{\"_a\": \"str1\", \"_c\": \"var1\"}\n"
+ "{\"_a\": \"str2\", \"_c\": \"var2\"}\n";
+ EXPECT_EQ(0, runProgram({pgm2, option, orcFile}, output, error));
+ EXPECT_EQ(expected, output);
+ EXPECT_EQ("", error);
Review comment:
Hmm. The test case seems to pass without your patch still.
```
$ make package test-out
...
Test project /Users/dongjoon/APACHE/orc-merge/build
Start 1: orc-test
1/2 Test #1: orc-test ......................... Passed 2.91 sec
Start 2: tool-test
2/2 Test #2: tool-test ........................ Passed 12.29 sec
100% tests passed, 0 tests failed out of 2
Total Test time (real) = 15.21 sec
Built target test-out
$ git diff main --stat
tools/test/TestCSVFileImport.cc | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
```
The valid test case should fail on main branch without your patch. Could you
take a look at this once more and make it sure?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]