本文整理了Java中org.kitesdk.data.Dataset.newReader()
方法的一些代码示例,展示了Dataset.newReader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dataset.newReader()
方法的具体详情如下:
包路径:org.kitesdk.data.Dataset
类名称:Dataset
方法名:newReader
暂无
代码示例来源:origin: kite-sdk/kite
@Override
public void run() {
dataset.newReader();
}
});
代码示例来源:origin: kite-sdk/kite
@Override
public DatasetReader<GenericRecord> newReader() throws IOException {
return readerDataset.newReader();
}
代码示例来源:origin: kite-sdk/kite
@Override
public DatasetReader<TestGenericRecord> newReader() throws IOException {
return readerDataset.newReader();
}
代码示例来源:origin: kite-sdk/kite
@Override
public DatasetReader<GenericRecord> newReader() throws IOException {
return readerDataset.newReader();
}
代码示例来源:origin: kite-sdk/kite
@Override
public DatasetReader<GenericData.Record> newReader() throws IOException {
return readerDataset.newReader();
}
代码示例来源:origin: kite-sdk/kite
@Override
public DatasetReader<GenericRecord> newReader() throws IOException {
return readerDataset.newReader();
}
代码示例来源:origin: kite-sdk/kite-examples
@Override
public int run(String[] args) throws Exception {
// Load the users dataset
Dataset<Record> users = Datasets.load(
"dataset:hive?dataset=users", Record.class);
// Get a reader for the dataset and read all the users
DatasetReader<Record> reader = null;
try {
reader = users.newReader();
for (GenericRecord user : users.newReader()) {
System.out.println(user);
}
} finally {
if (reader != null) {
reader.close();
}
}
return 0;
}
代码示例来源:origin: kite-sdk/kite-examples
@Override
public int run(String[] args) throws Exception {
// Load the events dataset
Dataset<GenericRecord> events = Datasets.load("dataset:hive:/tmp/data/default/events");
// Get a reader for the dataset and read all the events
DatasetReader<GenericRecord> reader = events.newReader();
try {
for (GenericRecord event : reader) {
System.out.println(event);
}
} finally {
reader.close();
}
return 0;
}
代码示例来源:origin: kite-sdk/kite-examples
@Override
public int run(String[] args) throws Exception {
Dataset<Record> movies = Datasets.load(
"dataset:hdfs:/tmp/data/movies", Record.class);
DatasetReader<Record> reader = null;
try {
reader = movies.newReader();
for (Record rec : reader) {
System.err.println("Movie: " + rec);
}
} finally {
if (reader != null) {
reader.close();
}
}
return 0;
}
代码示例来源:origin: kite-sdk/kite-examples
@Override
public int run(String[] args) throws Exception {
// Load the products dataset
Dataset<Product> products = Datasets.load(
"dataset:hdfs:/tmp/data/products", Product.class);
// Get a reader for the dataset and read all the users
DatasetReader<Product> reader = null;
try {
reader = products.newReader();
for (Product product : reader) {
System.out.println(product);
}
} finally {
if (reader != null) {
reader.close();
}
}
return 0;
}
代码示例来源:origin: kite-sdk/kite-examples
@Override
public int run(String[] args) throws Exception {
// Load the users dataset
Dataset<Record> users = Datasets.load(
"dataset:hdfs:/tmp/data/users", Record.class);
// Get a reader for the dataset and read all the users
DatasetReader<Record> reader = null;
try {
reader = users.newReader();
for (GenericRecord user : reader) {
System.out.println(user);
}
} finally {
if (reader != null) {
reader.close();
}
}
return 0;
}
代码示例来源:origin: org.springframework.data/spring-data-hadoop-store
private <T> Collection<T> readPojo(Class<T> targetClass, ViewCallback viewCallback) {
Dataset<T> dataset = DatasetUtils.getDataset(dsFactory, targetClass);
if (dataset == null) {
throw new StoreException("Unable to locate dataset for target class " + targetClass.getName());
}
DatasetReader<T> reader = null;
if (viewCallback == null) {
reader = dataset.newReader();
} else {
RefinableView<T> view = viewCallback.doInView(dataset, targetClass);
if (view != null) {
reader = view.newReader();
}
}
List<T> results = new ArrayList<T>();
if (reader != null) {
try {
for (T r : reader) {
results.add(r);
}
}
finally {
reader.close();
}
}
return results;
}
代码示例来源:origin: org.springframework.data/spring-data-hadoop-store
DatasetReader<GenericRecord> reader = null;
if (viewCallback == null) {
reader = dataset.newReader();
} else {
RefinableView<GenericRecord> view = viewCallback.doInView(dataset, GenericRecord.class);
代码示例来源:origin: kite-sdk/kite
public static void checkTestUsers(Dataset<GenericData.Record> ds, int count, int start, final String... fields) {
final Set<String> usernames = Sets.newHashSet();
for (int i = start; i < count + start; i++) {
usernames.add("test-" + i);
}
checkReaderBehavior(ds.newReader(), count,
new RecordValidator<GenericData.Record>() {
@Override
public void validate(GenericData.Record record, int recordNum) {
String username = record.get("username").toString();
Assert.assertTrue("Username not found: " + username, usernames.remove(username));
for (String field : fields) {
Assert.assertNotNull("Field is null: " + field + ", record: " + record,
record.get(field));
}
}
});
Assert.assertTrue(usernames.isEmpty());
}
代码示例来源:origin: org.springframework.data/spring-data-hadoop-store
@Override
protected DatasetReader<T> createReader() {
Dataset<T> dataset = DatasetUtils.getOrCreateDataset(getDatasetRepositoryFactory(), getDatasetDefinition(),
getEntityClass(), getEntityClass());
return dataset.newReader();
}
代码示例来源:origin: kite-sdk/kite
private void checkOutput(boolean existingPresent) {
DatasetReader<GenericData.Record> reader = outputDataset.newReader();
Map<String, Integer> counts = new HashMap<String, Integer>();
for (GenericData.Record record : reader) {
counts.put(record.get("name").toString(), (Integer) record.get("count"));
}
reader.close();
Assert.assertEquals(3, counts.get("apple").intValue());
Assert.assertEquals(2, counts.get("banana").intValue());
Assert.assertEquals(1, counts.get("carrot").intValue());
if (existingPresent) {
Assert.assertEquals(4, counts.get("date").intValue());
} else {
Assert.assertNull(counts.get("date"));
}
}
代码示例来源:origin: org.springframework.data/spring-data-hadoop-store
private <T> void readWithCallback(Class<T> targetClass, RecordCallback<T> callback, ViewCallback viewCallback) {
Dataset<T> dataset = DatasetUtils.getDataset(dsFactory, targetClass);
if (dataset == null) {
throw new StoreException("Unable to locate dataset for target class " + targetClass.getName());
}
DatasetReader<T> reader = null;
if (viewCallback == null) {
reader = dataset.newReader();
} else {
RefinableView<T> view = viewCallback.doInView(dataset, targetClass);
if (view != null) {
reader = view.newReader();
}
}
if (reader != null) {
try {
for (T t : reader) {
callback.doInRecord(t);
}
} finally {
reader.close();
}
}
}
代码示例来源:origin: org.springframework.data/spring-data-hadoop-store
@Override
protected DatasetReader<GenericRecord> createReader() {
Dataset<GenericRecord> dataset = DatasetUtils.getOrCreateDataset(getDatasetRepositoryFactory(),
getDatasetDefinition(), getEntityClass(), GenericRecord.class);
schema = dataset.getDescriptor().getSchema();
return dataset.newReader();
}
代码示例来源:origin: kite-sdk/kite-examples
reader = hellos.newReader();
代码示例来源:origin: kite-sdk/kite
DatasetReader<GenericRecord> reader = outputDataset.newReader();
try {
for (GenericRecord entity : reader) {
内容来源于网络,如有侵权,请联系作者删除!