本文整理汇总了Java中org.apache.parquet.example.data.Group.add方法的典型用法代码示例。如果您正苦于以下问题:Java Group.add方法的具体用法?Java Group.add怎么用?Java Group.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.parquet.example.data.Group
的用法示例。
在下文中一共展示了Group.add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testArtSchema
import org.apache.parquet.example.data.Group; //导入方法依赖的package包/类
@Test
public void testArtSchema() throws ExecException, ParserException {
String pigSchemaString =
"DocId:long, " +
"Links:(Backward:{(long)}, Forward:{(long)}), " +
"Name:{(Language:{(Code:chararray,Country:chararray)}, Url:chararray)}";
SimpleGroup g = new SimpleGroup(getMessageType(pigSchemaString));
g.add("DocId", 1l);
Group links = g.addGroup("Links");
links.addGroup("Backward").addGroup("bag").add(0, 1l);
links.addGroup("Forward").addGroup("bag").add(0, 1l);
Group name = g.addGroup("Name").addGroup("bag");
name.addGroup("Language").addGroup("bag").append("Code", "en").append("Country", "US");
name.add("Url", "http://foo/bar");
testFromGroups(pigSchemaString, Arrays.<Group>asList(g));
}
示例2: createSourceData
import org.apache.parquet.example.data.Group; //导入方法依赖的package包/类
@Before
public void createSourceData() throws IOException {
this.file1 = newTemp();
this.file2 = newTemp();
ParquetWriter<Group> writer1 = ExampleParquetWriter.builder(file1)
.withType(FILE_SCHEMA)
.build();
ParquetWriter<Group> writer2 = ExampleParquetWriter.builder(file2)
.withType(FILE_SCHEMA)
.build();
for (int i = 0; i < FILE_SIZE; i += 1) {
Group group1 = GROUP_FACTORY.newGroup();
group1.add("id", i);
group1.add("string", UUID.randomUUID().toString());
writer1.write(group1);
file1content.add(group1);
Group group2 = GROUP_FACTORY.newGroup();
group2.add("id", FILE_SIZE+i);
group2.add("string", UUID.randomUUID().toString());
writer2.write(group2);
file2content.add(group2);
}
writer1.close();
writer2.close();
}
示例3: map
import org.apache.parquet.example.data.Group; //导入方法依赖的package包/类
@Override
protected void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
// writes each character of the line with a UUID
String line = value.toString();
for (int i = 0; i < line.length(); i += 1) {
Group group = GROUP_FACTORY.newGroup();
group.add(0, Binary.fromString(UUID.randomUUID().toString()));
group.add(1, Binary.fromString(line.substring(i, i+1)));
context.write(null, group);
}
}
示例4: createDataFile
import org.apache.parquet.example.data.Group; //导入方法依赖的package包/类
@Before
public void createDataFile() throws Exception {
File file = temp.newFile("test.parquet");
this.path = new Path(file.toString());
MessageType type = Types.buildMessage()
.required(INT64).named("id")
.required(BINARY).as(UTF8).named("data")
.named("test");
SimpleGroupFactory factory = new SimpleGroupFactory(type);
ParquetWriter<Group> writer = ExampleParquetWriter.builder(path)
.withWriteMode(ParquetFileWriter.Mode.OVERWRITE)
.withType(type)
.build();
try {
for (long i = 0; i < 1000; i += 1) {
Group g = factory.newGroup();
g.add(0, i);
g.add(1, "data-" + i);
writer.write(g);
}
} finally {
writer.close();
}
}