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

Update csv float tests to reflect changes in precision in cuDF #5230

Merged
merged 1 commit into from
Apr 18, 2022
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
17 changes: 16 additions & 1 deletion integration_tests/src/main/python/csv_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def read_impl(spark):
pytest.param('simple_float_values.csv', _int_schema, {'header': 'true'}),
pytest.param('simple_float_values.csv', _long_schema, {'header': 'true'}),
pytest.param('simple_float_values.csv', _float_schema, {'header': 'true'}),
pytest.param('simple_float_values.csv', _double_schema, {'header': 'true'}, marks=pytest.mark.xfail(reason='https://github.com/NVIDIA/spark-rapids/issues/5211')),
pytest.param('simple_float_values.csv', _double_schema, {'header': 'true'}),
pytest.param('simple_float_values.csv', _decimal_10_2_schema, {'header': 'true'}),
pytest.param('simple_float_values.csv', _decimal_10_3_schema, {'header': 'true'}),
pytest.param('simple_boolean_values.csv', _bool_schema, {'header': 'true'}),
Expand All @@ -257,6 +257,21 @@ def test_basic_csv_read(std_input_path, name, schema, options, read_func, v1_ena
assert_gpu_and_cpu_are_equal_collect(read_func(std_input_path + '/' + name, schema, spark_tmp_table_factory, options),
conf=updated_conf)

@pytest.mark.parametrize('name,schema,options', [
pytest.param('small_float_values.csv', _float_schema, {'header': 'true'}),
pytest.param('small_float_values.csv', _double_schema, {'header': 'true'}),
], ids=idfn)
@pytest.mark.parametrize('read_func', [read_csv_df, read_csv_sql])
@pytest.mark.parametrize('v1_enabled_list', ["", "csv"])
@pytest.mark.parametrize('ansi_enabled', ["true", "false"])
def test_csv_read_small_floats(std_input_path, name, schema, options, read_func, v1_enabled_list, ansi_enabled, spark_tmp_table_factory):
updated_conf=copy_and_update(_enable_all_types_conf, {
'spark.sql.sources.useV1SourceList': v1_enabled_list,
'spark.sql.ansi.enabled': ansi_enabled
})
assert_gpu_and_cpu_are_equal_collect(read_func(std_input_path + '/' + name, schema, spark_tmp_table_factory, options),
conf=updated_conf)

csv_supported_gens = [
# Spark does not escape '\r' or '\n' even though it uses it to mark end of record
# This would require multiLine reads to work correctly so we avoid these chars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ bad
3.4028236e+38
1.7976931348623157E308
1.7976931348623157e+308
1.7976931348623158E308
1.2e-234
21 changes: 21 additions & 0 deletions integration_tests/src/test/resources/small_float_values.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"number"
0.001
0.01
0.1
0.2
0.3
0.4
1.0
2.0
3.0
4.0
-0.001
-0.01
-0.1
-0.2
-0.3
-0.4
-1.0
-2.0
-3.0
-4.0