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

Connecting and reading via spark support #11

Open
mkegelCognism opened this issue May 28, 2024 · 0 comments
Open

Connecting and reading via spark support #11

mkegelCognism opened this issue May 28, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@mkegelCognism
Copy link

mkegelCognism commented May 28, 2024

When trying to connect via spark, I get this exception:

Exception in thread "main" java.sql.SQLFeatureNotSupportedException
	at jdbc.RedisStatement.setQueryTimeout(RedisStatement.java:91)
	at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.getQueryOutputSchema(JDBCRDD.scala:67)
	at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:58)
	at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation$.getSchema(JDBCRelation.scala:242)
	at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:37)
	at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:350)
	at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:228)
	at org.apache.spark.sql.DataFrameReader.$anonfun$load$2(DataFrameReader.scala:210)
	at scala.Option.getOrElse(Option.scala:121)
	at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:210)
	at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:171)
	at local.package.generate.Classname$.main(Sample.scala:57)

This is the code I am using, I assume that query param is not supported...
When I remove the line with query parameter, I get another error saying that "dbtable" or "query" params are mandatory.
When I try connecting without spark, everything works as expected and I am able to retrieve values.

sparkSession
      .read
      .format("jdbc")
      .option("url", "jdbc:redis://<password>@<host>:<port>?ssl=true")
      .option("driver", "jdbc.RedisDriver")
      .option("query", "keys startsWith*")
      .load()
      .printSchema()
@tjlee tjlee added the bug Something isn't working label Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants