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

Getting SOQLParsingException while trying to use this jar to connect to salesforce from spark #16

Open
ronyx18 opened this issue Sep 25, 2019 · 3 comments

Comments

@ronyx18
Copy link

ronyx18 commented Sep 25, 2019

Spark version = 2.2
spark-shell --jars salesforce-jdbc-1.1-20180403.104727-1-single.jar
val jdbcurl="jdbc:ascendix:salesforce://;user=;password=;loginDomain="
val df=spark.read.format("jdbc").option("driver","com.ascendix.jdbc.salesforce.ForceDriver").option("url",jdbcurl).option("dbtable","select Name from account limit 10").load()

Error: ( I dont have an asterix in my soql )
java.sql.SQLException: org.mule.tools.soql.exception.SOQLParsingException: There was a SOQL parsing error close to '' (line:1,position:7).
at com.ascendix.jdbc.salesforce.ForcePreparedStatement.query(ForcePreparedStatement.java:123)
at com.ascendix.jdbc.salesforce.ForcePreparedStatement.executeQuery(ForcePreparedStatement.java:99)
at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:62)
at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation.(JDBCRelation.scala:114)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:52)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:309)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:178)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:146)
at org.apache.spark.sql.DataFrameReader.jdbc(DataFrameReader.scala:193)
... 50 elided
Caused by: org.mule.tools.soql.exception.SOQLParsingException: There was a SOQL parsing error close to '
' (line:1,position:7).
at org.mule.tools.soql.SOQLParserHelper.createParsingRecognitionException(SOQLParserHelper.java:115)
at org.mule.tools.soql.SOQLParserHelper.createParsingException(SOQLParserHelper.java:90)
at org.mule.tools.soql.SOQLParserHelper.createSOQLParserTree(SOQLParserHelper.java:71)
at org.mule.tools.soql.SOQLParserHelper.createSOQLData(SOQLParserHelper.java:34)
at com.ascendix.jdbc.salesforce.SoqlQueryAnalyzer.getQueryData(SoqlQueryAnalyzer.java:191)
at com.ascendix.jdbc.salesforce.SoqlQueryAnalyzer.getFieldDefinitions(SoqlQueryAnalyzer.java:162)
at com.ascendix.jdbc.salesforce.ForcePreparedStatement.getFieldDefinitions(ForcePreparedStatement.java:264)
at com.ascendix.jdbc.salesforce.ForcePreparedStatement.query(ForcePreparedStatement.java:113)
... 58 more
Caused by: org.antlr.runtime.NoViableAltException
at org.mule.tools.soql.parser.SOQLParser.select_spec(SOQLParser.java:4853)
at org.mule.tools.soql.parser.SOQLParser.select_clause(SOQLParser.java:2961)
at org.mule.tools.soql.parser.SOQLParser.soql_query_(SOQLParser.java:2680)
at org.mule.tools.soql.parser.SOQLParser.soql_query(SOQLParser.java:2587)
at org.mule.tools.soql.SOQLParserHelper.createSOQLParserTree(SOQLParserHelper.java:56)
... 63 more

@friendofasquid
Copy link

I have the same issue. Did you ever figure out a fix?

@tglstory
Copy link

I figured out why this happens, spark puts in quotes in your fields when it tries to select. I went to the SoqlQueryAnalyzer file and did a soql.replace(""", "") and it did the trick.

@tglstory
Copy link

Also please note Databricks doesn't like array types and other types, so i cast them all to String /shrug

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

3 participants