页面树结构

版本比较

标识

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

异常产生的原因:目标字段的长度和精度不足以容纳源字段

解决方法:将目标字段的长度和精度提高,或者降低源字段的长度与精度

示例1:源是timestamp,目标是date:

Image Removed(本文仅供参考)

问题描述:

ETL中写入数据到Clickhouse抛出 Code: 27. DB::ParsingException: Cannot parse input

问题原因:

目标字段的长度和精度不足以容纳源字段

解决办法:

将目标字段的长度和精度提高,或者降低源字段的长度与精度

示例说明1:

源是timestamp,目标是date:

Image Added


代码块
Caused by: ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: 10.10.110.33, port: 31824; Code: 27. DB::ParsingException: Cannot parse input: expected '\n' before: ' 17:47:36\n':

...

 Row 1: Column 0,

...

 

...

name: c1, type: Nullable(Date), parsed text: "2024-02-20" ERROR: garbage after Nullable(Date): " 17:47:36<LINE FEED>" 

...

: While executing ParallelParsingBlockInputFormat: (at row 1) . (CANNOT_PARSE_INPUT_ASSERTION_FAILED) (version 22.8.9.24 (official build))

...



........

...



Caused by: java.lang.Throwable: Code: 27. DB::ParsingException: Cannot parse input: expected '\n' before: ' 17:47:36\n':

...


规避方案:

规避:创建目标表的时候选择高精度的字段类型创建目标表的时候选择高精度的字段类型

示例说明2:

...

源是带有小数的,目标是整数:

代码块
Caused by: smartbix.datamining.engine.execute.exception.ExecuteException: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 4315.0 failed 1 times, most recent failure: Lost task 0.0 in stage 4315.0 (TID 3600) (smartbi-engine-experiment-v11 executor driver): ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: 10.10.110.33, port: 31824; Code: 27. DB::ParsingException: Cannot parse input: expected '\n' before: '.11111\n':

...

 Row 1: Column 0,

...

 name: c1, type: Nullable(Int32), parsed text: "1111" ERROR: garbage after Nullable(Int32): ".11111<LINE FEED>"

...

 : While executing ParallelParsingBlockInputFormat: (at row 1) . (CANNOT_PARSE_INPUT_ASSERTION_FAILED)

...



......

...




Caused by: java.lang.Throwable: Code: 27. DB::ParsingException: Cannot parse input: expected '\n' before: '.11111\n':

...


规避方案:


建表使用更高精度的浮点数
Image Modified