M.Kiuchi
M.Kiuchi

Reputation: 113

columnSimilarities() of RowMatrix returns ERROR Schema: Failed initialising database

under spark 2.2.0, I've experienced error using columnSimilarities().

Here is code to reproduce.

from pyspark.mllib.linalg.distributed import RowMatrix
rdd = sc.parallelize([[1.0,2.0,1.0],[1.0,5.0,1.0],[1.0,2.0,1.0],[4.0,2.0,4.0]])
mat = RowMatrix(rdd)
sim = mat.columnSimilarities(0.1)
sim.entries.collect()

Error is like that(trancated. too long. Full log is here).

17/08/13 10:15:19 ERROR Schema: Failed initialising database.
Unable to open a test connection to the given database. JDBC url = jdbc:derby:;databaseName=metastore_db;create=true, username = APP. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------
java.sql.SQLException: Failed to start database 'metastore_db' with class loader org.apache.spark.sql.hive.client.IsolatedClientLoader$$anon$1@3234df5e, see the next exception for details.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source)

This code works well.

from pyspark.mllib.linalg.distributed import IndexedRow, IndexedRowMatrix
rdd = sc.parallelize([IndexedRow(0, [1.0,2.0,1.0]),
                      IndexedRow(1, [1.0,5.0,1.0]),
                      IndexedRow(2, [1.0,2.0,1.0]),
                      IndexedRow(3, [4.0,2.0,4.0])])
mat = IndexedRowMatrix(rdd).toRowMatrix()
sim = mat.columnSimilarities(0.1)
sim.entries.collect()

Is this bug of Spark ?

Upvotes: 1

Views: 312

Answers (1)

WestCoastProjects
WestCoastProjects

Reputation: 63201

This is a problem of jdbc connectivity - and not about columnSimilarities - or MLlib in general.

You might have some work to do to get the derby connection running. Here is one starting point : https://stackoverflow.com/a/40547664/1056563

Upvotes: 1

Related Questions