语法书写错误报错:查了半天最后发现这句写错了,盯着挨个对才发现冒号写成了逗号,改好即可
pyspark.sql.utils.IllegalArgumentException: Expected e.g. {"topicA":{"0":23,"1":-1},"topicB":{"0":-2}}, got {"aaa":{"0":10,"1":700,"2",700}}
分区数目不对,偏移量不对报错:更改分区数目,偏移量位置即可,或者将failOnDataLoss设置为False,此时程序结果会出现但依然会报错
java.lang.IllegalStateException: Cannot fetch offset 1 (GroupId: spark-kafka-relation-928e8f8b-5271-4295-a3e2-7eeb7965940f-executor, TopicPartition: aaa-0).
Some data may have been lost because they are not available in Kafka any more; either the
data was aged out by Kafka or the topic may have been deleted before all the data in the
topic was processed. If you don't want your streaming query to fail on such cases, set the
source option "failOnDataLoss" to "false".
批量读取时
py4j.protocol.Py4JJavaError: An error occurred while calling o45.showString.
: java.lang.AssertionError: assertion failed: If startingOffsets contains specific offsets, you must specify all TopicPartitions.
分区数目必须写全,否则会出现这个错误