You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++] Slash character in partition value handling #33448
Weston Pace / @westonpace:
Today we URI unescape fields as we read them. For this to work I think we need to URI escape fields as we write them which it does not appear we are doing.
If we go for option2, the users won't be able to handle such situation. But we could suggest them to do it in a different way. But it would require them to encode and decode the URIs. If this is billions of raws, and that would be really expensive.
Weston Pace / @westonpace:
I think we should encode and decode the URIs for the user. In fact, we already decode URIs. I don't expect the encoding to be too expensive.
So here the context is that, the partition column data is being used to formulate the save directory path. When there is a '/' in data, this value get implicitly considered as a separator when we form the directory path. Thus A/Z makes a A folder and Z inside it. Not sure we can remove that part or ask the code to ignore it.
But, in the reading part, when we recreate the fragments, we could decide whether to consider it as a path or just as a single value. If we consider it as a path (which is being done at the moment), we would get the erroneous output, but if we say don't consider it as a path, but as a non-path, we could retrieve the value accurately.
This is one viable option. If we do that, we can provide a lamda or flag to determine this behavior.
I think a function to determine the key decoding from the file path would be better.
Is this overly complicated or a non-generic solution?
Although I am inclined towards option 1 and not option 2. Option 2 is pretty straightforward to do, but a case as mentioned above could be very common.
How is the URL encoding/decoding part relevant here? Am I missing something?
Weston Pace / @westonpace:
On writing, we encode each component. If there is a / in the data, it should turn into %2F and so A/Z makes A%2FZ and the file would be stored at A%2FZ/chunk-0.parquet. On reading, we decode each component. So if we read A%2FZ then that turns into the string A/Z.
There is no configuration from the user required and so I think it is simpler.
Vibhatha Lakmal Abeykoon / @vibhatha:
Nice idea, although when we are reading, how do we know if this is encoded field or not? Just imagine the original key was A%2FZ and even if we detected encoded data, if it was the original data in the dataset, how do we know whether to decode or not? Or we just do encode decode no matter what. Is it a wise thing to do considering the performance?
Activity
asfimport commentedon Nov 7, 2022
Weston Pace / @westonpace:
Today we URI unescape fields as we read them. For this to work I think we need to URI escape fields as we write them which it does not appear we are doing.
asfimport commentedon Nov 8, 2022
Vadym Dytyniak:
@westonpace Can I wait for a fix?
asfimport commentedon Nov 8, 2022
Weston Pace / @westonpace:
I'm not personally working on this at the moment but it seems pretty straightforward if someone wants to pick it up.
asfimport commentedon Nov 11, 2022
Vibhatha Lakmal Abeykoon / @vibhatha:
[~dytyniak]Imagine the following situationIf we go for option2, the users won't be able to handle such situation. But we could suggest them to do it in a different way. But it would require them to encode and decode the URIs. If this is billions of raws, and that would be really expensive.
WDYT?
cc @westonpace
asfimport commentedon Nov 11, 2022
Weston Pace / @westonpace:
I think we should encode and decode the URIs for the user. In fact, we already decode URIs. I don't expect the encoding to be too expensive.
asfimport commentedon Nov 11, 2022
Vibhatha Lakmal Abeykoon / @vibhatha:
@westonpace
So here the context is that, the partition column data is being used to formulate the save directory path. When there is a '/' in data, this value get implicitly considered as a separator when we form the directory path. Thus
A/Zmakes aAfolder andZinside it. Not sure we can remove that part or ask the code to ignore it.But, in the reading part, when we recreate the fragments, we could decide whether to consider it as a path or just as a single value. If we consider it as a path (which is being done at the moment), we would get the erroneous output, but if we say don't consider it as a path, but as a non-path, we could retrieve the value accurately.
This is one viable option. If we do that, we can provide a lamda or flag to determine this behavior.
I think a function to determine the key decoding from the file path would be better.
Is this overly complicated or a non-generic solution?
Although I am inclined towards option 1 and not option 2. Option 2 is pretty straightforward to do, but a case as mentioned above could be very common.
How is the URL encoding/decoding part relevant here? Am I missing something?
Could you please clarify a bit?
asfimport commentedon Nov 14, 2022
Weston Pace / @westonpace:
On writing, we encode each component. If there is a
/in the data, it should turn into%2Fand soA/ZmakesA%2FZand the file would be stored atA%2FZ/chunk-0.parquet. On reading, we decode each component. So if we readA%2FZthen that turns into the stringA/Z.There is no configuration from the user required and so I think it is simpler.
asfimport commentedon Nov 15, 2022
Vibhatha Lakmal Abeykoon / @vibhatha:
Nice idea, although when we are reading, how do we know if this is encoded field or not? Just imagine the original key was
A%2FZand even if we detected encoded data, if it was the original data in the dataset, how do we know whether to decode or not? Or we just do encode decode no matter what. Is it a wise thing to do considering the performance?asfimport commentedon Dec 5, 2022
Antoine Pitrou / @pitrou:
Issue resolved by pull request 14646
#14646