내가 읽으려고 작은 txt 파일에 추가되는 테이블로 기본에서 db 를 Databricks. 하는 동안 파일을 읽을 통해 로컬 파일 API,I get a 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 문서화 을 이해하기 위해 여기에는 로컬 파일 API 의 제한은 없었지만 지도에서 문제입니다. 어떤 도움을 주시면 감사하겠습니다. 감사합니다!