jerryshao commented on code in PR #12499: URL: https://github.com/apache/gravitino/pull/12499#discussion_r3829709368
########## api/src/main/java/org/apache/gravitino/semantic/DataType.java: ########## @@ -0,0 +1,55 @@ +/* + * 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.semantic; + +import org.apache.gravitino.annotation.Evolving; + +/** Logical data types for Semantic Model fields and metrics. */ +@Evolving +public enum DataType { + /** A string value. */ + STRING, + + /** An integer value. */ + INTEGER, + + /** An exact base-10 decimal value with unspecified precision and scale. */ + DECIMAL, Review Comment: **Design/reuse: new flat enum drops precision/scale for DECIMAL, duplicating the existing type system** `DataType` is a flat enum (`STRING`, `INTEGER`, `DECIMAL`, `FLOAT`, ...) used by `Field.datatype()`/`Metric.datatype()`, but Gravitino already has `org.apache.gravitino.rel.types.Type`/`Types`, which models this exact domain including `DecimalType(precision, scale)`. This new `DECIMAL` constant has no precision/scale, so a semantic-model decimal field can't express it, and every catalog/connector will need to maintain a second type-mapping table between `Type` and this new `DataType`. Worth confirming this is an intentional simplification (semantic fields are business-level, not physical columns) rather than an oversight — if precision/scale matters for consumers (e.g. BI tools), consider reusing `rel.types.Type` instead. ########## api/src/main/java/org/apache/gravitino/Catalog.java: ########## @@ -255,6 +256,14 @@ default ViewCatalog asViewCatalog() throws UnsupportedOperationException { throw new UnsupportedOperationException("Catalog does not support view operations"); } + /** + * @return the {@link SemanticModelCatalog} for Semantic Model operations. + * @throws UnsupportedOperationException if the catalog does not expose Semantic Model operations. Review Comment: **Convention: javadoc/message wording diverges from sibling `asXxxCatalog()` methods** Every sibling default method (`asTableCatalog`, `asFilesetCatalog`, `asTopicCatalog`, `asModelCatalog`, `asFunctionCatalog`, `asViewCatalog`) uses the consistent phrasing "if the catalog supports X operations" / throws "Catalog does not support X operations". This method's javadoc instead says "for Semantic Model operations" / "@throws ... if the catalog does not **expose** Semantic Model operations" — and that `@throws` text doesn't even match the actual thrown message a few lines below ("does not **support** Semantic Model operations"). Suggest aligning the javadoc wording with the sibling pattern 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]
