mchades commented on code in PR #10982: URL: https://github.com/apache/gravitino/pull/10982#discussion_r3205931600
########## common/src/main/java/org/apache/gravitino/dto/rel/ViewDTO.java: ########## @@ -0,0 +1,260 @@ +/* + * 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.gravitino.dto.rel; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.Preconditions; +import java.util.Collections; +import java.util.Map; +import javax.annotation.Nullable; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.apache.gravitino.dto.AuditDTO; +import org.apache.gravitino.rel.Column; +import org.apache.gravitino.rel.Representation; +import org.apache.gravitino.rel.View; + +/** Represents a View DTO (Data Transfer Object). */ +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +@ToString +public class ViewDTO implements View { + + @JsonProperty("name") + private String name; + + @JsonProperty("comment") + @Nullable + private String comment; + + @JsonProperty("columns") + private ColumnDTO[] columns; + + @JsonProperty("representations") + private RepresentationDTO[] representations; + + @JsonProperty("defaultCatalog") + @Nullable + private String defaultCatalog; + + @JsonProperty("defaultSchema") + @Nullable + private String defaultSchema; + + @JsonProperty("properties") + @Nullable + private Map<String, String> properties; + + @JsonProperty("audit") + private AuditDTO audit; + + private ViewDTO() {} + + private ViewDTO( + String name, + @Nullable String comment, + ColumnDTO[] columns, + RepresentationDTO[] representations, + @Nullable String defaultCatalog, + @Nullable String defaultSchema, + @Nullable Map<String, String> properties, + AuditDTO audit) { + this.name = name; + this.comment = comment; + this.columns = columns; + this.representations = representations; + this.defaultCatalog = defaultCatalog; + this.defaultSchema = defaultSchema; + this.properties = properties; + this.audit = audit; + } + + @Override + public String name() { + return name; + } + + @Override + public String comment() { + return comment; + } + + @Override + public Column[] columns() { + return columns; + } + + @Override + public Representation[] representations() { + return representations; + } Review Comment: Fixed in commit 1a0b49fa0. ViewDTO#columns() now returns an empty array when the backing field is null. I also made representations() null-safe for consistency. -- 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]
