Skip to content

Commit

Permalink
Merge pull request #15 from embulk/fix-end-of-file-in-quoted-field
Browse files Browse the repository at this point in the history
Fix against end-of-file in quoted field
  • Loading branch information
dmikurube authored Nov 18, 2023
2 parents 959cedb + f1a86ce commit 44e731a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {
implementation "com.fasterxml.jackson.core:jackson-annotations:2.6.7"
implementation "com.fasterxml.jackson.core:jackson-core:2.6.7"
implementation "com.fasterxml.jackson.core:jackson-databind:2.6.7.5"
implementation "org.embulk:embulk-util-csv:0.2.3"
implementation "org.embulk:embulk-util-csv:0.2.4"
implementation "org.embulk:embulk-util-config:0.3.4"
implementation "org.embulk:embulk-util-file:0.1.5"
implementation "org.embulk:embulk-util-json:0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7=compileClasspath,runt
javax.validation:validation-api:1.1.0.Final=compileClasspath,runtimeClasspath
org.embulk:embulk-spi:0.11=compileClasspath
org.embulk:embulk-util-config:0.3.4=compileClasspath,runtimeClasspath
org.embulk:embulk-util-csv:0.2.3=compileClasspath,runtimeClasspath
org.embulk:embulk-util-csv:0.2.4=compileClasspath,runtimeClasspath
org.embulk:embulk-util-file:0.1.5=compileClasspath,runtimeClasspath
org.embulk:embulk-util-json:0.3.0=compileClasspath,runtimeClasspath
org.embulk:embulk-util-rubytime:0.3.3=compileClasspath,runtimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public void changePreviewSampleBufferBytes() throws Exception {
"test_sample_buffer_bytes.csv", "test_sample_buffer_bytes_previewed.csv");
}

@Test
public void testEndOfFileInQuote() throws Exception {
assertPreviewedRecords(embulk, "test_eof_in_quote_load.yml", "test_eof_in_quote.csv", "test_eof_in_quote_previewed.csv");
}

private static void assertPreviewedRecords(TestingEmbulk embulk,
String loadYamlResourceName, String sourceCsvResourceName, String resultCsvResourceName)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id,account,time,purchase,comment
1,32864,2015-01-27 19:23:49,20150127,embulk
2,14824,2015-01-27 19:01:23,20150127,embulk jruby
3,27559,2015-01-28 02:20:02,20150128,"Embulk ""cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
type: file
parser:
charset: UTF-8
newline: LF
type: csv
delimiter: ','
quote: '"'
escape: '"'
null_string: "NULL"
trim_if_not_quoted: false
skip_header_lines: 1
allow_extra_columns: false
allow_optional_columns: false
columns:
- {name: id, type: long}
- {name: account, type: long}
- {name: time, type: timestamp, format: '%Y-%m-%d %H:%M:%S'}
- {name: purchase, type: timestamp, format: '%Y%m%d'}
- {name: comment, type: string}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1,32864,2015-01-27 19:23:49.000000 +0000,2015-01-27 00:00:00.000000 +0000,embulk
2,14824,2015-01-27 19:01:23.000000 +0000,2015-01-27 00:00:00.000000 +0000,embulk jruby

0 comments on commit 44e731a

Please sign in to comment.