Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which versions of Spark does this work with? #9

Open
bitdivine opened this issue May 13, 2018 · 0 comments
Open

Which versions of Spark does this work with? #9

bitdivine opened this issue May 13, 2018 · 0 comments

Comments

@bitdivine
Copy link

Thank you for what looks like some useful code. However, what does it need to run? I tried your sample code with spark 2.2 and 1.6 and both failed:

    $ spark-shell-2.2 --packages com.github.master:spark-stemming_2.10:0.2.0
...
scala> val sqlContext = spark.sqlContext
sqlContext: org.apache.spark.sql.SQLContext = org.apache.spark.sql.SQLContext@7aeb5402

scala> {
     | import org.apache.spark.mllib.feature.Stemmer
     |
     | val data = sqlContext
     |   .createDataFrame(Seq(("мама", 1), ("мыла", 2), ("раму", 3)))
     |   .toDF("word", "id")
     |
     | val stemmed = new Stemmer()
     |   .setInputCol("word")
     |   .setOutputCol("stemmed")
     |   .setLanguage("Russian")
     |   .transform(data)
     |
     | stemmed.show
     | }
java.lang.IllegalArgumentException: requirement failed: Input type must be ArrayType(StringType) but got StringType.
  at scala.Predef$.require(Predef.scala:224)
  at org.apache.spark.mllib.feature.Stemmer.validateInputType(Stemmer.scala:31)
  at org.apache.spark.ml.UnaryTransformer.transformSchema(Transformer.scala:110)
  at org.apache.spark.ml.PipelineStage.transformSchema(Pipeline.scala:74)
  at org.apache.spark.ml.UnaryTransformer.transform(Transformer.scala:120)
  ... 62 elided

scala>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant