Code Monkey home page Code Monkey logo

Comments (4)

samelamin avatar samelamin commented on July 23, 2024

Hi

Looks like you need to create an uber jar because the connector on its own needs the google client. Most clusters already have that but sounds like you need to load it onto zeppelin specifically

I would suggest creating a fat jar and seeing if you can get spark to run a sample application on the EMR, once that works it should be simpler to port it to zeppelin

from spark-bigquery.

Jeeva-Ganesan avatar Jeeva-Ganesan commented on July 23, 2024

Hi. I created an uber jar with google client library using sbt.

libraryDependencies ++= {
  val sparkVer = "2.2.1"
  val sparkbqVer = "0.2.4"
  Seq(
    "org.apache.spark" %% "spark-core" % sparkVer % "compile" withSources(),
    "org.apache.spark" %% "spark-sql" % sparkVer % "provided", //% "compile" withSources(),
    "org.apache.spark" %% "spark-hive" % sparkVer, //% "provided" withSources(),
    "com.github.samelamin" %% "spark-bigquery" % sparkbqVer,
    "com.google.api-client" % "google-api-client" % "1.23.0"
  )
}

This is the error I am getting when i submit my spark job with spark submit command ,

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
        at com.google.cloud.hadoop.io.bigquery.BigQueryStrings.parseTableReference(BigQueryStrings.java:68)
        at com.samelamin.spark.bigquery.BigQueryRelation.getConvertedSchema(BigQueryRelation.scala:19)
        at com.samelamin.spark.bigquery.BigQueryRelation.schema(BigQueryRelation.scala:13)
        at org.apache.spark.sql.execution.datasources.LogicalRelation$.apply(LogicalRelation.scala:77)
        at org.apache.spark.sql.SparkSession.baseRelationToDataFrame(SparkSession.scala:424)
        at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:172)
        at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:146)
        at dataload.pull_gbq_data$.main(pull_gbq_data.scala:18)
        at dataload.pull_gbq_data.main(pull_gbq_data.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:775)
        at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:180)
        at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:205)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:119)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

from spark-bigquery.

samelamin avatar samelamin commented on July 23, 2024

That is a different error @Jeeva-Ganesan and it has to do with Guava

You need to shade it into the uber jar, if you google it you will see what I mean

I think anything about guava 18 should fix it

from spark-bigquery.

Jeeva-Ganesan avatar Jeeva-Ganesan commented on July 23, 2024

Yes. I tried that, I changed my build file like this,

assemblyShadeRules in assembly := Seq(
ShadeRule.rename("com.google.guava.**" -> "my_conf.@1")
    .inLibrary("com.google.guava" % "config" % "23.6")
    .inProject
)

libraryDependencies ++= {
  val sparkVer = "2.2.1"
  val sparkbqVer = "0.2.4"
  Seq(
    "org.apache.spark" %% "spark-core" % sparkVer % "provided", //compile" withSources(),
    "org.apache.spark" %% "spark-sql" % sparkVer % "provided", //% "compile" withSources(),
    "org.apache.spark" %% "spark-hive" % sparkVer, //% "provided" withSources(),
    "com.github.samelamin" %% "spark-bigquery" % sparkbqVer % "compile",
    "com.google.api-client" % "google-api-client" % "1.23.0" % "compile",
    "com.google.guava" % "guava" % "23.6"
  )
}

Still got the error, ended up downloading latest guava jar and placing it in spark jars folder (deleting the existing one). Then it worked.

from spark-bigquery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.