{"record":{"id":"f2f295863a77e773","repo":"apache/seatunnel","slug":"the-time-column-type-time-is-out-of-range-f2f295","errorCode":null,"errorMessage":"The time column {} type time({}) is out of range, which exceeds the maximum scale of {}, it will be converted to time({})","messagePattern":"The time column (.+?) type time\\((.+?)\\) is out of range, which exceeds the maximum scale of (.+?), it will be converted to time\\((.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/phoenix/PhoenixTypeConverter.java","lineNumber":289,"sourceCode":"                    builder.columnType(String.format(\"%s\", PHOENIX_VARCHAR));\n                } else if (column.getColumnLength() <= Integer.MAX_VALUE) {\n                    builder.columnType(\n                            String.format(\"%s(%s)\", PHOENIX_VARCHAR, column.getColumnLength()));\n                } else if (column.getColumnLength() > Integer.MAX_VALUE) {\n                    builder.columnType(String.format(\"%s(%s)\", PHOENIX_VARCHAR, Integer.MAX_VALUE));\n                }\n\n                builder.dataType(PHOENIX_VARCHAR);\n                break;\n            case DATE:\n                builder.columnType(PHOENIX_DATE);\n                builder.dataType(PHOENIX_DATE);\n                break;\n            case TIME:\n                Integer timeScale = column.getScale();\n                if (timeScale != null && timeScale > MAX_TIME_SCALE) {\n                    timeScale = MAX_TIME_SCALE;\n                    log.warn(\n                            \"The time column {} type time({}) is out of range, \"\n                                    + \"which exceeds the maximum scale of {}, \"\n                                    + \"it will be converted to time({})\",\n                            column.getName(),\n                            column.getScale(),\n                            MAX_SCALE,\n                            timeScale);\n                }\n                if (timeScale != null && timeScale > 0) {\n                    builder.columnType(String.format(\"%s(%s)\", PHOENIX_TIME, timeScale));\n                } else {\n                    builder.columnType(PHOENIX_TIME);\n                }\n                builder.dataType(PHOENIX_TIME);\n                builder.scale(timeScale);\n                break;\n            case TIMESTAMP:\n                Integer timestampScale = column.getScale();","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/phoenix/PhoenixTypeConverter.java#L271-L307","documentation":"When converting a TIME column to the Phoenix type, a scale (fractional-second precision) larger than Phoenix's maximum time scale (MAX_TIME_SCALE) cannot be mapped. The converter logs this warning and clamps the time scale to MAX_TIME_SCALE, so sub-second precision beyond that limit is dropped. Note the final log argument mistakenly prints MAX_SCALE, but the applied scale is MAX_TIME_SCALE.","triggerScenarios":"PhoenixTypeConverter.reconvert() on a CatalogColumn of type TIME with a non-null scale greater than MAX_TIME_SCALE (e.g. TIME(9) from a source supporting nanoseconds).","commonSituations":"Sources with micro/nanosecond time precision (e.g. certain RDBMS TIME(6)/TIME(9)) being written to Phoenix, which supports fewer fractional digits.","solutions":["Reduce the time column scale at the source/catalog to <= MAX_TIME_SCALE.","CAST the column upstream (e.g. CAST(t AS TIME(3))) before writing to Phoenix.","Confirm the truncated precision is acceptable for your data based on the warning.","If full fractional precision is required, sink to a store supporting higher time precision."],"exampleFix":"// before\ncatalogColumn = CatalogColumn.of(\"event_time\", TimeType(9));\n// after\ncatalogColumn = CatalogColumn.of(\"event_time\", TimeType(3));","handlingStrategy":"validation","validationCode":"Integer scale = col.getScale();\nif (col.getDataType() instanceof TimeType && scale != null && scale > maxTimeScale) {\n    col = CatalogColumn.of(col.getName(), new TimeType(maxTimeScale), col.isNullable(), col.getDefaultValue());\n}","typeGuard":"boolean fitsPhoenixTimeScale(CatalogColumn c) {\n    Integer s = c.getScale();\n    return !(c.getDataType() instanceof TimeType) || s == null || s <= 3;\n}","tryCatchPattern":null,"preventionTips":["Cast TIME columns to TIME(3) or smaller before Phoenix sink","Check Phoenix's supported fractional-second precision during schema design","Avoid nanosecond time columns for Phoenix targets"],"tags":["jdbc","phoenix","time","scale","type-conversion"],"backgroundTag":"value-out-of-range","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}