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

Use the ORC version that corresponds to the Spark version [databricks] #4408

Merged
merged 26 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ThreadFactoryBuilder {

override def newThread(r: Runnable): Thread = {
val thread = defaultThreadFactory.newThread(r)
nameFormat.foreach(f => f.format(count.get.getAndIncrement()))
nameFormat.foreach(f => thread.setName(f.format(count.get.getAndIncrement())))
daemon.foreach(b => thread.setDaemon(b))
thread
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.nvidia.spark.rapids

import java.util.concurrent.Executors
import java.util.concurrent.{Callable, Executors}

import org.scalatest.FunSuite

Expand All @@ -26,34 +26,43 @@ class ThreadFactoryBuilderTest extends FunSuite {
var pool = Executors.newFixedThreadPool(2,
jlowe marked this conversation as resolved.
Show resolved Hide resolved
new ThreadFactoryBuilder().setNameFormat("Thread %s").setDaemon(true).build())

pool.submit(new Runnable {
override def run(): Unit = {
var ret = pool.submit(new Callable[String] {
override def call(): String = {
assert(Thread.currentThread().isDaemon)
assert(Thread.currentThread().getName == "Thread 0")
assert(Thread.currentThread().getName() == "Thread 0")
""
}
})

pool.submit(new Runnable {
override def run(): Unit = {
// waits and retrieves the result, if above asserts failed, will get execution exception
ret.get()
ret = pool.submit(new Callable[String] {
override def call(): String = {
assert(Thread.currentThread().isDaemon)
assert(Thread.currentThread().getName == "Thread 1")
assert(Thread.currentThread().getName() == "Thread 1")
""
}
})
ret.get()
pool.shutdown()
jlowe marked this conversation as resolved.
Show resolved Hide resolved

pool = Executors.newFixedThreadPool(2,
new ThreadFactoryBuilder().setNameFormat("Thread %s").build())
pool.submit(new Runnable {
override def run(): Unit = {
new ThreadFactoryBuilder().setNameFormat("Thread %d").build())
pool.submit(new Callable[String] {
override def call(): String = {
assert(!Thread.currentThread().isDaemon)
assert(Thread.currentThread().getName == "Thread 0")
assert(Thread.currentThread().getName() == "Thread 0")
""
}
})

pool.submit(new Runnable {
override def run(): Unit = {
ret.get()
pool.submit(new Callable[String] {
override def call(): String = {
assert(!Thread.currentThread().isDaemon)
assert(Thread.currentThread().getName == "Thread 1")
assert(Thread.currentThread().getName() == "Thread 1")
""
}
})
ret.get()
pool.shutdown()
}
}