0
저는 아주 새로워졌습니다. 2 열만있는 CSV 파일이 있습니다. csv 파일은 큽니다 (3 천만 행 포함). 데이터 프레임에로드하려면 spark-csv_2.10:1.2.0
을 사용하려고합니다. 내가 오류 다음 얻고있다spark에서 csv를 읽는 중 예외가 발생했습니다.
df = sqlContext.read.load('file:///path/file_third.csv',
format='com.databricks.spark.csv',
header='true',
inferSchema='true')
:
나는 다음과 같은 코드를 사용하고
[Stage 2:> (0 + 8)/10]16/08/04 15:32:57 ERROR Executor: Exception in task 1.0 in stage 2.0 (TID 3)
com.univocity.parsers.common.TextParsingException: Length of parsed input (1000001) exceeds the maximum number of characters defined in your parser settings (1000000).
Identified line separator characters in the parsed content. This may be the cause of the error. The line separator in your parser settings is set to '\n'. Parsed content:
을 다음과 같은 힌트가오고있다. 나는 그것이 줄 바꿈을 이해할 수 없다고 생각하고있다.
Hint: Number of characters processed may have exceeded limit of 1000000 characters per column. Use settings.setMaxCharsPerColumn(int) to define the maximum number of characters a column can have
Ensure your configuration is correct, with delimiters, quotes and escape sequences that match the input format you are trying to parse
Parser Configuration: CsvParserSettings:
Auto configuration enabled=true
Autodetect column delimiter=false
Autodetect quotes=false
Column reordering enabled=true
Empty value=null
Escape unquoted values=false
Header extraction enabled=null
Headers=[1235187239212711042, 0006]
Ignore leading whitespaces=false
Ignore trailing whitespaces=false
Input buffer size=128
Input reading on separate thread=false
Keep escape sequences=false
Line separator detection enabled=false
Maximum number of characters per column=1000000
Maximum number of columns=20480
Normalize escaped line separators=true
Null value=
Number of records to read=all
Row processor=none
RowProcessor error handler=null
Selected fields=none
Skip empty lines=true
Unescaped quote handling=STOP_AT_DELIMITERFormat configuration:
CsvFormat:
Comment character=\0
Field delimiter=,
Line separator (normalized)=\n
Line separator sequence=\n
Quote character="
Quote escape character=\
Quote escape escape character=null
이 오류를 해결하는 방법?
작은 샘플 (<10,000 줄)의 데이터에 대해 동일한 오류가 발생하면 알려주십시오. –
@Umberto, 예. 작은 파일에 대해서는이 오류가 표시되지 않습니다. 스파크에서 큰 파일을 읽을 수있는 방법이 있습니까? – Vraj
버그가있을 수 있음 [SPARK-14103] (https://issues.apache.org/jira/browse/SPARK-14103) 특수 필드를 사용하는 경우 파서는 줄 바꿈을 인식하지 못한다. 더 많은 행을 단일 열로 이동하고 충돌합니다. –