Skip to content

Commit 9ab78b4

Browse files
author
Davies Liu
committed
Merge branch 'master' of github.com:apache/spark into fix_df
Conflicts: sql/core/src/main/scala/org/apache/spark/sql/Column.scala
2 parents 6040ba7 + bebf4c4 commit 9ab78b4

File tree

60 files changed

+4103
-1266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+4103
-1266
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.spark;
19+
20+
import org.apache.spark.scheduler.*;
21+
22+
/**
23+
* Class that allows users to receive all SparkListener events.
24+
* Users should override the onEvent method.
25+
*
26+
* This is a concrete Java class in order to ensure that we don't forget to update it when adding
27+
* new methods to SparkListener: forgetting to add a method will result in a compilation error (if
28+
* this was a concrete Scala class, default implementations of new event handlers would be inherited
29+
* from the SparkListener trait).
30+
*/
31+
public class SparkFirehoseListener implements SparkListener {
32+
33+
public void onEvent(SparkListenerEvent event) { }
34+
35+
@Override
36+
public final void onStageCompleted(SparkListenerStageCompleted stageCompleted) {
37+
onEvent(stageCompleted);
38+
}
39+
40+
@Override
41+
public final void onStageSubmitted(SparkListenerStageSubmitted stageSubmitted) {
42+
onEvent(stageSubmitted);
43+
}
44+
45+
@Override
46+
public final void onTaskStart(SparkListenerTaskStart taskStart) {
47+
onEvent(taskStart);
48+
}
49+
50+
@Override
51+
public final void onTaskGettingResult(SparkListenerTaskGettingResult taskGettingResult) {
52+
onEvent(taskGettingResult);
53+
}
54+
55+
@Override
56+
public final void onTaskEnd(SparkListenerTaskEnd taskEnd) {
57+
onEvent(taskEnd);
58+
}
59+
60+
@Override
61+
public final void onJobStart(SparkListenerJobStart jobStart) {
62+
onEvent(jobStart);
63+
}
64+
65+
@Override
66+
public final void onJobEnd(SparkListenerJobEnd jobEnd) {
67+
onEvent(jobEnd);
68+
}
69+
70+
@Override
71+
public final void onEnvironmentUpdate(SparkListenerEnvironmentUpdate environmentUpdate) {
72+
onEvent(environmentUpdate);
73+
}
74+
75+
@Override
76+
public final void onBlockManagerAdded(SparkListenerBlockManagerAdded blockManagerAdded) {
77+
onEvent(blockManagerAdded);
78+
}
79+
80+
@Override
81+
public final void onBlockManagerRemoved(SparkListenerBlockManagerRemoved blockManagerRemoved) {
82+
onEvent(blockManagerRemoved);
83+
}
84+
85+
@Override
86+
public final void onUnpersistRDD(SparkListenerUnpersistRDD unpersistRDD) {
87+
onEvent(unpersistRDD);
88+
}
89+
90+
@Override
91+
public final void onApplicationStart(SparkListenerApplicationStart applicationStart) {
92+
onEvent(applicationStart);
93+
}
94+
95+
@Override
96+
public final void onApplicationEnd(SparkListenerApplicationEnd applicationEnd) {
97+
onEvent(applicationEnd);
98+
}
99+
100+
@Override
101+
public final void onExecutorMetricsUpdate(
102+
SparkListenerExecutorMetricsUpdate executorMetricsUpdate) {
103+
onEvent(executorMetricsUpdate);
104+
}
105+
106+
@Override
107+
public final void onExecutorAdded(SparkListenerExecutorAdded executorAdded) {
108+
onEvent(executorAdded);
109+
}
110+
111+
@Override
112+
public final void onExecutorRemoved(SparkListenerExecutorRemoved executorRemoved) {
113+
onEvent(executorRemoved);
114+
}
115+
}

core/src/main/java/org/apache/spark/TaskContext.java

Lines changed: 0 additions & 126 deletions
This file was deleted.

core/src/main/scala/org/apache/spark/SparkContext.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,8 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli
804804
vClass: Class[V],
805805
conf: Configuration = hadoopConfiguration): RDD[(K, V)] = {
806806
assertNotStopped()
807+
// The call to new NewHadoopJob automatically adds security credentials to conf,
808+
// so we don't need to explicitly add them ourselves
807809
val job = new NewHadoopJob(conf)
808810
NewFileInputFormat.addInputPath(job, new Path(path))
809811
val updatedConf = job.getConfiguration
@@ -826,7 +828,10 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli
826828
kClass: Class[K],
827829
vClass: Class[V]): RDD[(K, V)] = {
828830
assertNotStopped()
829-
new NewHadoopRDD(this, fClass, kClass, vClass, conf)
831+
// Add necessary security credentials to the JobConf. Required to access secure HDFS.
832+
val jconf = new JobConf(conf)
833+
SparkHadoopUtil.get.addCredentials(jconf)
834+
new NewHadoopRDD(this, fClass, kClass, vClass, jconf)
830835
}
831836

832837
/** Get an RDD for a Hadoop SequenceFile with given key and value types.

0 commit comments

Comments
 (0)