-
Notifications
You must be signed in to change notification settings - Fork 915
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
This fixes an NPE when trying to read empty JSON data by adding a new API for missing information #15307
Conversation
… API for missing information Signed-off-by: Robert (Bobby) Evans <[email protected]>
private static final byte[] EMPTY_JSON_DATA_BUFFER = ("{}\n").getBytes(StandardCharsets.UTF_8); | ||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
private static final byte[] EMPTY_JSON_DATA_BUFFER = ("{}\n").getBytes(StandardCharsets.UTF_8); | |
@Test | |
private static final byte[] EMPTY_JSON_DATA_BUFFER = ("{}\n").getBytes(StandardCharsets.UTF_8); | |
@Test |
private static final byte[] EMPTY_ARRAY_JSON_DATA_BUFFER = | ||
("{'a':[]}\n").getBytes(StandardCharsets.UTF_8); | ||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final byte[] EMPTY_ARRAY_JSON_DATA_BUFFER = | |
("{'a':[]}\n").getBytes(StandardCharsets.UTF_8); | |
@Test | |
private static final byte[] EMPTY_ARRAY_JSON_DATA_BUFFER = | |
("{'a':[]}\n").getBytes(StandardCharsets.UTF_8); | |
@Test |
* @param buffer raw UTF8 formatted bytes. | ||
* @param offset the starting offset into buffer. | ||
* @param len the number of bytes to parse. | ||
* @param emptyRowCount the number of rows to use if no columns were found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if there might be a better name for this. Under the circumstances, emptyRowCount
is really the best name for this parameter.
/merge |
Description
CUDF cannot create a table with rows and no columns, but that is exactly what we need to be able to read some JSON input. So this adds in a new API that lets us work around this problem if we know how many rows you expect to see. This is not an ideal solutions so it not a fix for #5712 generically. But is is a stop gap, especially for cases when we know how many rows to expect.
Checklist