twalthr commented on a change in pull request #18632:
URL: https://github.com/apache/flink/pull/18632#discussion_r810882308



##########
File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/ThreadLocalCache.java
##########
@@ -75,4 +76,13 @@ protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
             return this.size() > maxSize;
         }
     }
+
+    public static <K, V> ThreadLocalCache<K, V> of(Function<K, V> creator) {

Review comment:
       did you check the performance of this approach? It adds another virtual 
method call.

##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/StringToTimestampCastRule.java
##########
@@ -48,12 +51,24 @@ public String generateExpression(
             String inputTerm,
             LogicalType inputLogicalType,
             LogicalType targetLogicalType) {
+        int targetPrecision = 
LogicalTypeChecks.getPrecision(targetLogicalType);
         if (targetLogicalType.is(LogicalTypeRoot.TIMESTAMP_WITHOUT_TIME_ZONE)) 
{
-            return staticCall(STRING_DATA_TO_TIMESTAMP(), inputTerm);
+            final TimestampKind targetTimestampKind = ((TimestampType) 
targetLogicalType).getKind();
+            if (targetTimestampKind == TimestampKind.ROWTIME

Review comment:
       @matriv is right, you cannot cast to `PROCTIME/ROWTIME`, we should 
simplify the code here




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