embulk 0.6.13 → 0.6.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/build.gradle +1 -1
- data/embulk-core/src/main/java/org/embulk/config/CommitReport.java +3 -0
- data/embulk-core/src/main/java/org/embulk/config/ConfigDiff.java +3 -0
- data/embulk-core/src/main/java/org/embulk/config/ConfigSource.java +3 -0
- data/embulk-core/src/main/java/org/embulk/config/DataSource.java +2 -0
- data/embulk-core/src/main/java/org/embulk/config/DataSourceImpl.java +8 -1
- data/embulk-core/src/main/java/org/embulk/config/TaskSource.java +3 -0
- data/embulk-core/src/main/java/org/embulk/spi/ColumnConfig.java +28 -6
- data/embulk-core/src/main/java/org/embulk/spi/PageFormat.java +3 -3
- data/embulk-core/src/main/java/org/embulk/spi/ProcessTask.java +12 -77
- data/embulk-core/src/main/java/org/embulk/spi/Schema.java +35 -2
- data/embulk-core/src/main/java/org/embulk/spi/SchemaConfig.java +42 -0
- data/embulk-core/src/main/java/org/embulk/spi/SchemaConfigException.java +22 -0
- data/embulk-core/src/main/java/org/embulk/spi/time/TimestampFormat.java +2 -0
- data/embulk-core/src/main/java/org/embulk/spi/time/TimestampFormatter.java +40 -2
- data/embulk-core/src/main/java/org/embulk/spi/time/TimestampParser.java +43 -4
- data/embulk-core/src/main/java/org/embulk/spi/type/TimestampType.java +2 -0
- data/embulk-core/src/test/java/org/embulk/spi/PageTestUtils.java +1 -22
- data/embulk-core/src/test/java/org/embulk/spi/TestFileInputRunner.java +10 -10
- data/embulk-core/src/test/java/org/embulk/spi/TestFileOutputRunner.java +12 -12
- data/embulk-core/src/test/java/org/embulk/spi/TestPageBuilderReader.java +49 -31
- data/embulk-core/src/test/java/org/embulk/spi/time/TestTimestampFormatterParser.java +15 -19
- data/embulk-core/src/test/java/org/embulk/spi/time/TestTimestampFormatterParserDeprecated.java +67 -0
- data/embulk-docs/src/built-in.rst +18 -0
- data/embulk-docs/src/release.rst +1 -0
- data/embulk-docs/src/release/release-0.6.14.rst +47 -0
- data/embulk-standards/src/main/java/org/embulk/standards/CsvFormatterPlugin.java +26 -10
- data/embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java +21 -6
- data/embulk-standards/src/test/java/org/embulk/standards/TestCsvFormatterPlugin.java +3 -0
- data/embulk-standards/src/test/java/org/embulk/standards/TestCsvParserPlugin.java +3 -0
- data/embulk-standards/src/test/java/org/embulk/standards/TestCsvTokenizer.java +4 -6
- data/lib/embulk/guess/csv.rb +9 -5
- data/lib/embulk/plugin_registry.rb +15 -11
- data/lib/embulk/version.rb +1 -1
- metadata +7 -4
@@ -0,0 +1,22 @@
|
|
1
|
+
package org.embulk.spi;
|
2
|
+
|
3
|
+
import org.embulk.config.ConfigException;
|
4
|
+
|
5
|
+
public class SchemaConfigException
|
6
|
+
extends ConfigException
|
7
|
+
{
|
8
|
+
public SchemaConfigException(String message)
|
9
|
+
{
|
10
|
+
super(message);
|
11
|
+
}
|
12
|
+
|
13
|
+
public SchemaConfigException(Throwable cause)
|
14
|
+
{
|
15
|
+
super(cause);
|
16
|
+
}
|
17
|
+
|
18
|
+
public SchemaConfigException(String message, Throwable cause)
|
19
|
+
{
|
20
|
+
super(message, cause);
|
21
|
+
}
|
22
|
+
}
|
@@ -26,11 +26,13 @@ public class TimestampFormat
|
|
26
26
|
return format;
|
27
27
|
}
|
28
28
|
|
29
|
+
@Deprecated
|
29
30
|
public TimestampFormatter newFormatter(TimestampFormatter.FormatterTask task)
|
30
31
|
{
|
31
32
|
return new TimestampFormatter(format, task);
|
32
33
|
}
|
33
34
|
|
35
|
+
@Deprecated
|
34
36
|
public TimestampParser newParser(TimestampParser.ParserTask task)
|
35
37
|
{
|
36
38
|
return new TimestampParser(format, task);
|
@@ -3,9 +3,9 @@ package org.embulk.spi.time;
|
|
3
3
|
import java.util.Locale;
|
4
4
|
import org.joda.time.DateTime;
|
5
5
|
import org.joda.time.DateTimeZone;
|
6
|
+
import com.google.common.base.Optional;
|
6
7
|
import org.jruby.embed.ScriptingContainer;
|
7
8
|
import org.jruby.util.RubyDateFormat;
|
8
|
-
import org.embulk.config.Task;
|
9
9
|
import org.embulk.config.Config;
|
10
10
|
import org.embulk.config.ConfigInject;
|
11
11
|
import org.embulk.config.ConfigDefault;
|
@@ -14,8 +14,9 @@ import org.embulk.spi.util.LineEncoder;
|
|
14
14
|
|
15
15
|
public class TimestampFormatter
|
16
16
|
{
|
17
|
+
@Deprecated
|
17
18
|
public interface FormatterTask
|
18
|
-
extends Task
|
19
|
+
extends org.embulk.config.Task
|
19
20
|
{
|
20
21
|
@Config("timezone")
|
21
22
|
@ConfigDefault("\"UTC\"")
|
@@ -25,14 +26,51 @@ public class TimestampFormatter
|
|
25
26
|
public ScriptingContainer getJRuby();
|
26
27
|
}
|
27
28
|
|
29
|
+
public interface Task
|
30
|
+
{
|
31
|
+
@Config("default_timezone")
|
32
|
+
@ConfigDefault("\"UTC\"")
|
33
|
+
public DateTimeZone getDefaultTimeZone();
|
34
|
+
|
35
|
+
@Config("default_timestamp_format")
|
36
|
+
@ConfigDefault("\"%Y-%m-%d %H:%M:%S.%6N %z\"")
|
37
|
+
public String getDefaultTimestampFormat();
|
38
|
+
|
39
|
+
@ConfigInject
|
40
|
+
public ScriptingContainer getJRuby();
|
41
|
+
}
|
42
|
+
|
43
|
+
public interface TimestampColumnOption
|
44
|
+
{
|
45
|
+
@Config("timezone")
|
46
|
+
@ConfigDefault("null")
|
47
|
+
public Optional<DateTimeZone> getTimeZone();
|
48
|
+
|
49
|
+
@Config("format")
|
50
|
+
@ConfigDefault("null")
|
51
|
+
public Optional<String> getFormat();
|
52
|
+
}
|
53
|
+
|
28
54
|
private final RubyDateFormat dateFormat;
|
29
55
|
private final DateTimeZone timeZone;
|
30
56
|
|
57
|
+
@Deprecated
|
31
58
|
public TimestampFormatter(String format, FormatterTask task)
|
32
59
|
{
|
33
60
|
this(task.getJRuby(), format, task.getTimeZone());
|
34
61
|
}
|
35
62
|
|
63
|
+
public TimestampFormatter(Task task, Optional<? extends TimestampColumnOption> columnOption)
|
64
|
+
{
|
65
|
+
this(task.getJRuby(),
|
66
|
+
columnOption.isPresent() ?
|
67
|
+
columnOption.get().getFormat().or(task.getDefaultTimestampFormat())
|
68
|
+
: task.getDefaultTimestampFormat(),
|
69
|
+
columnOption.isPresent() ?
|
70
|
+
columnOption.get().getTimeZone().or(task.getDefaultTimeZone())
|
71
|
+
: task.getDefaultTimeZone());
|
72
|
+
}
|
73
|
+
|
36
74
|
public TimestampFormatter(ScriptingContainer jruby, String format, DateTimeZone timeZone)
|
37
75
|
{
|
38
76
|
this.timeZone = timeZone;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
package org.embulk.spi.time;
|
2
2
|
|
3
3
|
import org.joda.time.DateTimeZone;
|
4
|
+
import com.google.common.base.Optional;
|
4
5
|
import org.jruby.embed.ScriptingContainer;
|
5
|
-
import org.embulk.config.Task;
|
6
6
|
import org.embulk.config.Config;
|
7
7
|
import org.embulk.config.ConfigInject;
|
8
8
|
import org.embulk.config.ConfigDefault;
|
@@ -11,8 +11,9 @@ import static org.embulk.spi.time.TimestampFormat.parseDateTimeZone;
|
|
11
11
|
|
12
12
|
public class TimestampParser
|
13
13
|
{
|
14
|
+
@Deprecated
|
14
15
|
public interface ParserTask
|
15
|
-
extends Task
|
16
|
+
extends org.embulk.config.Task
|
16
17
|
{
|
17
18
|
@Config("default_timezone")
|
18
19
|
@ConfigDefault("\"UTC\"")
|
@@ -22,17 +23,50 @@ public class TimestampParser
|
|
22
23
|
public ScriptingContainer getJRuby();
|
23
24
|
}
|
24
25
|
|
26
|
+
public interface Task
|
27
|
+
{
|
28
|
+
@Config("default_timezone")
|
29
|
+
@ConfigDefault("\"UTC\"")
|
30
|
+
public DateTimeZone getDefaultTimeZone();
|
31
|
+
|
32
|
+
@Config("default_timestamp_format")
|
33
|
+
@ConfigDefault("\"%Y-%m-%d %H:%M:%S.%N %z\"")
|
34
|
+
public String getDefaultTimestampFormat();
|
35
|
+
|
36
|
+
@ConfigInject
|
37
|
+
public ScriptingContainer getJRuby();
|
38
|
+
}
|
39
|
+
|
40
|
+
public interface TimestampColumnOption
|
41
|
+
{
|
42
|
+
@Config("timezone")
|
43
|
+
@ConfigDefault("null")
|
44
|
+
public Optional<DateTimeZone> getTimeZone();
|
45
|
+
|
46
|
+
@Config("format")
|
47
|
+
@ConfigDefault("null")
|
48
|
+
public Optional<String> getFormat();
|
49
|
+
}
|
50
|
+
|
25
51
|
private final JRubyTimeParserHelper helper;
|
26
52
|
private final DateTimeZone defaultTimeZone;
|
27
53
|
|
54
|
+
@Deprecated
|
28
55
|
public TimestampParser(String format, ParserTask task)
|
29
56
|
{
|
30
57
|
this(task.getJRuby(), format, task.getDefaultTimeZone());
|
31
58
|
}
|
32
59
|
|
33
|
-
|
60
|
+
TimestampParser(Task task)
|
34
61
|
{
|
35
|
-
|
62
|
+
this(task.getJRuby(), task.getDefaultTimestampFormat(), task.getDefaultTimeZone());
|
63
|
+
}
|
64
|
+
|
65
|
+
public TimestampParser(Task task, TimestampColumnOption columnOption)
|
66
|
+
{
|
67
|
+
this(task.getJRuby(),
|
68
|
+
columnOption.getFormat().or(task.getDefaultTimestampFormat()),
|
69
|
+
columnOption.getTimeZone().or(task.getDefaultTimeZone()));
|
36
70
|
}
|
37
71
|
|
38
72
|
public TimestampParser(ScriptingContainer jruby, String format, DateTimeZone defaultTimeZone)
|
@@ -43,6 +77,11 @@ public class TimestampParser
|
|
43
77
|
this.defaultTimeZone = defaultTimeZone;
|
44
78
|
}
|
45
79
|
|
80
|
+
public DateTimeZone getDefaultTimeZone()
|
81
|
+
{
|
82
|
+
return defaultTimeZone;
|
83
|
+
}
|
84
|
+
|
46
85
|
public Timestamp parse(String text) throws TimestampParseException
|
47
86
|
{
|
48
87
|
long localUsec = helper.strptimeUsec(text);
|
@@ -22,12 +22,14 @@ public class TimestampType
|
|
22
22
|
this.format = format;
|
23
23
|
}
|
24
24
|
|
25
|
+
@Deprecated
|
25
26
|
public TimestampType withFormat(String format)
|
26
27
|
{
|
27
28
|
// TODO is this correct design...?
|
28
29
|
return new TimestampType(format);
|
29
30
|
}
|
30
31
|
|
32
|
+
@Deprecated
|
31
33
|
public String getFormat()
|
32
34
|
{
|
33
35
|
if (format == null) {
|
@@ -17,28 +17,7 @@ import com.google.common.collect.ImmutableList;
|
|
17
17
|
public class PageTestUtils
|
18
18
|
{
|
19
19
|
private PageTestUtils()
|
20
|
-
{
|
21
|
-
}
|
22
|
-
|
23
|
-
public static Schema newSchema()
|
24
|
-
{
|
25
|
-
return new Schema(ImmutableList.<Column> of());
|
26
|
-
}
|
27
|
-
|
28
|
-
public static Schema newSchema(Column... columns)
|
29
|
-
{
|
30
|
-
return new Schema(ImmutableList.copyOf(columns));
|
31
|
-
}
|
32
|
-
|
33
|
-
public static Schema newSchema(ColumnConfig... columns)
|
34
|
-
{
|
35
|
-
return new SchemaConfig(ImmutableList.copyOf(columns)).toSchema();
|
36
|
-
}
|
37
|
-
|
38
|
-
public static ColumnConfig newColumn(String name, Type type)
|
39
|
-
{
|
40
|
-
return new ColumnConfig(name, type, null);
|
41
|
-
}
|
20
|
+
{ }
|
42
21
|
|
43
22
|
public static List<Page> buildPage(BufferAllocator bufferAllocator,
|
44
23
|
Schema schema, Object... values)
|
@@ -117,11 +117,11 @@ public class TestFileInputRunner
|
|
117
117
|
ConfigSource config = Exec.newConfigSource().set(
|
118
118
|
"parser",
|
119
119
|
ImmutableMap.of("type", "mock", "columns", ImmutableList.of(
|
120
|
-
ImmutableMap.of("name", "col1", "type", "boolean"),
|
121
|
-
ImmutableMap.of("name", "col2", "type", "long"),
|
122
|
-
ImmutableMap.of("name", "col3", "type", "double"),
|
123
|
-
ImmutableMap.of("name", "col4", "type", "string"),
|
124
|
-
ImmutableMap.of("name", "col5", "type", "timestamp"))));
|
120
|
+
ImmutableMap.of("name", "col1", "type", "boolean", "option", ImmutableMap.of()),
|
121
|
+
ImmutableMap.of("name", "col2", "type", "long", "option", ImmutableMap.of()),
|
122
|
+
ImmutableMap.of("name", "col3", "type", "double", "option", ImmutableMap.of()),
|
123
|
+
ImmutableMap.of("name", "col4", "type", "string", "option", ImmutableMap.of()),
|
124
|
+
ImmutableMap.of("name", "col5", "type", "timestamp", "option", ImmutableMap.of()))));
|
125
125
|
|
126
126
|
final MockPageOutput output = new MockPageOutput();
|
127
127
|
runner.transaction(config, new InputPlugin.Control()
|
@@ -167,11 +167,11 @@ public class TestFileInputRunner
|
|
167
167
|
ConfigSource config = Exec.newConfigSource().set(
|
168
168
|
"parser",
|
169
169
|
ImmutableMap.of("type", "mock", "columns", ImmutableList.of(
|
170
|
-
ImmutableMap.of("name", "col1", "type", "boolean"),
|
171
|
-
ImmutableMap.of("name", "col2", "type", "long"),
|
172
|
-
ImmutableMap.of("name", "col3", "type", "double"),
|
173
|
-
ImmutableMap.of("name", "col4", "type", "string"),
|
174
|
-
ImmutableMap.of("name", "col5", "type", "timestamp"))));
|
170
|
+
ImmutableMap.of("name", "col1", "type", "boolean", "option", ImmutableMap.of()),
|
171
|
+
ImmutableMap.of("name", "col2", "type", "long", "option", ImmutableMap.of()),
|
172
|
+
ImmutableMap.of("name", "col3", "type", "double", "option", ImmutableMap.of()),
|
173
|
+
ImmutableMap.of("name", "col4", "type", "string", "option", ImmutableMap.of()),
|
174
|
+
ImmutableMap.of("name", "col5", "type", "timestamp", "option", ImmutableMap.of()))));
|
175
175
|
|
176
176
|
final MockPageOutput output = new MockPageOutput();
|
177
177
|
|
@@ -105,12 +105,12 @@ public class TestFileOutputRunner
|
|
105
105
|
MockFileOutputPlugin fileOutputPlugin = new MockFileOutputPlugin();
|
106
106
|
final FileOutputRunner runner = new FileOutputRunner(fileOutputPlugin);
|
107
107
|
|
108
|
-
ImmutableList<ImmutableMap<String,
|
109
|
-
ImmutableMap
|
110
|
-
ImmutableMap
|
111
|
-
ImmutableMap
|
112
|
-
ImmutableMap
|
113
|
-
ImmutableMap
|
108
|
+
ImmutableList<ImmutableMap<String, Object>> columns = ImmutableList.of(
|
109
|
+
ImmutableMap.<String,Object>of("name", "col1", "type", "boolean", "option", ImmutableMap.of()),
|
110
|
+
ImmutableMap.<String,Object>of("name", "col2", "type", "long", "option", ImmutableMap.of()),
|
111
|
+
ImmutableMap.<String,Object>of("name", "col3", "type", "double", "option", ImmutableMap.of()),
|
112
|
+
ImmutableMap.<String,Object>of("name", "col4", "type", "string", "option", ImmutableMap.of()),
|
113
|
+
ImmutableMap.<String,Object>of("name", "col5", "type", "timestamp", "option", ImmutableMap.of()));
|
114
114
|
ConfigSource config = Exec
|
115
115
|
.newConfigSource()
|
116
116
|
.set("type", "unused?")
|
@@ -163,12 +163,12 @@ public class TestFileOutputRunner
|
|
163
163
|
MockFileOutputPlugin fileOutputPlugin = new MockFileOutputPlugin();
|
164
164
|
final FileOutputRunner runner = new FileOutputRunner(fileOutputPlugin);
|
165
165
|
|
166
|
-
ImmutableList<ImmutableMap<String,
|
167
|
-
ImmutableMap
|
168
|
-
ImmutableMap
|
169
|
-
ImmutableMap
|
170
|
-
ImmutableMap
|
171
|
-
ImmutableMap
|
166
|
+
ImmutableList<ImmutableMap<String, Object>> columns = ImmutableList.of(
|
167
|
+
ImmutableMap.<String,Object>of("name", "col1", "type", "boolean", "option", ImmutableMap.of()),
|
168
|
+
ImmutableMap.<String,Object>of("name", "col2", "type", "long", "option", ImmutableMap.of()),
|
169
|
+
ImmutableMap.<String,Object>of("name", "col3", "type", "double", "option", ImmutableMap.of()),
|
170
|
+
ImmutableMap.<String,Object>of("name", "col4", "type", "string", "option", ImmutableMap.of()),
|
171
|
+
ImmutableMap.<String,Object>of("name", "col5", "type", "timestamp", "option", ImmutableMap.of()));
|
172
172
|
ConfigSource config = Exec
|
173
173
|
.newConfigSource()
|
174
174
|
.set("type", "unused?")
|
@@ -1,7 +1,5 @@
|
|
1
1
|
package org.embulk.spi;
|
2
2
|
|
3
|
-
import static org.embulk.spi.PageTestUtils.newColumn;
|
4
|
-
import static org.embulk.spi.PageTestUtils.newSchema;
|
5
3
|
import static org.embulk.spi.type.Types.BOOLEAN;
|
6
4
|
import static org.embulk.spi.type.Types.DOUBLE;
|
7
5
|
import static org.embulk.spi.type.Types.LONG;
|
@@ -77,66 +75,81 @@ public class TestPageBuilderReader
|
|
77
75
|
@Test
|
78
76
|
public void testBoolean()
|
79
77
|
{
|
80
|
-
check(
|
78
|
+
check(Schema.builder().add("col1", BOOLEAN).build(),
|
79
|
+
false, true, true);
|
81
80
|
}
|
82
81
|
|
83
82
|
@Test
|
84
83
|
public void testLong()
|
85
84
|
{
|
86
|
-
check(
|
87
|
-
Long.MAX_VALUE);
|
85
|
+
check(Schema.builder().add("col1", LONG).build(),
|
86
|
+
1L, Long.MIN_VALUE, Long.MAX_VALUE);
|
88
87
|
}
|
89
88
|
|
90
89
|
@Test
|
91
90
|
public void testDouble()
|
92
91
|
{
|
93
|
-
check(
|
92
|
+
check(Schema.builder().add("col1", DOUBLE).build(),
|
93
|
+
8.1, 3.141592, 4.3);
|
94
94
|
}
|
95
95
|
|
96
96
|
@Test
|
97
97
|
public void testUniqueStrings()
|
98
98
|
{
|
99
|
-
check(
|
99
|
+
check(Schema.builder().add("col1", STRING).build(),
|
100
|
+
"test1", "test2", "test0");
|
100
101
|
}
|
101
102
|
|
102
103
|
@Test
|
103
104
|
public void testDuplicateStrings()
|
104
105
|
{
|
105
|
-
check(
|
106
|
+
check(Schema.builder().add("col1", STRING).build(),
|
107
|
+
"test1", "test1", "test1");
|
106
108
|
}
|
107
109
|
|
108
110
|
@Test
|
109
111
|
public void testDuplicateStringsMultiColumns()
|
110
112
|
{
|
111
|
-
check(
|
112
|
-
"test2", "test1",
|
113
|
-
"test1"
|
113
|
+
check(Schema.builder().add("col1", STRING).add("col1", STRING).build(),
|
114
|
+
"test2", "test1",
|
115
|
+
"test1", "test2",
|
116
|
+
"test2", "test0",
|
117
|
+
"test1", "test1");
|
114
118
|
}
|
115
119
|
|
116
120
|
@Test
|
117
121
|
public void testTimestamp()
|
118
122
|
{
|
119
|
-
check(
|
123
|
+
check(Schema.builder().add("col1", TIMESTAMP).build(),
|
120
124
|
Timestamp.ofEpochMilli(0), Timestamp.ofEpochMilli(10));
|
121
125
|
}
|
122
126
|
|
123
127
|
@Test
|
124
128
|
public void testNull()
|
125
129
|
{
|
126
|
-
check(
|
127
|
-
|
128
|
-
|
130
|
+
check(Schema.builder()
|
131
|
+
.add("col3", DOUBLE)
|
132
|
+
.add("col1", STRING)
|
133
|
+
.add("col3", LONG)
|
134
|
+
.add("col3", BOOLEAN)
|
135
|
+
.add("col2", TIMESTAMP)
|
136
|
+
.build(),
|
137
|
+
null, null, null, null, null,
|
129
138
|
null, null, null, null, null);
|
130
139
|
}
|
131
140
|
|
132
141
|
@Test
|
133
142
|
public void testMixedTypes()
|
134
143
|
{
|
135
|
-
check(
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
144
|
+
check(Schema.builder()
|
145
|
+
.add("col3", DOUBLE)
|
146
|
+
.add("col1", STRING)
|
147
|
+
.add("col3", LONG)
|
148
|
+
.add("col3", BOOLEAN)
|
149
|
+
.add("col2", TIMESTAMP)
|
150
|
+
.build(),
|
151
|
+
8122.0, "val1", 3L, false, Timestamp.ofEpochMilli(0),
|
152
|
+
140.15, "val2", Long.MAX_VALUE, true, Timestamp.ofEpochMilli(10));
|
140
153
|
}
|
141
154
|
|
142
155
|
private void check(Schema schema, Object... objects)
|
@@ -218,12 +231,12 @@ public class TestPageBuilderReader
|
|
218
231
|
public void testEmptySchema()
|
219
232
|
{
|
220
233
|
MockPageOutput output = new MockPageOutput();
|
221
|
-
this.builder = new PageBuilder(bufferAllocator,
|
234
|
+
this.builder = new PageBuilder(bufferAllocator, Schema.builder().build(), output);
|
222
235
|
builder.addRecord();
|
223
236
|
builder.addRecord();
|
224
237
|
builder.flush();
|
225
238
|
builder.close();
|
226
|
-
this.reader = new PageReader(
|
239
|
+
this.reader = new PageReader(Schema.builder().build());
|
227
240
|
assertEquals(1, output.pages.size());
|
228
241
|
reader.setPage(output.pages.get(0));
|
229
242
|
assertTrue(reader.nextRecord());
|
@@ -250,8 +263,8 @@ public class TestPageBuilderReader
|
|
250
263
|
};
|
251
264
|
assertEquals(
|
252
265
|
9,
|
253
|
-
buildPages(
|
254
|
-
|
266
|
+
buildPages(Schema.builder().add("col1", LONG).build(),
|
267
|
+
0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L).size());
|
255
268
|
}
|
256
269
|
|
257
270
|
@Test
|
@@ -274,17 +287,22 @@ public class TestPageBuilderReader
|
|
274
287
|
assertEquals(
|
275
288
|
3,
|
276
289
|
buildPages(
|
277
|
-
|
278
|
-
|
279
|
-
|
290
|
+
Schema.builder()
|
291
|
+
.add("col1", LONG)
|
292
|
+
.add("col1", STRING)
|
293
|
+
.build(),
|
294
|
+
0L, "record0",
|
295
|
+
1L, "record1",
|
296
|
+
3L, "record3"
|
297
|
+
).size());
|
280
298
|
}
|
281
299
|
|
282
300
|
@Test
|
283
301
|
public void testRepeatableClose()
|
284
302
|
{
|
285
303
|
MockPageOutput output = new MockPageOutput();
|
286
|
-
this.builder = new PageBuilder(bufferAllocator,
|
287
|
-
"col1", STRING)), output);
|
304
|
+
this.builder = new PageBuilder(bufferAllocator,
|
305
|
+
Schema.builder().add("col1", STRING).build(), output);
|
288
306
|
builder.close();
|
289
307
|
builder.close();
|
290
308
|
}
|
@@ -293,8 +311,8 @@ public class TestPageBuilderReader
|
|
293
311
|
public void testRepeatableFlush()
|
294
312
|
{
|
295
313
|
MockPageOutput output = new MockPageOutput();
|
296
|
-
this.builder = new PageBuilder(bufferAllocator,
|
297
|
-
"col1", STRING)), output);
|
314
|
+
this.builder = new PageBuilder(bufferAllocator,
|
315
|
+
Schema.builder().add("col1", STRING).build(), output);
|
298
316
|
builder.flush();
|
299
317
|
builder.flush();
|
300
318
|
}
|