robinyqiu commented on a change in pull request #12174:
URL: https://github.com/apache/beam/pull/12174#discussion_r454526705



##########
File path: 
sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/translation/ExpressionConverter.java
##########
@@ -808,9 +808,11 @@ private RexNode convertSimpleValueToRexNode(TypeKind kind, 
Value value) {
                     value.getStringValue(), 
typeFactory().createSqlType(SqlTypeName.VARCHAR), true);
         break;
       case TYPE_NUMERIC:
-        // As ZetaSQL NUMERIC literal would be unparsed as DOUBLE through 
Calcite makeExactLiteral
-        // method, we design a function call specifically associate with 
ZetaSQL NUMERIC literal
-        // unparsing
+        // Cannot simply call makeExactLiteral() for ZetaSQL NUMERICE type 
because later it will be

Review comment:
       Typo here `NUMERIC`

##########
File path: 
sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSqlTypesUtils.java
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.beam.sdk.extensions.sql.zetasql;
+
+import java.math.BigDecimal;
+import org.apache.beam.sdk.annotations.Internal;
+
+/** Utils to deal with ZetaSQL type generation. */
+@Internal
+public class ZetaSqlTypesUtils {
+
+  private ZetaSqlTypesUtils() {}
+
+  /**
+   * Creating a ZetaSQL NUMERIC value, which is java.math.BigDecimal with 
scale 9, from a string.

Review comment:
       I hope the comment to include some information that people cannot get 
from reading the function. For example, ZetaSQL NUMERIC type definition. How 
about we add:
   
   Create a ZetaSQL NUMERIC value represented as BigDecimal.
   
   ZetaSQL NUMERIC type is an exact numeric value with 38 digits of precision 
and 9 decimal digits of scale. Precision is the number of digits that the 
number contains. Scale is how many of these digits appear after the decimal 
point.




----------------------------------------------------------------
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.

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


Reply via email to