NobiGo commented on code in PR #3928:
URL: https://github.com/apache/calcite/pull/3928#discussion_r1726633645


##########
core/src/test/resources/sql/dummy.iq:
##########
@@ -15,9 +15,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-!use post
-values 1;
+!use scott

Review Comment:
   This example is for review.



##########
core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystemImpl.java:
##########
@@ -255,8 +268,72 @@ && getDefaultPrecision(typeName) != -1) {
     return argumentType;
   }
 
-  @Override public RelDataType deriveCovarType(RelDataTypeFactory typeFactory,
+  @Override public RelDataType deriveCovarType(RelDataTypeFactory typeFactory, 
SqlKind sqlKind,
       RelDataType arg0Type, RelDataType arg1Type) {
+    switch (sqlKind) {

Review Comment:
   I'm not sure if this is a reasonable implementation, but from the test 
cases, it seems feasible.



##########
core/src/test/resources/sql/agg.iq:
##########
@@ -2981,16 +2981,41 @@ group by MONTH(HIREDATE);
 |     1 |                       |               |  1201250.0000 |
 |    11 |                       |               |               |
 |    12 |                       |               |  1510833.3333 |
-|     2 |           -35000.0000 |    10000.0000 |   831458.3333 |
 |     4 |                       |               |               |
 |     5 |                       |               |               |
 |     6 |                       |               |               |
-|     9 |          -175000.0000 |   490000.0000 |    31250.0000 |
+|     2 |    -35000.00000000000 |    10000.0000 |   831458.3333 |
+|     9 |    -175000.0000000000 |   490000.0000 |    31250.0000 |
 +-------+-----------------------+---------------+---------------+
 (8 rows)
 
 !ok
 
+# [CALCITE-4924] REGR_SXX and similar aggregate functions return the wrong 
data type
+SELECT
+  MONTH(HIREDATE) as "MONTH",
+  covar_samp(SAL, COMM) as "COVAR_SAMP(SAL, COMM)",

Review Comment:
   Compared to the previous one, this test can remove the cast.



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

Reply via email to