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

PUBDEV-7841 don't overwrite existing frame when data loaded again fro… #5064

Merged
merged 1 commit into from
Oct 27, 2020

Conversation

satai
Copy link
Contributor

@satai satai commented Oct 22, 2020

@satai satai self-assigned this Oct 22, 2020
h2o-core/src/main/java/water/Key.java Outdated Show resolved Hide resolved
h2o-core/src/main/java/water/Key.java Outdated Show resolved Hide resolved
@satai satai force-pushed the ondra/PUBDEV-7841 branch 2 times, most recently from dbf09a2 to 1b000cd Compare October 22, 2020 11:15
Objects.requireNonNull(postfix);

final String s = prefix + "_" + rand() + (postfix.isEmpty() ? "" : ("_" + postfix));
final String withoutWhitechars = s.replaceAll("\\W", "_");
Copy link
Contributor

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");
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@satai satai force-pushed the ondra/PUBDEV-7841 branch 3 times, most recently from 8705b31 to 2355dba Compare October 26, 2020 11:47
@Pscheidl Pscheidl self-requested a review October 26, 2020 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants