java.lang.IllegalArgumentException: Unsupported type ArrayType(StringType,false)

JIRA | Peter Rudenko | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Steps to reproduce: Follow [new spark ml api guide|http://spark.apache.org/docs/latest/ml-guide.html]: {code} val training = sparkContext.parallelize(Seq( LabeledDocument(0L, "a b c d e spark", 1.0), LabeledDocument(1L, "b d", 0.0), LabeledDocument(2L, "spark f g h", 1.0), LabeledDocument(3L, "hadoop mapreduce", 0.0))) // Configure an ML pipeline, which consists of three stages: tokenizer, hashingTF, and lr. val tokenizer = new Tokenizer() .setInputCol("text") .setOutputCol("words") val hashingTF = new HashingTF() .setNumFeatures(1000) .setInputCol(tokenizer.getOutputCol) .setOutputCol("features") val pipeline = new Pipeline().setStages(Array(tokenizer, hashingTF)) val model = pipeline.fit(training) val tranformed = model.transform(training) scala> transformed.schema res7: org.apache.spark.sql.StructType = StructType(ArrayBuffer(StructField(id,LongType,false), StructField(text,StringType,true), StructField(label,DoubleType,false), StructField(words,ArrayType(StringType,false),true), StructField(features,org.apache.spark.mllib.linalg.VectorUDT@5172cce4,true))) scala> toDataFrame(transformed) java.lang.IllegalArgumentException: Unsupported type ArrayType(StringType,false) at org.apache.spark.h2o.H2OContextUtils$.dataTypeToClass(H2OContextUtils.scala:175) at org.apache.spark.h2o.H2OContext$$anonfun$4.apply(H2OContext.scala:282) at org.apache.spark.h2o.H2OContext$$anonfun$4.apply(H2OContext.scala:282) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47) at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) val transformed2 = transformed.select('features) scala> transformed2.schema res4: org.apache.spark.sql.StructType = StructType(ArrayBuffer(StructField(features,org.apache.spark.mllib.linalg.VectorUDT@5172cce4,true))) scala> toDataFrame(transformed2) java.lang.IllegalArgumentException: Unsupported type org.apache.spark.mllib.linalg.VectorUDT@5172cce4 at org.apache.spark.h2o.H2OContextUtils$.dataTypeToClass(H2OContextUtils.scala:175) at org.apache.spark.h2o.H2OContext$$anonfun$4.apply(H2OContext.scala:282) at org.apache.spark.h2o.H2OContext$$anonfun$4.apply(H2OContext.scala:282) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47) {code}

    JIRA | 2 years ago | Peter Rudenko
    java.lang.IllegalArgumentException: Unsupported type ArrayType(StringType,false)
  2. 0

    Steps to reproduce: Follow [new spark ml api guide|http://spark.apache.org/docs/latest/ml-guide.html]: {code} val training = sparkContext.parallelize(Seq( LabeledDocument(0L, "a b c d e spark", 1.0), LabeledDocument(1L, "b d", 0.0), LabeledDocument(2L, "spark f g h", 1.0), LabeledDocument(3L, "hadoop mapreduce", 0.0))) // Configure an ML pipeline, which consists of three stages: tokenizer, hashingTF, and lr. val tokenizer = new Tokenizer() .setInputCol("text") .setOutputCol("words") val hashingTF = new HashingTF() .setNumFeatures(1000) .setInputCol(tokenizer.getOutputCol) .setOutputCol("features") val pipeline = new Pipeline().setStages(Array(tokenizer, hashingTF)) val model = pipeline.fit(training) val tranformed = model.transform(training) scala> transformed.schema res7: org.apache.spark.sql.StructType = StructType(ArrayBuffer(StructField(id,LongType,false), StructField(text,StringType,true), StructField(label,DoubleType,false), StructField(words,ArrayType(StringType,false),true), StructField(features,org.apache.spark.mllib.linalg.VectorUDT@5172cce4,true))) scala> toDataFrame(transformed) java.lang.IllegalArgumentException: Unsupported type ArrayType(StringType,false) at org.apache.spark.h2o.H2OContextUtils$.dataTypeToClass(H2OContextUtils.scala:175) at org.apache.spark.h2o.H2OContext$$anonfun$4.apply(H2OContext.scala:282) at org.apache.spark.h2o.H2OContext$$anonfun$4.apply(H2OContext.scala:282) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47) at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) val transformed2 = transformed.select('features) scala> transformed2.schema res4: org.apache.spark.sql.StructType = StructType(ArrayBuffer(StructField(features,org.apache.spark.mllib.linalg.VectorUDT@5172cce4,true))) scala> toDataFrame(transformed2) java.lang.IllegalArgumentException: Unsupported type org.apache.spark.mllib.linalg.VectorUDT@5172cce4 at org.apache.spark.h2o.H2OContextUtils$.dataTypeToClass(H2OContextUtils.scala:175) at org.apache.spark.h2o.H2OContext$$anonfun$4.apply(H2OContext.scala:282) at org.apache.spark.h2o.H2OContext$$anonfun$4.apply(H2OContext.scala:282) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47) {code}

    JIRA | 2 years ago | Peter Rudenko
    java.lang.IllegalArgumentException: Unsupported type ArrayType(StringType,false)

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Unsupported type ArrayType(StringType,false)

      at org.apache.spark.h2o.H2OContextUtils$.dataTypeToClass()
    2. org.apache.spark
      H2OContext$$anonfun$4.apply
      1. org.apache.spark.h2o.H2OContextUtils$.dataTypeToClass(H2OContextUtils.scala:175)
      2. org.apache.spark.h2o.H2OContext$$anonfun$4.apply(H2OContext.scala:282)
      3. org.apache.spark.h2o.H2OContext$$anonfun$4.apply(H2OContext.scala:282)
      3 frames
    3. Scala
      TraversableLike$class.map
      1. scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
      2. scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
      3. scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
      4. scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
      5. scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
      5 frames