Uh oh!
There was an error while loading. Please reload this page.
API: Add view interfaces - #4925
Conversation
jzhuge
commented
Jun 1, 2022
Split from #4567 |
nastra
commented
Jun 1, 2022
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Looks good to me, thanks @jzhuge for the contribution! @jackye1995@nastra let us know if you have any further comments.
jzhuge
commented
Jun 20, 2022
Thanks @amogh-jahagirdar. BTW, I am also ok if we decide to remove |
jackye1995
commented
Jun 20, 2022
@rdblue do you have any additional comment for adding these view APIs? |
Uh oh!
There was an error while loading. Please reload this page.
If no more comment, is it possible to get it merged so that I can use it in the Core PR? |
jzhuge
commented
Jul 19, 2022
Hi @danielcweeks, could you please take a look and merge if it looks ok? |
jzhuge
commented
Aug 15, 2022
Hi @danielcweeks, have you got a chance to take a look? |
Uh oh!
There was an error while loading. Please reload this page.
| long timestampMillis(); | ||
| /** | ||
| * Returns the version summary such as the name and genie-id of the operation that created that version of the view |
There was a problem hiding this comment.
You might want to remove references to genie.
danielcweeks
commented
Aug 15, 2022
@jzhuge or @anjalinorwood I feel like I'm missing something in terms of where we actually access the view content / text? I would think that would live in |
amogh-jahagirdar
commented
Aug 21, 2022
@danielcweeks I'll let @jzhuge@anjalinorwood confirm but the model at least in my mind is that there is an implementation of ViewRepresentation; for the SQL view representation, this would be SqlViewRepresentation which would expose a sql() method for surfacing the literal text. Down the line there would be other view representation types such as for substrait which would expose the view representation in their own way (serialized plan node for example). |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jzhuge
commented
Aug 30, 2022
Merged Amogh's PR, rebased, and applied spotless. |
Uh oh!
There was an error while loading. Please reload this page.
65b7b6e to
e3de593Compare| String dialect(); | ||
| /** The default catalog when the view is created. */ | ||
| String defaultCatalog(); |
There was a problem hiding this comment.
this is a getter. wondering why default...? should it just be catalog()?
There was a problem hiding this comment.
In a Spark/Presto SQL session, you can run USE to set default catalog and namespace, thus the "default".
Uh oh!
There was an error while loading. Please reload this page.
jzhuge
commented
Nov 7, 2022
Created #6134 to add the missing field |
wmoustafa
commented
Nov 7, 2022
Can one replace the current version or an old version by adding a new dialect? Does it result in a new version? |
Uh oh!
There was an error while loading. Please reload this page.
| * @param query view query | ||
| * @return this for method chaining | ||
| */ | ||
| ViewBuilder withQuery(String query); |
There was a problem hiding this comment.
My original question was that this builder returns a View, and in this discussion, you mentioned that withQuery() is the method responsible for the fact that it should return SQLViewRepresentation. However, I think this method still does not enforce it in this iteration.
| /** The view query SQL text. */ | ||
| String query(); |
There was a problem hiding this comment.
Why would not this method be also common with other representations?
There was a problem hiding this comment.
This is the SQL text of the view. Other view representations don't necessarily have a SQL query. I think this is reasonable.
| /** The view query SQL dialect. */ | ||
| String dialect(); |
There was a problem hiding this comment.
I feel this needs to be an Enum and somehow be merged with Type. @rdblue, @danielcweeks, @amogh-jahagirdar, thoughts? Further, it is better for the spec to take a position on supported dialects, or not take a position at all, but in this case SQL should not be a special type. Right now the position sounds a bit fuzzy.
There was a problem hiding this comment.
I disagree that we want to define supported dialects. We don't want engine writers to need to come to the Iceberg community and get a new symbol in an enum before storing a view. I don't see much benefit to doing that.
There was a problem hiding this comment.
I think it is fine to do either: not take a position at all or take a well defined position. There could be a few scenarios where the intended meaning is not achieved. For example:
- One defines the view SQL using a non-SQL string (e.g., some other DSL), and still leverages
SQLViewReperesentationfor that. Even if this is permitted, it is not clear from the spec if it is okay. - The dialect could be the same but not standardized, e.g., dialects such as
spark,Spark,SparkSQL,Spark SQL.
There was a problem hiding this comment.
Maybe what we need is an API to add supported dialects to the metadata? It is up to each catalog implementation to add their dialects, and view definitions can be associated with a dialect ID.
There was a problem hiding this comment.
Maybe what we need is an API to add supported dialects to the metadata? It is up to each catalog implementation to add their dialects, and view definitions can be associated with a dialect ID.
Already added
/** * Add a SQL {@link View} for a different dialect. * * @param sqlViewRepresentation a SQL view representation * @return this for method chaining * @throws IllegalArgumentException if the dialect is the same as the SQL view being built */ViewBuilderwithOtherSQLRepresentation(SQLViewRepresentationsqlViewRepresentation);There was a problem hiding this comment.
I was referring to making dialects (not just view representations) a construct in the metadata where people can define and add them, e.g., some catalogs define SparkSQL, id = 1 and TrinoSQL, id = 2, and each view representation references a standardized dialect ID. They are not part of the Iceberg spec, but defining and adding them dynamically is.
There was a problem hiding this comment.
One defines the view SQL using a non-SQL string
I don't think this is allowed. If you create a SQL view then it should contain SQL. In any case, being strict about dialects doesn't help prevent this.
The dialect could be the same but not standardized
This is a risk, but I think it isn't very likely. We should document the known dialect strings, but we shouldn't switch it to be an enum.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jzhuge
commented
Nov 8, 2022
Not supported. To add a new dialect, |
wmoustafa
commented
Nov 8, 2022
|
jzhuge
commented
Nov 8, 2022
|
rdblue
commented
Nov 27, 2022
@jzhuge, this looks good to go. Can you rebase and fix tests? |
Co-authored-by: anjalinorwood@gmail.com Co-authored-by: jahamogh@amazon.com Co-authored-by: blue@apache.org
jzhuge
commented
Dec 2, 2022
@rdblue Please merge. |
rdblue
commented
Dec 5, 2022
Merge! Let me know where the implementation PR is and I'll start looking at that! |
Co-authored-by: anjalinorwood@gmail.com Co-authored-by: jahamogh@amazon.com (cherry picked from commit b2f4694)
Co-authored-by: anjalinorwood@gmail.com