{"record":{"id":"e5295b4b02355f06","repo":"apache/flink","slug":"sql-time-type-expected","errorCode":null,"errorMessage":"SQL time type expected.","messagePattern":"SQL time type expected\\.","errorType":"exception","errorClass":"InvalidTypesException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java","lineNumber":1521,"sourceCode":"                if (!(type instanceof Class<?>)\n                        || (actual = BasicTypeInfo.getInfoFor((Class<?>) type)) == null) {\n                    throw new InvalidTypesException(\"Basic type expected.\");\n                }\n                // check if correct basic type\n                if (!typeInfo.equals(actual)) {\n                    throw new InvalidTypesException(\n                            \"Basic type '\" + typeInfo + \"' expected but was '\" + actual + \"'.\");\n                }\n\n            }\n            // check for Java SQL time types\n            else if (typeInfo instanceof SqlTimeTypeInfo) {\n\n                TypeInformation<?> actual;\n                // check if SQL time type at all\n                if (!(type instanceof Class<?>)\n                        || (actual = SqlTimeTypeInfo.getInfoFor((Class<?>) type)) == null) {\n                    throw new InvalidTypesException(\"SQL time type expected.\");\n                }\n                // check if correct SQL time type\n                if (!typeInfo.equals(actual)) {\n                    throw new InvalidTypesException(\n                            \"SQL time type '\" + typeInfo + \"' expected but was '\" + actual + \"'.\");\n                }\n\n            }\n            // check for Java Tuples\n            else if (typeInfo instanceof TupleTypeInfo) {\n                // check if tuple at all\n                if (!(isClassType(type) && Tuple.class.isAssignableFrom(typeToClass(type)))) {\n                    throw new InvalidTypesException(\"Tuple type expected.\");\n                }\n\n                // do not allow usage of Tuple as type\n                if (isClassType(type) && typeToClass(type).equals(Tuple.class)) {\n                    throw new InvalidTypesException(\"Concrete subclass of Tuple expected.\");","sourceCodeStart":1503,"sourceCodeEnd":1539,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L1503-L1539","documentation":"Thrown during input type validation when the TypeInformation is a SqlTimeTypeInfo (java.sql.Date, java.sql.Time, java.sql.Timestamp) but the reflected Type is not a recognized SQL time type. `SqlTimeTypeInfo.getInfoFor()` returns null for the class, indicating it is not one of the three supported SQL temporal types.","triggerScenarios":"A function or stream uses SqlTimeTypeInfo but the actual reflected type from the function signature is not java.sql.Date, java.sql.Time, or java.sql.Timestamp. For example, the function declares a Timestamp input but the stream carries java.util.Date or java.time.Instant.","commonSituations":"Mixing java.time (Instant, LocalDateTime) with java.sql types in a pipeline. Using java.util.Date where java.sql.Timestamp is expected. Connecting a connector that emits java.sql types to a function expecting java.time types.","solutions":["Ensure the function uses the correct java.sql temporal type (Date, Time, or Timestamp)","Convert java.time types to java.sql equivalents before the function: `java.sql.Timestamp.from(instant)`","If using java.time types, do not register SqlTimeTypeInfo — use a POJO or explicit TypeInformation instead"],"exampleFix":"// before — java.time vs java.sql mismatch\nDataStream<java.time.Instant> stream = ...;\nstream.map(new MapFunction<java.sql.Timestamp, X>() { ... });\n\n// after — convert or align\nstream.map(instant -> java.sql.Timestamp.from(instant))\n      .map(new MapFunction<java.sql.Timestamp, X>() { ... });","handlingStrategy":"validation","validationCode":"// Check if the reflected type is a valid SQL time type\nClass<?> inputClass = myFunctionInputClass; // obtained via reflection\nTypeInformation<?> sqlTimeInfo = SqlTimeTypeInfo.getInfoFor(inputClass);\nif (sqlTimeInfo == null) {\n    throw new IllegalArgumentException(\n        \"Type \" + inputClass.getName()\n        + \" is not a recognized SQL time type. \"\n        + \"Use java.sql.Date, java.sql.Time, or java.sql.Timestamp.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use java.sql.Date, java.sql.Time, or java.sql.Timestamp consistently for temporal types","Convert java.time types to java.sql equivalents at the boundary","Avoid mixing java.util.Date with java.sql temporal types in the same pipeline","Standardize on one temporal type framework throughout the pipeline"],"tags":["type-validation","sql-time","type-mismatch","reflection","temporal"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}