Skip to content

Commit e53744b

Browse files
committed
save
1 parent dfcec3c commit e53744b

File tree

3 files changed

+23
-31
lines changed

3 files changed

+23
-31
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/BaseScriptTransformationExec.scala

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,23 @@ trait BaseScriptTransformationExec extends UnaryExecNode {
8989
}
9090
}
9191

92-
abstract class BaseScriptTransformationWriterThread(
93-
iter: Iterator[InternalRow],
94-
inputSchema: Seq[DataType],
95-
ioSchema: BaseScriptTransformIOSchema,
96-
outputStream: OutputStream,
97-
proc: Process,
98-
stderrBuffer: CircularBuffer,
99-
taskContext: TaskContext,
100-
conf: Configuration) extends Thread with Logging {
92+
abstract class BaseScriptTransformationWriterThread extends Thread with Logging {
93+
94+
def iter: Iterator[InternalRow]
95+
96+
def inputSchema: Seq[DataType]
97+
98+
def ioSchema: BaseScriptTransformIOSchema
99+
100+
def outputStream: OutputStream
101+
102+
def proc: Process
103+
104+
def stderrBuffer: CircularBuffer
105+
106+
def taskContext: TaskContext
107+
108+
def conf: Configuration
101109

102110
setDaemon(true)
103111

sql/core/src/main/scala/org/apache/spark/sql/execution/SparkScriptTransformationExec.scala

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ case class SparkScriptTransformationExec(
7171

7272
// This new thread will consume the ScriptTransformation's input rows and write them to the
7373
// external process. That process's output will be read by this current thread.
74-
val writerThread = new ScriptTransformationWriterThread(
74+
val writerThread = ScriptTransformationWriterThread(
7575
inputIterator.map(outputProjection),
7676
input.map(_.dataType),
7777
ioschema,
@@ -131,7 +131,7 @@ case class SparkScriptTransformationExec(
131131
}
132132
}
133133

134-
private class ScriptTransformationWriterThread(
134+
case class ScriptTransformationWriterThread(
135135
iter: Iterator[InternalRow],
136136
inputSchema: Seq[DataType],
137137
ioSchema: SparkScriptIOSchema,
@@ -140,15 +140,7 @@ private class ScriptTransformationWriterThread(
140140
stderrBuffer: CircularBuffer,
141141
taskContext: TaskContext,
142142
conf: Configuration)
143-
extends BaseScriptTransformationWriterThread(
144-
iter,
145-
inputSchema,
146-
ioSchema,
147-
outputStream,
148-
proc,
149-
stderrBuffer,
150-
taskContext,
151-
conf) {
143+
extends BaseScriptTransformationWriterThread {
152144

153145
setDaemon(true)
154146

sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveScriptTransformationExec.scala

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ case class HiveScriptTransformationExec(
8686

8787
// This new thread will consume the ScriptTransformation's input rows and write them to the
8888
// external process. That process's output will be read by this current thread.
89-
val writerThread = new HiveScriptTransformationWriterThread(
89+
val writerThread = HiveScriptTransformationWriterThread(
9090
inputIterator.map(outputProjection),
9191
input.map(_.dataType),
9292
inputSerde,
@@ -208,7 +208,7 @@ case class HiveScriptTransformationExec(
208208
}
209209
}
210210

211-
private class HiveScriptTransformationWriterThread(
211+
case class HiveScriptTransformationWriterThread(
212212
iter: Iterator[InternalRow],
213213
inputSchema: Seq[DataType],
214214
@Nullable inputSerde: AbstractSerDe,
@@ -219,15 +219,7 @@ private class HiveScriptTransformationWriterThread(
219219
stderrBuffer: CircularBuffer,
220220
taskContext: TaskContext,
221221
conf: Configuration)
222-
extends BaseScriptTransformationWriterThread(
223-
iter,
224-
inputSchema,
225-
ioSchema,
226-
outputStream,
227-
proc,
228-
stderrBuffer,
229-
taskContext,
230-
conf) with HiveInspectors {
222+
extends BaseScriptTransformationWriterThread with HiveInspectors {
231223

232224
override def processRows(): Unit = {
233225
val dataOutputStream = new DataOutputStream(outputStream)

0 commit comments

Comments
 (0)