-
Notifications
You must be signed in to change notification settings - Fork 2k
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
PUBDEV-7841 don't overwrite existing frame when data loaded again fro… #5064
Conversation
dbf09a2
to
1b000cd
Compare
Objects.requireNonNull(postfix); | ||
|
||
final String s = prefix + "_" + rand() + (postfix.isEmpty() ? "" : ("_" + postfix)); | ||
final String withoutWhitechars = s.replaceAll("\\W", "_"); |
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.
This behavior doesn't belong in this class (changes requested).
@@ -46,7 +46,7 @@ | |||
final Boolean useTempTable, final String tempTableName, | |||
final SqlFetchMode fetchMode, final Integer numChunksHint) { | |||
|
|||
final Key<Frame> destination_key = Key.make((table + "_sql_to_hex").replaceAll("\\W", "_")); | |||
final Key<Frame> destination_key = Key.makeRandom(table, "sql_to_hex"); |
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.
Instead of using a partially randomized key, I think it is cleaner to follow a similar pattern as we use for naming models - just use an increasing sequence of numbers for a suffix, see H2O#calcNextUniqueModelId for inspiration.
it could be even very simple, something like
private static AtomicLong nextTableNum = new AtomicLong(0);
...
final Key<Frame> destination_key = Key.make((table.replaceAll("\\W", "_") + "_sql_to_hex_" + nextTableNum.addAndGet(1)));
The advantage definitely is that it is clear in what order the keys were created - which could be useful in debugging.
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.
OK, you can have a look.
8705b31
to
2355dba
Compare
2355dba
to
2195290
Compare
https://h2oai.atlassian.net/browse/PUBDEV-7841