Skip to content

Commit

Permalink
used get_spark() in pivoter
Browse files Browse the repository at this point in the history
  • Loading branch information
Tagar committed Feb 18, 2018
1 parent 1ee5856 commit c586fc8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions abalon/spark/pivoter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

###########################################################################################################

from abalon.spark.sparkutils import get_spark
from pyspark.sql.types import *


Expand Down Expand Up @@ -85,6 +86,8 @@ def map_dict_to_denseArray (self, idx, d):

def pivot_df (self, df, idx_col, all_vars):

spark = get_spark()

if not all_vars:
# get list of variables from the dataset:
all_vars = sorted([row[0] for row in df.rdd.map(lambda (idx, k, v): k).distinct().collect()])
Expand Down
6 changes: 6 additions & 0 deletions abalon/spark/sparkutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ def sparkutils_init (i_spark=None, i_debug=False):
sparkutils_init_complete = True


def get_spark ():

sparkutils_init()
return spark


###########################################################################################################


Expand Down
2 changes: 1 addition & 1 deletion abalon/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

version = '2.1.4'
version = '2.1.5'


0 comments on commit c586fc8

Please sign in to comment.