Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache kafka Kafka按记录字段连接接收器分区,记录字段为_Apache Kafka_Apache Kafka Connect_Confluent Platform_Azure Data Lake Gen2 - Fatal编程技术网

Apache kafka Kafka按记录字段连接接收器分区,记录字段为

Apache kafka Kafka按记录字段连接接收器分区,记录字段为,apache-kafka,apache-kafka-connect,confluent-platform,azure-data-lake-gen2,Apache Kafka,Apache Kafka Connect,Confluent Platform,Azure Data Lake Gen2,我有一个卡夫卡连接水槽。在我的主题中,有一个字段是用记号表示的,而不是正确的时间戳。我最终希望将其用作目标中的分区字段(在本例中为Azure data lake gen 2) 我已经尝试过使用TimeBasedPartitioner以及timestamp.extractor和timestampconvertor,但它只是在格式上出错了。从我看到的情况来看,所有这些时间戳转换器都使用“时间戳”字段,而我的字段是以记号表示的,因此在使用时间戳转换器之前,我必须进行额外的转换,但我不确定,因为我所研究

我有一个卡夫卡连接水槽。在我的主题中,有一个字段是用记号表示的,而不是正确的时间戳。我最终希望将其用作目标中的分区字段(在本例中为Azure data lake gen 2)

我已经尝试过使用TimeBasedPartitioner以及timestamp.extractor和timestampconvertor,但它只是在格式上出错了。从我看到的情况来看,所有这些时间戳转换器都使用“时间戳”字段,而我的字段是以记号表示的,因此在使用时间戳转换器之前,我必须进行额外的转换,但我不确定,因为我所研究的SMT如何不提供任何此类内容

我得到的错误

java.lang.IllegalArgumentException: Invalid format: "20204642-05-16 21:34:40.000+0000" is malformed at " 21:34:40.000+0000"
这就是我的接收器配置的外观

{
    "name": "azuredatalakegen2-sink-featuretracking-dl",
    "config": {
      "connector.class": "io.confluent.connect.azure.datalake.gen2.AzureDataLakeGen2SinkConnector",
      "topics": "sometopic",
      "topics.dir": "filesystem/folder",
      "flush.size": "1",
      "file.delim": "-",
      "path.format":"'year'=YYYY/'month'=MM/'day'=dd/'hour'=HH",
      "locale": "UTC",
      "timezone": "UTC",
      "partitioner.class": "io.confluent.connect.storage.partitioner.TimeBasedPartitioner",
      "partition.duration.ms": "300000",
      "timestamp.extractor": "RecordField",
      "timestamp.field": "event_date_time_ticks",
      "format.class":"io.confluent.connect.azure.storage.format.parquet.ParquetFormat",
      "transforms": "flatten,TimestampConverter",
      "transforms.flatten.type": "org.apache.kafka.connect.transforms.Flatten$Value",
      "transforms.flatten.delimiter": "_",
      "transforms.TimestampConverter.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value",
      "transforms.TimestampConverter.format": "yyyy-MM-dd HH:mm:ss.SSSZ",
      "transforms.TimestampConverter.field":"event_date_time_ticks",
      "transforms.TimestampConverter.target.type": "string",
      "max.retries": "288",
      "retry.backoff.ms": "300000",
      "errors.retry.timeout":"3600000",
      "errors.retry.delay.max.ms":"60000",
      "errors.log.enable":"true",
      "errors.log.include.messages":"true",
      "key.converter":"org.apache.kafka.connect.storage.StringConverter",
     "value.converter":"io.confluent.connect.protobuf.ProtobufConverter",
.......other conn related configs.......
    }
    }
以下是我所看到的SMT:

如何使用以下字段对目标中的数据进行分区:事件\日期\时间\以记号表示的记号,例如637535500015510000表示:2021-04-09​T07:26:41.551Z

勾选转换为日期时间:

即使我尝试FieldPartitioner,如何在上面的接收器配置中将该勾号转换为日期时间格式?或者我必须写一些定制的东西吗?

,而不是打勾

您需要对其进行转换,这必须是自定义转换或生产者中的修改(这不应该是一个大问题,因为大多数语言都有datetime历元函数)


我不明白你所说的节拍是什么意思,但是
yyyy-MM-dd HH:MM:ss.SSSZ
显然与
20204642
不匹配,除非你试图捕捉未来数百万年的日期。。。换句话说,听起来你的时间戳被关闭了一个数量级(纳米或毫秒而不是秒)是的,我想是的。现在,我使用timestamp.extactor来记录,以获得摄入卡夫卡的时间,这已经足够好了。对于未来的案例,我可能会像你说的那样,在生产者中有逻辑。