मैं कोशिश कर रहा हूँ पढ़ने के लिए एक छोटे txt फ़ाइल में जोड़ा है जो एक तालिका के रूप में करने के लिए डिफ़ॉल्ट पर डीबी Databricks. का प्रयास करते समय पढ़ने के लिए फ़ाइल के माध्यम से स्थानीय फ़ाइल एपीआई के साथ, मैं एक FileNotFoundError
है , लेकिन मैं कर रहा हूँ पढ़ने के लिए एक ही फ़ाइल के रूप में स्पार्क RDD का उपयोग कर SparkContext.
मिल कृपया नीचे दिए गए कोड:
with open("/FileStore/tables/boringwords.txt", "r") as f_read:
for line in f_read:
print(line)
यह मुझे त्रुटि देता है:
FileNotFoundError Traceback (most recent call last)
<command-2618449717515592> in <module>
----> 1 with open("dbfs:/FileStore/tables/boringwords.txt", "r") as f_read:
2 for line in f_read:
3 print(line)
FileNotFoundError: [Errno 2] No such file or directory: 'dbfs:/FileStore/tables/boringwords.txt'
जहां के रूप में, मैं कोई समस्या नहीं है पढ़ने का उपयोग कर फ़ाइल SparkContext:
boring_words = sc.textFile("/FileStore/tables/boringwords.txt")
set(i.strip() for i in boring_words.collect())
और उम्मीद के रूप में, मैं परिणाम पाने के लिए ऊपर ब्लॉक का कोड:
Out[4]: {'mad',
'mobile',
'filename',
'circle',
'cookies',
'immigration',
'anticipated',
'editorials',
'review'}
मैं भी बात करने के लिए DBFS प्रलेखन समझने के लिए यहाँ के स्थानीय फ़ाइल एपीआई की सीमाओं की लेकिन कोई नेतृत्व इस मुद्दे पर. किसी भी मदद की बहुत सराहना की जाएगी. धन्यवाद!