-
Notifications
You must be signed in to change notification settings - Fork 125
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
Enforce globally unique table locations #67
Closed
eric-maynard
wants to merge
21
commits into
apache:main
from
eric-maynard:enforce-globally-unique-table-location
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d7a6acc
initial commit
eric-maynard bdc92c5
semi-stable
eric-maynard ce5b0fd
add check
eric-maynard 97a1700
wip
eric-maynard 5c656a3
start implementing test
eric-maynard 9919f80
progress on test
eric-maynard 279bb64
entity locations are null
eric-maynard daae37b
check in
eric-maynard 834696a
try fixing loation routing
eric-maynard 3d24bd8
getting close
eric-maynard def7330
stable
eric-maynard 88f9cfb
ENFORCE_TABLE_LOCATIONS_INSIDE_NAMESPACE_LOCATIONS; stable
eric-maynard 2230a93
stable
eric-maynard 3103f91
fix an existing test
eric-maynard 092cffa
debugging
eric-maynard a95bcde
Merge branch 'main' of github.com:polaris-catalog/polaris into enforc…
eric-maynard e91d45e
progress on refactor
eric-maynard 797d467
pause for now
eric-maynard e8e7fe2
push location check into PolarisBaseEntity
eric-maynard 38eb126
somewhat optimize query
eric-maynard 2d3e886
harden query
eric-maynard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
56 changes: 56 additions & 0 deletions
56
polaris-core/src/main/java/io/polaris/core/PolarisUtils.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) 2024 Snowflake Computing Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.polaris.core; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** A collection of utilities for polaris-core */ | ||
public class PolarisUtils { | ||
|
||
/** Given some path, append a `/` if it doesn't already end with one */ | ||
public static String terminateWithSlash(String path) { | ||
if (path == null) { | ||
return null; | ||
} else if (!path.endsWith("/")) { | ||
return path + "/"; | ||
} else { | ||
return path; | ||
} | ||
} | ||
|
||
/** | ||
* Given a path like `/a/b/c`, find all directories in the path such as [`/`, `/a/`, `/a/b/`, | ||
* `/a/b/c`] | ||
*/ | ||
public static Optional<List<String>> pathToDirectories(String path, int maxSegments) { | ||
List<String> directories = new ArrayList<>(); | ||
String[] splitPath = path.split("/", -1); | ||
|
||
if (splitPath.length - 2 > maxSegments) { | ||
return Optional.empty(); | ||
} else { | ||
StringBuilder currentPath = new StringBuilder(); | ||
for (int i = 0; i < splitPath.length - 1; i++) { | ||
currentPath.append(splitPath[i]).append("/"); | ||
directories.add(currentPath.toString()); | ||
} | ||
// Chop off the protocol: | ||
return Optional.of(directories.subList(1, directories.size())); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we not do a
location IN (:directory_list)
query? I think EclipseLink must support lists as parameters.