-
Notifications
You must be signed in to change notification settings - Fork 20
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
SNOW-1183003 Support Geometry Type #88
Merged
Merged
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1dd28b0
tmp
sfc-gh-bli bfecf3e
add scala feature
sfc-gh-bli f6e8a3b
add java type
sfc-gh-bli 74e06ef
add test
sfc-gh-bli e1f3348
add test
sfc-gh-bli fe67e22
add new error code
sfc-gh-bli eb2550e
add row functions
sfc-gh-bli a12e3ec
add geometry to string
sfc-gh-bli 93c9dcc
add test
sfc-gh-bli e4d2c00
add test
sfc-gh-bli dd2c1f9
reformat
sfc-gh-bli ebb1825
add row
sfc-gh-bli 881a425
reformat
sfc-gh-bli a6d266f
reformat
sfc-gh-bli 9934af0
fix test
sfc-gh-bli 8d3626d
Merge branch 'main' into snow-1183003
sfc-gh-bli 261cc3b
disable package tests
sfc-gh-bli 8242c17
Merge branch 'main' into snow-1183003
sfc-gh-bli 273ac57
reformat
sfc-gh-bli 8958725
disable package test
sfc-gh-bli 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
70 changes: 70 additions & 0 deletions
70
src/main/java/com/snowflake/snowpark_java/types/Geometry.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,70 @@ | ||
package com.snowflake.snowpark_java.types; | ||
|
||
import java.io.IOException; | ||
import java.io.Serializable; | ||
import java.io.UncheckedIOException; | ||
|
||
/** | ||
* Java representation of Snowflake Geometry data. | ||
* | ||
* @since 1.12.0 | ||
*/ | ||
public class Geometry implements Serializable { | ||
private final String data; | ||
|
||
private Geometry(String data) { | ||
if (data == null) { | ||
throw new UncheckedIOException( | ||
new IOException("Cannot create geometry object from null input")); | ||
} | ||
this.data = data; | ||
} | ||
|
||
/** | ||
* Checks whether two Geometry object are equal. | ||
* | ||
* @param other A Geometry object | ||
* @return true if these two object are equal | ||
* @since 1.12.0 | ||
*/ | ||
@Override | ||
public boolean equals(Object other) { | ||
if (other instanceof Geometry) { | ||
return data.equals(((Geometry) other).data); | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Calculates the hash code of this Geometry Object. | ||
* | ||
* @return An int number representing the hash code value | ||
* @since 1.12.0 | ||
*/ | ||
@Override | ||
public int hashCode() { | ||
return this.data.hashCode(); | ||
} | ||
|
||
/** | ||
* Converts this Geometry object to a String value. | ||
* | ||
* @return A String value. | ||
* @since 1.12.0 | ||
*/ | ||
@Override | ||
public String toString() { | ||
return this.data; | ||
} | ||
|
||
/** | ||
* Creates a Geometry object from a GeoJSON string. | ||
* | ||
* @param g GeoJSON String | ||
* @return a new Geometry object | ||
* @since 1.12.0 | ||
*/ | ||
public static Geometry fromGeoJSON(String g) { | ||
return new Geometry(g); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/snowflake/snowpark_java/types/GeometryType.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,10 @@ | ||
package com.snowflake.snowpark_java.types; | ||
|
||
/** | ||
* Geography data type. This maps to GEOMETRY data type in Snowflake. | ||
* | ||
* @since 1.12.0 | ||
*/ | ||
public class GeometryType extends AtomicType { | ||
GeometryType() {} | ||
} |
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
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.
reformat