cloud-fan commented on code in PR #38823:
URL: https://github.com/apache/spark/pull/38823#discussion_r1043086633
##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TableProvider.java:
##########
@@ -93,4 +93,18 @@ default Transform[]
inferPartitioning(CaseInsensitiveStringMap options) {
default boolean supportsExternalMetadata() {
return false;
}
+
+ /**
+ * Returns true if the source supports defining generated columns upon table
creation in SQL.
+ * When false: any create/replace table statements with a generated column
defined in the table
+ * schema will throw an exception during analysis.
+ *
+ * A generated column is defined with syntax: {@code colName colType
GENERATED ALWAYS AS (expr)}
+ * The generation expression is stored in the column metadata with key
"generationExpression".
+ *
+ * Override this method to allow defining generated columns in
create/replace table statements.
+ */
+ default boolean supportsGeneratedColumnsOnCreation() {
Review Comment:
Then I think it's `TableCatalog`'s responsibility to decide if a table
supports generated column or not.
1. For general catalogs like HMS, it may need to resolve the table provider
name to `TableProvider`. Then it makes sense to add a new API to
`TableProvider`.
2. For dedicated catalogs like JDBC catalog, it doesn't even have table
provider. It depends on the remote SQL database and `TableCatalog` needs a new
API to indicate it.
How about we add the new API to both `TableCatalog` and `TableProvider`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]