You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Grzegorz Chilkiewicz (JIRA)" <ji...@apache.org> on 2016/11/02 12:53:58 UTC

[jira] [Created] (SPARK-18226) SparkR displaying vector columns in incorrect way

Grzegorz Chilkiewicz created SPARK-18226:
--------------------------------------------

             Summary: SparkR displaying vector columns in incorrect way
                 Key: SPARK-18226
                 URL: https://issues.apache.org/jira/browse/SPARK-18226
             Project: Spark
          Issue Type: Bug
          Components: SparkR
    Affects Versions: 2.0.0
            Reporter: Grzegorz Chilkiewicz
            Priority: Trivial


I have encountered a problem with SparkR presenting Spark vectors from org.apache.spark.mllib.linalg package
`head(df)` shows in vector column: "<environment: 0x2bd5d10>"
cast to string does not work as expected, it shows: "[1,null,null,org.apache.spark.sql.catalyst.expressions.UnsafeArrayData@79f50a91]"
`showDF(df)` work correctly

to reproduce, start SparkR and paste following code (example taken from https://spark.apache.org/docs/latest/sparkr.html#naive-bayes-model)

# Fit a Bernoulli naive Bayes model with spark.naiveBayes
titanic <- as.data.frame(Titanic)
titanicDF <- createDataFrame(titanic[titanic$Freq > 0, -5])
nbDF <- titanicDF
nbTestDF <- titanicDF
nbModel <- spark.naiveBayes(nbDF, Survived ~ Class + Sex + Age)

# Model summary
summary(nbModel)

# Prediction
nbPredictions <- predict(nbModel, nbTestDF)

#########################################
# My modification to expose the problem #
nbPredictions$rawPrediction_str <- cast(nbPredictions$rawPrediction, "string")
head(nbPredictions)
showDF(nbPredictions)




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org