You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/11/01 02:56:29 UTC

[GitHub] [iceberg] amogh-jahagirdar commented on a diff in pull request #4925: API: Add view interfaces

amogh-jahagirdar commented on code in PR #4925:
URL: https://github.com/apache/iceberg/pull/4925#discussion_r1010029138


##########
api/src/main/java/org/apache/iceberg/view/ViewBuilder.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.iceberg.view;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.iceberg.Schema;
+import org.apache.iceberg.catalog.ViewCatalog;
+
+/**
+ * A builder used to create or replace a SQL {@link View}.
+ *
+ * <p>Call {@link ViewCatalog#buildView} to create a new builder.
+ */
+public interface ViewBuilder {
+  /**
+   * Set the view schema.
+   *
+   * @param schema view schema
+   * @return this for method chaining
+   */
+  ViewBuilder withSchema(Schema schema);
+
+  /**
+   * Set the view query.
+   *
+   * @param query view query
+   * @return this for method chaining
+   */
+  ViewBuilder withQuery(String query);
+
+  /**
+   * Set the view SQL dialect.
+   *
+   * @param dialect view SQL dialect
+   * @return this for method chaining
+   */
+  ViewBuilder withDialect(String dialect);
+
+  /**
+   * Set the view default catalog.
+   *
+   * @param defaultCatalog view default catalog
+   * @return this for method chaining
+   */
+  ViewBuilder withDefaultCatalog(String defaultCatalog);
+
+  /**
+   * Set the view default namespaces.
+   *
+   * @param defaultNamespaces view default namespaces
+   * @return this for method chaining
+   */
+  ViewBuilder withDefaultNamespace(List<String> defaultNamespaces);
+
+  /**
+   * Set the view field aliases.
+   *
+   * @param fieldAliases view field aliases
+   * @return this for method chaining
+   */
+  ViewBuilder withFieldAliases(List<String> fieldAliases);
+
+  /**
+   * Set the view field comments.
+   *
+   * @param fieldComments view field comments
+   * @return this for method chaining
+   */
+  ViewBuilder withFieldComments(List<String> fieldComments);
+
+  /**
+   * Add key/value properties to the view.
+   *
+   * @param properties key/value properties
+   * @return this for method chaining
+   */
+  ViewBuilder withProperties(Map<String, String> properties);
+
+  /**
+   * Add a key/value property to the view.
+   *
+   * @param key a key
+   * @param value a value
+   * @return this for method chaining
+   */
+  ViewBuilder withProperty(String key, String value);
+
+  /**
+   * Set a location for the view.
+   *
+   * @param location a location
+   * @return this for method chaining
+   */
+  ViewBuilder withLocation(String location);
+
+  /**
+   * Add a SQL {@link View} for a different dialect.
+   *
+   * <p>If its dialect is the same as the SQL view being built, {@link IllegalArgumentException}
+   * will be thrown when creating or replacing the view.
+   *
+   * @param sqlViewRepresentation a SQL view representation
+   * @return this for method chaining
+   */
+  ViewBuilder withOtherSQLView(SQLViewRepresentation sqlViewRepresentation);

Review Comment:
   Nit: I think this should be called  `withOtherSQLRepresentation` to differentiate that it's another representation and not a "View" in our terms.  



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org