forked from facebookincubator/velox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call commitNull in SimpleFunctionAdapter on exceptions (facebookincub…
…ator#10377) Summary: Pull Request resolved: facebookincubator#10377 The way the VectorWriters work today, if its writing a variable length type and it is not committed (e.g. because an exception was thrown) when the next value is written it will start with the state of the previous value rather than a clean slate. This can result in e.g. strings starting with the contents that were written for the previous string. SimpleFunctionAdapter tried to compensate for this by making a local copy of the top level VectorWriter and only copying back into the original if processing the current row succeeds. This does nothing for nested writers (it also wasn't implemented for Strings). To fix this, I've added an optional lambda to applyToSelectedNoThrow that gets invoked when an exception is caught. We can use this to call commitNull on the writer which should reset the state of all writers (top level and nested). Note that if we're catching exceptions and not throwing anything we must be in a try so committing null is safe and reasonable to do. This shouldn't impact the performance of the path without exceptions (I ran the ArrayWriterBenchmark to confirm this). I also do not need to make this change in the fast path as the fast path is only invoked if the output type is primitive and fixed width, and in this there is no state other than the value in the Vector so failing to commit does not cause issues. This combined with facebookincubator#10376 addresses the issue identified in facebookincubator#10162 Reviewed By: mbasmanova Differential Revision: D59292285 fbshipit-source-id: 00c000626bb12451b7c95c24460eb62816532403
- Loading branch information
1 parent
a033968
commit decd91e
Showing
8 changed files
with
175 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters