xiangfu0 commented on code in PR #18872:
URL: https://github.com/apache/pinot/pull/18872#discussion_r3669800008
##########
pinot-common/src/main/java/org/apache/pinot/common/function/FunctionUtils.java:
##########
@@ -184,6 +189,8 @@ public static RelDataType getRelDataType(RelDataTypeFactory
typeFactory, Class<?
case STRING:
case JSON:
return typeFactory.createSqlType(SqlTypeName.VARCHAR);
+ case UUID:
Review Comment:
Done — moved below `BYTES`. (`UUID_ARRAY` was already below `BYTES_ARRAY`,
so this makes the SV case consistent with it.)
##########
pinot-common/src/test/java/org/apache/pinot/common/request/context/RequestContextUtilsTest.java:
##########
@@ -0,0 +1,104 @@
+/**
+ * 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.pinot.common.request.context;
+
+import java.util.List;
+import java.util.Locale;
+import org.apache.pinot.common.request.context.predicate.EqPredicate;
+import org.apache.pinot.common.request.context.predicate.InPredicate;
+import org.apache.pinot.sql.parsers.CalciteSqlParser;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+/**
Review Comment:
Done — converted the new javadoc in `RequestContextUtilsTest` and
`UuidDictionaryPredicateEvaluatorTest` to `///` markdown.
##########
pinot-common/src/test/java/org/apache/pinot/common/request/context/RequestContextUtilsTest.java:
##########
@@ -0,0 +1,104 @@
+/**
+ * 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.pinot.common.request.context;
+
+import java.util.List;
+import java.util.Locale;
+import org.apache.pinot.common.request.context.predicate.EqPredicate;
+import org.apache.pinot.common.request.context.predicate.InPredicate;
+import org.apache.pinot.sql.parsers.CalciteSqlParser;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests filter conversion for UUID literals on the right-hand side of a
predicate.
+ *
+ * <p>{@code CAST(<literal> AS UUID)} is folded to a plain literal by {@code
CompileTimeFunctionsInvoker}, one of the
+ * query rewriters, so the predicate ends up carrying the canonical UUID
string that the UUID predicate evaluators
+ * can parse. These tests deliberately go through the full {@link
CalciteSqlParser#compileToPinotQuery} path rather
+ * than {@code compileToExpression}, because the folding only happens once the
rewriter chain has run — asserting
+ * against the un-rewritten expression would test a shape the server never
actually receives.
+ */
+public class RequestContextUtilsTest {
+ private static final String UUID_1 = "550e8400-e29b-41d4-a716-446655440000";
+ private static final String UUID_2 = "550e8400-e29b-41d4-a716-446655440001";
+
+ private static FilterContext compileFilter(String whereClause) {
+ return RequestContextUtils.getFilter(
+ CalciteSqlParser.compileToPinotQuery("SELECT * FROM mytable WHERE " +
whereClause).getFilterExpression());
+ }
+
+ @Test
+ public void testGetFilterWithUuidCastLiteralRhs() {
+ FilterContext filter = compileFilter("uuidCol = CAST('" + UUID_1 + "' AS
UUID)");
+
+ Assert.assertEquals(filter.getType(), FilterContext.Type.PREDICATE);
+ EqPredicate predicate = (EqPredicate) filter.getPredicate();
+ Assert.assertEquals(predicate.getLhs().getIdentifier(), "uuidCol");
Review Comment:
Done for the two new test classes (`RequestContextUtilsTest`,
`UuidDictionaryPredicateEvaluatorTest`), and for the lines I added to
`CaseTransformFunctionTest` / `CastTransformFunctionTest`, which already use
static imports.
I left the lines I added to `NoDictionaryEqualsPredicateEvaluatorsTest` /
`NoDictionaryInPredicateEvaluatorTest` /
`NoDictionaryRangePredicateEvaluatorTest` as `Assert.assertX` — those files
have no static imports at all and use the qualified form throughout, so
converting only my lines would leave them mixed. Happy to convert those files
wholesale in a follow-up if you would prefer them switched.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]