【问题标题】:columnSimilarities() of RowMatrix returns ERROR Schema: Failed initialising databaseRowMatrix 的 columnSimilarities() 返回错误模式:初始化数据库失败
【发布时间】:2018-01-21 05:12:48
【问题描述】:

在 spark 2.2.0 下,我在使用 columnSimilarities() 时遇到了错误。

这是要重现的代码。

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()

错误是这样的(翻译。太长了。完整的日志是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)

这段代码运行良好。

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()

这是 Spark 的 bug 吗?

【问题讨论】:

    标签: apache-spark apache-spark-mllib


    【解决方案1】:

    这是jdbc 连接问题 - 而不是columnSimilarities - 或一般的 MLlib。

    您可能需要做一些工作才能让derby 连接运行。这是一个起点:https://stackoverflow.com/a/40547664/1056563

    【讨论】:

      猜你喜欢
      • 2012-01-12
      • 2019-07-05
      • 2017-07-11
      • 1970-01-01
      • 2022-01-18
      • 2022-10-09
      • 1970-01-01
      • 1970-01-01
      • 2016-09-03
      相关资源
      最近更新 更多