org.apache.spark.SparkException: Job aborted due to stage failure: Task 3 in stage 0.0 failed 1 times, most recent failure: Lost task 3.0 in stage 0.0 (TID 3, localhost): java.lang.NumberFormatException: For input string: "http://foobar"

DataStax JIRA | Yana Kadiyska | 1 year ago
  1. 0

    {code}SPARK_CLASSPATH=jsr166e-1.1.0.jar:spark-cassandra-connector_2.10-1.3.0-M1.jar:guava-jdk5-14.0.1.jar:cassandra-driver-core-2.1.5.jar:cassandra-thrift-2.1.3.jar:joda-time-2.3.jar bin/spark-shell --conf spark.cassandra.connection.host=127.0.0.1 {code} create a cassandra table like this: {code} CREATE TABLE test1( customer_id int , uri text , browser text, epoch bigint , PRIMARY KEY (customer_id , epoch,uri) ) {code} In spark-shell: {code} case class Test(val epoch:Long,val uri:String,val browser:String,val customer_id:Int) val test1=Test(1400820884,"http://foobar","Firefox",123242) val df=sc.parallelize(Seq(test1)).toDF import org.apache.spark.sql._ df.save("org.apache.spark.sql.cassandra",SaveMode.Overwrite,options = Map( "c_table" -> "test1", "keyspace" -> "yana_test")) {code} The last call (df.save) produces the following error: {code} org.apache.spark.SparkException: Job aborted due to stage failure: Task 3 in stage 0.0 failed 1 times, most recent failure: Lost task 3.0 in stage 0.0 (TID 3, localhost): java.lang.NumberFormatException: For input string: "http://foobar" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Long.parseLong(Long.java:441) at java.lang.Long.parseLong(Long.java:483) at scala.collection.immutable.StringLike$class.toLong(StringLike.scala:230) at scala.collection.immutable.StringOps.toLong(StringOps.scala:31) at com.datastax.spark.connector.types.TypeConverter$LongConverter$$anonfun$convertPF$3.applyOrElse(TypeConverter.scala:188) at scala.PartialFunction$AndThen.applyOrElse(PartialFunction.scala:184) at com.datastax.spark.connector.types.TypeConverter$class.convert(TypeConverter.scala:38) at com.datastax.spark.connector.types.TypeConverter$JavaLongConverter$.com$datastax$spark$connector$types$NullableTypeConverter$$super$convert(TypeConverter.scala:196) at com.datastax.spark.connector.types.NullableTypeConverter$class.convert(TypeConverter.scala:51) at com.datastax.spark.connector.types.TypeConverter$JavaLongConverter$.convert(TypeConverter.scala:196) at com.datastax.spark.connector.types.TypeConverter$OptionToNullConverter$$anonfun$convertPF$23.applyOrElse(TypeConverter.scala:632) at com.datastax.spark.connector.types.TypeConverter$class.convert(TypeConverter.scala:38) at com.datastax.spark.connector.types.TypeConverter$OptionToNullConverter.com$datastax$spark$connector$types$NullableTypeConverter$$super$convert(TypeConverter.scala:625) at com.datastax.spark.connector.types.NullableTypeConverter$class.convert(TypeConverter.scala:51) at com.datastax.spark.connector.types.TypeConverter$OptionToNullConverter.convert(TypeConverter.scala:625) at com.datastax.spark.connector.writer.SqlRowWriter$$anonfun$readColumnValues$1.apply$mcVI$sp(SqlRowWriter.scala:21) at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:141) at com.datastax.spark.connector.writer.SqlRowWriter.readColumnValues(SqlRowWriter.scala:20) at com.datastax.spark.connector.writer.SqlRowWriter.readColumnValues(SqlRowWriter.scala:8) at com.datastax.spark.connector.writer.BoundStatementBuilder.bind(BoundStatementBuilder.scala:35) at com.datastax.spark.connector.writer.GroupingBatchBuilder.next(GroupingBatchBuilder.scala:106) at com.datastax.spark.connector.writer.GroupingBatchBuilder.next(GroupingBatchBuilder.scala:31) at scala.collection.Iterator$class.foreach(Iterator.scala:727) at com.datastax.spark.connector.writer.GroupingBatchBuilder.foreach(GroupingBatchBuilder.scala:31) at com.datastax.spark.connector.writer.TableWriter$$anonfun$write$1.apply(TableWriter.scala:135) at com.datastax.spark.connector.writer.TableWriter$$anonfun$write$1.apply(TableWriter.scala:119) at com.datastax.spark.connector.cql.CassandraConnector$$anonfun$withSessionDo$1.apply(CassandraConnector.scala:105) at com.datastax.spark.connector.cql.CassandraConnector$$anonfun$withSessionDo$1.apply(CassandraConnector.scala:104) at com.datastax.spark.connector.cql.CassandraConnector.closeResourceAfterUse(CassandraConnector.scala:156) at com.datastax.spark.connector.cql.CassandraConnector.withSessionDo(CassandraConnector.scala:104) at com.datastax.spark.connector.writer.TableWriter.write(TableWriter.scala:119) at com.datastax.spark.connector.RDDFunctions$$anonfun$saveToCassandra$1.apply(RDDFunctions.scala:36) at com.datastax.spark.connector.RDDFunctions$$anonfun$saveToCassandra$1.apply(RDDFunctions.scala:36) at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:61) at org.apache.spark.scheduler.Task.run(Task.scala:64) at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:203) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) {code}

    DataStax JIRA | 1 year ago | Yana Kadiyska
    org.apache.spark.SparkException: Job aborted due to stage failure: Task 3 in stage 0.0 failed 1 times, most recent failure: Lost task 3.0 in stage 0.0 (TID 3, localhost): java.lang.NumberFormatException: For input string: "http://foobar"
  2. 0

    {code}SPARK_CLASSPATH=jsr166e-1.1.0.jar:spark-cassandra-connector_2.10-1.3.0-M1.jar:guava-jdk5-14.0.1.jar:cassandra-driver-core-2.1.5.jar:cassandra-thrift-2.1.3.jar:joda-time-2.3.jar bin/spark-shell --conf spark.cassandra.connection.host=127.0.0.1 {code} create a cassandra table like this: {code} CREATE TABLE test1( customer_id int , uri text , browser text, epoch bigint , PRIMARY KEY (customer_id , epoch,uri) ) {code} In spark-shell: {code} case class Test(val epoch:Long,val uri:String,val browser:String,val customer_id:Int) val test1=Test(1400820884,"http://foobar","Firefox",123242) val df=sc.parallelize(Seq(test1)).toDF import org.apache.spark.sql._ df.save("org.apache.spark.sql.cassandra",SaveMode.Overwrite,options = Map( "c_table" -> "test1", "keyspace" -> "yana_test")) {code} The last call (df.save) produces the following error: {code} org.apache.spark.SparkException: Job aborted due to stage failure: Task 3 in stage 0.0 failed 1 times, most recent failure: Lost task 3.0 in stage 0.0 (TID 3, localhost): java.lang.NumberFormatException: For input string: "http://foobar" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Long.parseLong(Long.java:441) at java.lang.Long.parseLong(Long.java:483) at scala.collection.immutable.StringLike$class.toLong(StringLike.scala:230) at scala.collection.immutable.StringOps.toLong(StringOps.scala:31) at com.datastax.spark.connector.types.TypeConverter$LongConverter$$anonfun$convertPF$3.applyOrElse(TypeConverter.scala:188) at scala.PartialFunction$AndThen.applyOrElse(PartialFunction.scala:184) at com.datastax.spark.connector.types.TypeConverter$class.convert(TypeConverter.scala:38) at com.datastax.spark.connector.types.TypeConverter$JavaLongConverter$.com$datastax$spark$connector$types$NullableTypeConverter$$super$convert(TypeConverter.scala:196) at com.datastax.spark.connector.types.NullableTypeConverter$class.convert(TypeConverter.scala:51) at com.datastax.spark.connector.types.TypeConverter$JavaLongConverter$.convert(TypeConverter.scala:196) at com.datastax.spark.connector.types.TypeConverter$OptionToNullConverter$$anonfun$convertPF$23.applyOrElse(TypeConverter.scala:632) at com.datastax.spark.connector.types.TypeConverter$class.convert(TypeConverter.scala:38) at com.datastax.spark.connector.types.TypeConverter$OptionToNullConverter.com$datastax$spark$connector$types$NullableTypeConverter$$super$convert(TypeConverter.scala:625) at com.datastax.spark.connector.types.NullableTypeConverter$class.convert(TypeConverter.scala:51) at com.datastax.spark.connector.types.TypeConverter$OptionToNullConverter.convert(TypeConverter.scala:625) at com.datastax.spark.connector.writer.SqlRowWriter$$anonfun$readColumnValues$1.apply$mcVI$sp(SqlRowWriter.scala:21) at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:141) at com.datastax.spark.connector.writer.SqlRowWriter.readColumnValues(SqlRowWriter.scala:20) at com.datastax.spark.connector.writer.SqlRowWriter.readColumnValues(SqlRowWriter.scala:8) at com.datastax.spark.connector.writer.BoundStatementBuilder.bind(BoundStatementBuilder.scala:35) at com.datastax.spark.connector.writer.GroupingBatchBuilder.next(GroupingBatchBuilder.scala:106) at com.datastax.spark.connector.writer.GroupingBatchBuilder.next(GroupingBatchBuilder.scala:31) at scala.collection.Iterator$class.foreach(Iterator.scala:727) at com.datastax.spark.connector.writer.GroupingBatchBuilder.foreach(GroupingBatchBuilder.scala:31) at com.datastax.spark.connector.writer.TableWriter$$anonfun$write$1.apply(TableWriter.scala:135) at com.datastax.spark.connector.writer.TableWriter$$anonfun$write$1.apply(TableWriter.scala:119) at com.datastax.spark.connector.cql.CassandraConnector$$anonfun$withSessionDo$1.apply(CassandraConnector.scala:105) at com.datastax.spark.connector.cql.CassandraConnector$$anonfun$withSessionDo$1.apply(CassandraConnector.scala:104) at com.datastax.spark.connector.cql.CassandraConnector.closeResourceAfterUse(CassandraConnector.scala:156) at com.datastax.spark.connector.cql.CassandraConnector.withSessionDo(CassandraConnector.scala:104) at com.datastax.spark.connector.writer.TableWriter.write(TableWriter.scala:119) at com.datastax.spark.connector.RDDFunctions$$anonfun$saveToCassandra$1.apply(RDDFunctions.scala:36) at com.datastax.spark.connector.RDDFunctions$$anonfun$saveToCassandra$1.apply(RDDFunctions.scala:36) at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:61) at org.apache.spark.scheduler.Task.run(Task.scala:64) at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:203) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) {code}

    DataStax JIRA | 1 year ago | Yana Kadiyska
    org.apache.spark.SparkException: Job aborted due to stage failure: Task 3 in stage 0.0 failed 1 times, most recent failure: Lost task 3.0 in stage 0.0 (TID 3, localhost): java.lang.NumberFormatException: For input string: "http://foobar"
  3. 0

    Function take() error - Link Analysis Research using Spark Mllib

    Data Science | 3 months ago | João_testeSW
    org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 1 times, most recent failure: Lost task 0.0 in stage 0.0 (TID 0, localhost): java.lang.NumberFormatException: For input string: "id"
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Function take() error - Link Analysis Research using Spark Mllib

    Stack Overflow | 3 months ago | João_testeSW
    org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 1 times, most recent failure: Lost task 0.0 in stage 0.0 (TID 0, localhost): java.lang.NumberFormatException: For input string: "id"
  6. 0

    GitHub comment 184#166739266

    GitHub | 12 months ago | nealmcb
    org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 76.0 failed 1 times, most recent failure: Lost task 0.0 in stage 76.0 (TID 231, localhost): java.lang.NumberFormatException: For input string: "89959) 2002 NT7"
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.apache.spark.SparkException

    Job aborted due to stage failure: Task 3 in stage 0.0 failed 1 times, most recent failure: Lost task 3.0 in stage 0.0 (TID 3, localhost): java.lang.NumberFormatException: For input string: "http://foobar"

    at java.lang.NumberFormatException.forInputString()
  2. Java RT
    Long.parseLong
    1. java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    2. java.lang.Long.parseLong(Long.java:441)
    3. java.lang.Long.parseLong(Long.java:483)
    3 frames
  3. Scala
    StringOps.toLong
    1. scala.collection.immutable.StringLike$class.toLong(StringLike.scala:230)
    2. scala.collection.immutable.StringOps.toLong(StringOps.scala:31)
    2 frames
  4. spark-cassandra-connector
    TypeConverter$LongConverter$$anonfun$convertPF$3.applyOrElse
    1. com.datastax.spark.connector.types.TypeConverter$LongConverter$$anonfun$convertPF$3.applyOrElse(TypeConverter.scala:188)
    1 frame
  5. Scala
    PartialFunction$AndThen.applyOrElse
    1. scala.PartialFunction$AndThen.applyOrElse(PartialFunction.scala:184)
    1 frame
  6. spark-cassandra-connector
    SqlRowWriter$$anonfun$readColumnValues$1.apply$mcVI$sp
    1. com.datastax.spark.connector.types.TypeConverter$class.convert(TypeConverter.scala:38)
    2. com.datastax.spark.connector.types.TypeConverter$JavaLongConverter$.com$datastax$spark$connector$types$NullableTypeConverter$$super$convert(TypeConverter.scala:196)
    3. com.datastax.spark.connector.types.NullableTypeConverter$class.convert(TypeConverter.scala:51)
    4. com.datastax.spark.connector.types.TypeConverter$JavaLongConverter$.convert(TypeConverter.scala:196)
    5. com.datastax.spark.connector.types.TypeConverter$OptionToNullConverter$$anonfun$convertPF$23.applyOrElse(TypeConverter.scala:632)
    6. com.datastax.spark.connector.types.TypeConverter$class.convert(TypeConverter.scala:38)
    7. com.datastax.spark.connector.types.TypeConverter$OptionToNullConverter.com$datastax$spark$connector$types$NullableTypeConverter$$super$convert(TypeConverter.scala:625)
    8. com.datastax.spark.connector.types.NullableTypeConverter$class.convert(TypeConverter.scala:51)
    9. com.datastax.spark.connector.types.TypeConverter$OptionToNullConverter.convert(TypeConverter.scala:625)
    10. com.datastax.spark.connector.writer.SqlRowWriter$$anonfun$readColumnValues$1.apply$mcVI$sp(SqlRowWriter.scala:21)
    10 frames
  7. Scala
    Range.foreach$mVc$sp
    1. scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:141)
    1 frame
  8. spark-cassandra-connector
    GroupingBatchBuilder.next
    1. com.datastax.spark.connector.writer.SqlRowWriter.readColumnValues(SqlRowWriter.scala:20)
    2. com.datastax.spark.connector.writer.SqlRowWriter.readColumnValues(SqlRowWriter.scala:8)
    3. com.datastax.spark.connector.writer.BoundStatementBuilder.bind(BoundStatementBuilder.scala:35)
    4. com.datastax.spark.connector.writer.GroupingBatchBuilder.next(GroupingBatchBuilder.scala:106)
    5. com.datastax.spark.connector.writer.GroupingBatchBuilder.next(GroupingBatchBuilder.scala:31)
    5 frames
  9. Scala
    Iterator$class.foreach
    1. scala.collection.Iterator$class.foreach(Iterator.scala:727)
    1 frame
  10. spark-cassandra-connector
    RDDFunctions$$anonfun$saveToCassandra$1.apply
    1. com.datastax.spark.connector.writer.GroupingBatchBuilder.foreach(GroupingBatchBuilder.scala:31)
    2. com.datastax.spark.connector.writer.TableWriter$$anonfun$write$1.apply(TableWriter.scala:135)
    3. com.datastax.spark.connector.writer.TableWriter$$anonfun$write$1.apply(TableWriter.scala:119)
    4. com.datastax.spark.connector.cql.CassandraConnector$$anonfun$withSessionDo$1.apply(CassandraConnector.scala:105)
    5. com.datastax.spark.connector.cql.CassandraConnector$$anonfun$withSessionDo$1.apply(CassandraConnector.scala:104)
    6. com.datastax.spark.connector.cql.CassandraConnector.closeResourceAfterUse(CassandraConnector.scala:156)
    7. com.datastax.spark.connector.cql.CassandraConnector.withSessionDo(CassandraConnector.scala:104)
    8. com.datastax.spark.connector.writer.TableWriter.write(TableWriter.scala:119)
    9. com.datastax.spark.connector.RDDFunctions$$anonfun$saveToCassandra$1.apply(RDDFunctions.scala:36)
    10. com.datastax.spark.connector.RDDFunctions$$anonfun$saveToCassandra$1.apply(RDDFunctions.scala:36)
    10 frames
  11. Spark
    Executor$TaskRunner.run
    1. org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:61)
    2. org.apache.spark.scheduler.Task.run(Task.scala:64)
    3. org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:203)
    3 frames
  12. Java RT
    Thread.run
    1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    3. java.lang.Thread.run(Thread.java:745)
    3 frames