I'm new on a spark , and I want to run an application on this framework using java language. I tried the following code :
  public  class Alert_Arret  {
  private static final SparkSession sparkSession = SparkSession.builder().master("local[*]").appName("Stateful Streaming Example").config("spark.sql.warehouse.dir", "file:////C:/Users/sgulati/spark-warehouse").getOrCreate();
    public static Properties Connection_db () {
            Properties connectionProperties = new Properties();
            connectionProperties.put("user", "xxxxx");
            connectionProperties.put("password", "xxxxx");
            connectionProperties.put("driver","com.mysql.jdbc.Driver");
            connectionProperties.put("url","xxxxxxxxxxxxxxxxx");
       return connectionProperties;
    }
   public static void GetData() {
        boolean checked = true;
        String dtable = "alerte_prog";
        String dtable2 = "last_tracking_tdays";
        Dataset<Row> df_a_prog = sparkSession.read().jdbc("jdbc:mysql://host:port/database", dtable, Connection_db());
       // df_a_prog.printSchema();
        Dataset<Row> track = sparkSession.read().jdbc("jdbc:mysql://host:port/database", dtable2, Connection_db());
        if (df_a_prog.select("heureDebut") != null && df_a_prog.select("heureFin") != null ) {
            track.withColumn("tracking_hour/minute", from_unixtime(unix_timestamp(col("tracking_time")), "HH:mm")).show()    }
    }
     public static void main(String[] args) {
     Connection_db();
     GetData();
    }
    }
when I run this code nothing is displayed and I get this:
   0/05/11 14:00:31 WARN ProcfsMetricsGetter: Exception when trying to compute pagesize, as a result reporting of ProcessTree metrics is stopped
  # A fatal error has been detected by the Java Runtime Environment:
   #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006c40022a,pid=3376, tid=0x0000000000002e84
I use IntelliJ IDEA and version of spark: 3.0.0.
User contributions licensed under CC BY-SA 3.0