执行sql:
select create_time from call_log
where create_time > ‘2023-01-01’
limit 100
报错:Error operating EXECUTE_STATEMENT: com.pingcap.tikv.exception.TypeException: Error parsing string 2020-06-01 to datetime
at com.pingcap.tikv.types.Converter.convertToDateTime(Converter.java:248)
at com.pingcap.tikv.types.AbstractDateTimeType.encodeKey(AbstractDateTimeType.java:103)
at com.pingcap.tikv.types.DataType.encodeKey(DataType.java:424)
at com.pingcap.tikv.key.TypedKey.encodeKey(TypedKey.java:68)
at com.pingcap.tikv.key.TypedKey.(TypedKey.java:36)
at com.pingcap.tikv.key.TypedKey.toTypedKey(TypedKey.java:59)
at com.pingcap.tikv.expression.ComparisonBinaryExpression$NormalizedPredicate.getTypedLiteral(ComparisonBinaryExpression.java:203)
at com.pingcap.tikv.expression.visitor.PrunedPartitionBuilder.visit(PrunedPartitionBuilder.java:71)
at com.pingcap.tikv.expression.visitor.PrunedPartitionBuilder.visit(PrunedPartitionBuilder.java:35)
at com.pingcap.tikv.expression.ComparisonBinaryExpression.accept(ComparisonBinaryExpression.java:81)
at com.pingcap.tikv.expression.visitor.RangeSetBuilder.buildRange(RangeSetBuilder.java:137)
你好,TiSpark 目前对读取 RANGE COLUMNS 表支持还不够完善
你可以在这里 https://github.com/pingcap/tispark/issues 提一个你使用 RANGE COLUMNS 时遇到的问题。后续解决我们可以在这个 issue 讨论。
另外针对你的问题,在修复之前,你可以暂时使用 RANGE 分区。如下
CREATE TABLE `test`.`range` ( `id` INT ( 11 ) NOT NULL, `ct` datetime NULL DEFAULT NULL ) PARTITION BY RANGE (to_days(ct)) (
PARTITION `p0`
VALUES
LESS THAN (to_days('2020-01-01'))
)