Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLUTEN-3548][CH] Bug fix csv file cr at end of line #3549

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
A,110,208819249
B,112,208819248C,123,783434434
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1028,4 +1028,27 @@ class GlutenClickHouseHiveTableSuite()
compareResultsAgainstVanillaSpark(select_sql, compareResult = true, _ => {})
spark.sql("DROP TABLE test_tbl_3552")
}

test("GLUTEN-3548: Bug fix csv allow cr end of line") {
val data_path = rootPath + "/text-data/cr_end_of_line"
spark.sql(s"""
| CREATE TABLE test_tbl_3548(
| a string,
| b string,
| c string)
| ROW FORMAT SERDE
| 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
|WITH SERDEPROPERTIES (
| 'field.delim'=','
| )
| STORED AS INPUTFORMAT
| 'org.apache.hadoop.mapred.TextInputFormat'
|OUTPUTFORMAT
| 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
|LOCATION '$data_path'
|""".stripMargin)
val select_sql = "select * from test_tbl_3548"
compareResultsAgainstVanillaSpark(select_sql, compareResult = true, _ => {})
spark.sql("DROP TABLE test_tbl_3548")
}
}
1 change: 1 addition & 0 deletions cpp-ch/local-engine/Common/CHUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ void BackendInitializerUtil::initSettings(std::map<std::string, std::string> & b
settings.set("input_format_json_read_numbers_as_strings", true);
settings.set("input_format_json_read_bools_as_numbers", false);
settings.set("input_format_csv_trim_whitespaces", false);
settings.set("input_format_csv_allow_cr_end_of_line", true);
settings.set("output_format_orc_string_as_string", true);
settings.set("output_format_parquet_version", "1.0");
settings.set("output_format_parquet_compression_method", "snappy");
Expand Down
Loading