2016-08-18 4 views
5

स्पार्क 2.0, मैं इतना की तरह एक pyspark एमएल पाइप लाइन में एक सरल VectorAssembler को चलाने के लिए, कोशिश कर रहा हूँ का उपयोग करना:स्पार्क एमएल पाइपलाइन का कारण बनता है java.lang.Exception: संकलन करने में विफल रहा है ... कोड ... बढ़ता परे 64 KB

feature_assembler = VectorAssembler(inputCols=['category_count', 'name_count'], \ 
            outputCol="features") 
pipeline = Pipeline(stages=[feature_assembler]) 
model = pipeline.fit(df_train) 
model_output = model.transform(df_train) 

जब मैं उत्पादन का उपयोग कर

model_output.select("features").show(1) 

मैं त्रुटि

Py4JJavaError        Traceback (most recent call last) 
<ipython-input-95-7a3e3d4f281c> in <module>() 
     2 
     3 
----> 4 model_output.select("features").show(1) 

/usr/local/spark20/python/pyspark/sql/dataframe.pyc in show(self, n, truncate) 
    285   +---+-----+ 
    286   """ 
--> 287   print(self._jdf.showString(n, truncate)) 
    288 
    289  def __repr__(self): 

/usr/local/spark20/python/lib/py4j-0.10.1-src.zip/py4j/java_gateway.py in __call__(self, *args) 
    931   answer = self.gateway_client.send_command(command) 
    932   return_value = get_return_value(
--> 933    answer, self.gateway_client, self.target_id, self.name) 
    934 
    935   for temp_arg in temp_args: 

/usr/local/spark20/python/pyspark/sql/utils.pyc in deco(*a, **kw) 
    61  def deco(*a, **kw): 
    62   try: 
---> 63    return f(*a, **kw) 
    64   except py4j.protocol.Py4JJavaError as e: 
    65    s = e.java_exception.toString() 

/usr/local/spark20/python/lib/py4j-0.10.1-src.zip/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name) 
    310     raise Py4JJavaError(
    311      "An error occurred while calling {0}{1}{2}.\n". 
--> 312      format(target_id, ".", name), value) 
    313    else: 
    314     raise Py4JError(

Py4JJavaError: An error occurred while calling o2875.showString. 
: org.apache.spark.SparkException: Job aborted due to stage failure: 
Task 0 in stage 1084.0 failed 4 times, most recent failure: Lost task 0.3 in stage 1084.0 (TID 42910, 169.45.92.174): 
java.util.concurrent.ExecutionException: java.lang.Exception: failed to 
compile: org.codehaus.janino.JaninoRuntimeException: Code of method " 

    (Lorg/apache/spark/sql/catalyst/InternalRow;Lorg/apache/spark/sql/catalyst/InternalRow;)I" of class  
"org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificOrdering" 
grows beyond 64 KB 

पाने को देखने के लिए कोशिश यह तो gener सूचीबद्ध करता है पैदा कोड है, जो दिखाई देता है:

/* 001 */ public SpecificOrdering generate(Object[] references) { 
/* 002 */ return new SpecificOrdering(references); 
/* 003 */ } 
/* 004 */ 
/* 005 */ class SpecificOrdering extends org.apache.spark.sql.catalyst.expressions.codegen.BaseOrdering { 
/* 006 */ 
/* 007 */ private Object[] references; 
/* 008 */ 
/* 009 */ 
/* 010 */ public int compareStruct1(InternalRow a, InternalRow b) { 
/* 011 */  InternalRow i = null; 
/* 012 */ 
/* 013 */  i = a; 
/* 014 */  boolean isNullA836; 
/* 015 */  byte primitiveA834; 
/* 016 */  { 
/* 017 */ 
/* 018 */  boolean isNull834 = i.isNullAt(0); 
/* 019 */  byte value834 = isNull834 ? (byte)-1 : (i.getByte(0)); 
/* 020 */  isNullA836 = isNull834; 
/* 021 */  primitiveA834 = value834; 
/* 022 */  } 
/* 023 */  i = b; 

… 

/* 28649 */  return 0; 
/* 28650 */ } 
/* 28651 */ } 

क्यों इस सरल VectorAssembler कोड की 28,651 लाइनों पैदा करते हैं और 64KB से अधिक हो जाएगा?

+0

आपके डेटाफ्रेम में कितने कॉलम हैं? क्या आपने VectorAssembler को लागू करने से पहले डेटाफ्रेम पर कोई अन्य रूपांतरण लागू किया था? यह सब जेनरेट कोड को फॉलो करता है। –

+0

मुझे स्पार्क 1.6.3 में एक ही त्रुटि दिखाई देती है। स्पार्क -8443 भी देखें। मैं 200 से अधिक कॉलम वाले डेटासेट के साथ काम कर रहा हूं। 1.6.3 से पहले मैं स्पार्क -16664 की वजह से इस मामले को भी कोशिश नहीं कर सका। के कारण: org.codehaus.janino.JaninoRuntimeException: विधि का कोड 64k से अधिक है – user1933178

उत्तर

2

ऐसा लगता है कि स्पार्क के आलसी मूल्यांकन के लिए 64 केबी की सीमा हो सकती है। दूसरे शब्दों में, यह इस मामले में आलसी होने के लिए थोड़ा सा है जो इसे उस सीमा को मारने का कारण बन रहा है।

मैं इस एक ही अपवाद है, जो मैं नहीं बल्कि एक VectorAssembler साथ की तुलना में एक join के माध्यम से ट्रिगर किया गया था के आसपास काम करने के लिए, मेरे पाइप लाइन के माध्यम आधे रास्ते के बारे में मेरे Dataset रों में से एक पर cache फोन करके सक्षम था। मुझे नहीं पता (अभी तक) वास्तव में इस मुद्दे को हल क्यों किया गया।

संबंधित मुद्दे