File tree Expand file tree Collapse file tree 5 files changed +6
-29
lines changed
Expand file tree Collapse file tree 5 files changed +6
-29
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,12 @@ enum class PlanFileFormat {
3030 * amount of memory that it consumed on disk.
3131 *
3232 * \param input_filename The filename containing the plan to convert.
33- * \param force_binary If true, the plan will be opened as a binary file.
34- * Required on Windows to avoid text mode line-ending translation.
3533 * \return If loading was successful, returns a plan. If loading was not
3634 * successful this is a status containing a list of parse errors in the status's
3735 * message.
3836 */
3937absl::StatusOr<::substrait::proto::Plan> loadPlan (
40- std::string_view input_filename,
41- bool force_binary = false );
38+ std::string_view input_filename);
4239
4340/*
4441 * \brief Writes the provided plan to disk.
Original file line number Diff line number Diff line change @@ -37,10 +37,8 @@ PlanFileFormat detectFormat(std::string_view content) {
3737} // namespace
3838
3939absl::StatusOr<::substrait::proto::Plan> loadPlan (
40- std::string_view input_filename,
41- bool forceBinary) {
42- auto contentOrError =
43- textplan::readFromFile (input_filename.data (), forceBinary);
40+ std::string_view input_filename) {
41+ auto contentOrError = textplan::readFromFile (input_filename.data ());
4442 if (!contentOrError.ok ()) {
4543 return contentOrError.status ();
4644 }
Original file line number Diff line number Diff line change @@ -87,16 +87,7 @@ TEST_P(SaveAndLoadTestFixture, SaveAndLoad) {
8787 read->mutable_named_table ()->add_names (" table_name" );
8888 auto status = ::io::substrait::savePlan (plan, tempFilename, encoding);
8989 ASSERT_TRUE (status.ok ()) << " Save failed.\n " << status;
90-
91- #ifdef _WIN32
92- // Windows cannot rely on io::substrait::loadPlan to detect the file format,
93- // since it needs to a-priori specify how the file should be loaded.
94- bool forceBinary = encoding == PlanFileFormat::kBinary ;
95- auto result = ::io::substrait::loadPlan (tempFilename, forceBinary);
96- #else
9790 auto result = ::io::substrait::loadPlan (tempFilename);
98- #endif
99-
10091 ASSERT_TRUE (result.ok ()) << " Load failed.\n " << result.status ();
10192 ASSERT_THAT (
10293 *result,
Original file line number Diff line number Diff line change @@ -42,15 +42,8 @@ class StringErrorCollector : public google::protobuf::io::ErrorCollector {
4242
4343} // namespace
4444
45- absl::StatusOr<std::string> readFromFile (
46- std::string_view msgPath,
47- bool forceBinary) {
48- std::ifstream file;
49- if (forceBinary)
50- file.open (std::string{msgPath}, std::ios::binary);
51- else
52- file.open (std::string{msgPath}, std::ios::in);
53-
45+ absl::StatusOr<std::string> readFromFile (std::string_view msgPath) {
46+ std::ifstream file (std::string{msgPath}, std::ios::binary);
5447 if (file.fail ()) {
5548 auto currDir = std::filesystem::current_path ().string ();
5649 return absl::ErrnoToStatus (
Original file line number Diff line number Diff line change @@ -14,9 +14,7 @@ namespace io::substrait::textplan {
1414
1515// Read the contents of a file from disk. 'forceBinary' enables file reading in
1616// binary mode.
17- absl::StatusOr<std::string> readFromFile (
18- std::string_view msgPath,
19- bool forceBinary = false );
17+ absl::StatusOr<std::string> readFromFile (std::string_view msgPath);
2018
2119// Reads a plan from a json-encoded text proto.
2220// Returns a list of errors if the file cannot be parsed.
You can’t perform that action at this time.
0 commit comments