diff --git a/python/cudf/cudf/io/json.py b/python/cudf/cudf/io/json.py index b2f3fd09146..5ef25a99590 100644 --- a/python/cudf/cudf/io/json.py +++ b/python/cudf/cudf/io/json.py @@ -38,25 +38,6 @@ def read_json( f"or a bool, or None. Got {type(dtype)}" ) - if engine == "cudf_experimental": - raise ValueError( - "engine='cudf_experimental' support has been removed, " - "use `engine='cudf'`" - ) - - if engine == "cudf_legacy": - # TODO: Deprecated in 23.02, please - # give some time until(more than couple of - # releases from now) `cudf_legacy` - # support can be removed completely. - warnings.warn( - "engine='cudf_legacy' is a deprecated engine." - "This will be removed in a future release." - "Please switch to using engine='cudf'.", - FutureWarning, - ) - if engine == "cudf_legacy" and not lines: - raise ValueError(f"{engine} engine only supports JSON Lines format") if engine == "auto": engine = "cudf" if lines else "pandas" if engine != "cudf" and keep_quotes: @@ -64,7 +45,7 @@ def read_json( "keep_quotes='True' is supported only with engine='cudf'" ) - if engine == "cudf_legacy" or engine == "cudf": + if engine == "cudf": if dtype is None: dtype = True @@ -117,7 +98,7 @@ def read_json( lines, compression, byte_range, - engine == "cudf_legacy", + False, keep_quotes, mixed_types_as_string, ) diff --git a/python/cudf/cudf/tests/test_json.py b/python/cudf/cudf/tests/test_json.py index 40935733f34..3033a3e75e3 100644 --- a/python/cudf/cudf/tests/test_json.py +++ b/python/cudf/cudf/tests/test_json.py @@ -495,9 +495,6 @@ def test_json_lines_compression(tmpdir, ext, out_comp, in_comp): @pytest.mark.filterwarnings("ignore:Using CPU") -@pytest.mark.filterwarnings( - "ignore:engine='cudf_legacy' is a deprecated engine." -) def test_json_engine_selection(): json = "[1, 2, 3]" @@ -519,10 +516,6 @@ def test_json_engine_selection(): for col_name in df.columns: assert isinstance(col_name, int) - # should raise an exception - with pytest.raises(ValueError): - cudf.read_json(StringIO(json), lines=False, engine="cudf_legacy") - def test_json_bool_values(): buffer = "[true,1]\n[false,false]\n[true,true]" @@ -541,30 +534,6 @@ def test_json_bool_values(): np.testing.assert_array_equal(pd_df.dtypes, cu_df.dtypes) -@pytest.mark.filterwarnings( - "ignore:engine='cudf_legacy' is a deprecated engine." -) -@pytest.mark.parametrize( - "buffer", - [ - "[1.0,]\n[null, ]", - '{"0":1.0,"1":}\n{"0":null,"1": }', - '{ "0" : 1.0 , "1" : }\n{ "0" : null , "1" : }', - '{"0":1.0}\n{"1":}', - ], -) -def test_json_null_literal(buffer): - df = cudf.read_json(StringIO(buffer), lines=True, engine="cudf_legacy") - - # first column contains a null field, type should be set to float - # second column contains only empty fields, type should be set to int8 - np.testing.assert_array_equal(df.dtypes, ["float64", "int8"]) - np.testing.assert_array_equal( - df["0"].to_numpy(na_value=np.nan), [1.0, np.nan] - ) - np.testing.assert_array_equal(df["1"].to_numpy(na_value=0), [0, 0]) - - def test_json_bad_protocol_string(): test_string = StringIO('{"field": "s3://path"}') @@ -739,14 +708,8 @@ def test_default_integer_bitwidth(default_integer_bitwidth, engine): @pytest.mark.parametrize( "engine", [ - pytest.param( - "cudf_legacy", - marks=pytest.mark.skip( - reason="cannot partially set dtypes for cudf json engine" - ), - ), - "pandas", "cudf", + "pandas", ], ) def test_default_integer_bitwidth_partial(default_integer_bitwidth, engine): diff --git a/python/cudf/cudf/utils/ioutils.py b/python/cudf/cudf/utils/ioutils.py index 0a0ee4f592c..8c58f2b859e 100644 --- a/python/cudf/cudf/utils/ioutils.py +++ b/python/cudf/cudf/utils/ioutils.py @@ -543,7 +543,7 @@ function or `StringIO`). Multiple inputs may be provided as a list. If a list is specified each list entry may be of a different input type as long as each input is of a valid type and all input JSON schema(s) match. -engine : {{ 'auto', 'cudf', 'cudf_legacy', 'pandas' }}, default 'auto' +engine : {{ 'auto', 'cudf', 'pandas' }}, default 'auto' Parser engine to use. If 'auto' is passed, the engine will be automatically selected based on the other parameters. See notes below. orient : string