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

The show method for the query data is stuck #14

Closed
zhousPole opened this issue Jun 12, 2024 · 2 comments
Closed

The show method for the query data is stuck #14

zhousPole opened this issue Jun 12, 2024 · 2 comments

Comments

@zhousPole
Copy link

use example:

scala> val gpdf = spark.read.format("its-greenplum").
    option("url", "jdbc:postgresql://gp-master-host:5432/database").
    option("user", "database_user").
    option( "password", "yourpassword").
    option("dbtable","source_table_name").load()
scala> gpdf.show()

gpdf.printSchema() It can be printed normally
use windows10 PowerShell:
image

@zhousPole
Copy link
Author

use spark-greenplum-connector_2.12-3.1.jar

@zhousPole
Copy link
Author

I have found the problem(SparkSchemaUtil.scala guessMaxParallelTasks method):
image
sparkContext.getExecutorMemoryStatus.keys.size - 1 always 0,So there's a dead loop
Here is the version I modified the guessMaxParallelTasks method:

  def guessMaxParallelTasks(): Int = {
    val sparkContext = SparkContext.getOrCreate
    var guess: Int = -1
    val osName = System.getProperty("os.name")
    var isLocal: Boolean = false
    if (osName.toLowerCase().contains("windows") || osName.toLowerCase().contains("mac")) {
      isLocal = true
    }
    if (isLocal) {
      guess = sparkContext.getConf.getInt("spark.default.parallelism", 1) - 1;
    } else {
      while ((guess <= 0) && !Thread.currentThread().isInterrupted) {
        guess = sparkContext.getExecutorMemoryStatus.keys.size - 1
        if (sparkContext.deployMode == "cluster")
          guess -= 1
      }
    }
    guess
  }

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

1 participant