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

Add a config to switch back to old impl for getJsonObject #10654

Merged

Conversation

thirtiseven
Copy link
Collaborator

This PR adds a config to switch back to the old impl for getJsonObject.

#10581 used the new jni kernel for getJsonObject. It works correctly, but has worse performance than the old impl from cuDF, so in some cases users may want to switch back to the old impl to avoid performance loss.

Signed-off-by: Haoyang Li <haoyangl@nvidia.com>
@thirtiseven thirtiseven changed the title Add an config to switch back to old impl for getJsonObject Add a config to switch back to old impl for getJsonObject Apr 2, 2024
@thirtiseven thirtiseven changed the base branch from branch-24.04 to branch-24.06 April 2, 2024 07:17
@thirtiseven thirtiseven marked this pull request as ready for review April 2, 2024 07:18
@thirtiseven thirtiseven self-assigned this Apr 2, 2024
…ject.scala

Co-authored-by: Gera Shegalov <gshegalov@nvidia.com>
@sameerz sameerz added the bug Something isn't working label Apr 7, 2024
@sameerz
Copy link
Collaborator

sameerz commented Apr 7, 2024

Is this something we can do in 24.04?
cc: @GaryShen2008

@thirtiseven thirtiseven changed the base branch from branch-24.06 to branch-24.04 April 8, 2024 01:36
@thirtiseven
Copy link
Collaborator Author

Is this something we can do in 24.04? cc: @GaryShen2008

Retargeted to 24.04.

@GaryShen2008
Copy link
Collaborator

build

revans2
revans2 previously approved these changes Apr 9, 2024
Copy link
Collaborator

@revans2 revans2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comments are mostly nits. I am okay with this going in as is, but it would be nice to fix them.

@@ -902,6 +902,15 @@ val GPU_COREDUMP_PIPE_PATTERN = conf("spark.rapids.gpu.coreDump.pipePattern")
.booleanConf
.createWithDefault(true)

val ENABLE_GETJSONOBJECT_LEGACY = conf("spark.rapids.sql.getjsonobject.legacy.enabled")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Generally we use camelCase in the names of operations like this.

spark.rapids.sql.getJsonObject.legacy.enabled

But this is very minor, especially with it being an internal config.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

'spark.rapids.sql.getjsonobject.legacy.enabled': 'true'})

# Verify that the legacy mode is used and xfail the test which currently passes
@pytest.mark.xfail(reason="https://github.com/NVIDIA/spark-rapids/issues/10218")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we marking a test as xfail using an issue that has been closed? Can we please have an issue that is filed to remove the legacy support instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I filed #10680 as follow-up and remove this xfail.

conf={'spark.sql.parser.escapedStringLiterals': 'true',
'spark.rapids.sql.getjsonobject.legacy.enabled': 'true'})

# Verify that the legacy mode is used and xfail the test which currently passes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this test does verify that legacy mode is used. I see that it sets it, but there is no verification especially with an xfail, where if we did verify it, then it would not matter because the test is expected to fail very generically.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it failed does not mean it was using legacy mode. Updated this test to check if getJsonObject does the normalization to see if it returns the strings as-is.

Signed-off-by: Haoyang Li <haoyangl@nvidia.com>
Signed-off-by: Haoyang Li <haoyangl@nvidia.com>
@@ -99,7 +103,8 @@ def test_get_json_object_spark_unit_tests(query):
['{"big": "' + ('x' * 3000) + '"}']]
assert_gpu_and_cpu_are_equal_collect(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we not verifying that this falls back to the CPU as expected instead? If we have to divide the test up so we know exactly which once fall back and which ones do not I am fine with that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch thanks, none of them are fallback now, I forgot to delete it.

Signed-off-by: Haoyang Li <haoyangl@nvidia.com>
@thirtiseven
Copy link
Collaborator Author

build

@thirtiseven thirtiseven merged commit f6054fa into NVIDIA:branch-24.04 Apr 11, 2024
43 checks passed
@thirtiseven thirtiseven deleted the get-json-object-cudf-option branch April 11, 2024 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants