本文整理汇总了Java中org.apache.pig.PigServer.existsFile方法的典型用法代码示例。如果您正苦于以下问题:Java PigServer.existsFile方法的具体用法?Java PigServer.existsFile怎么用?Java PigServer.existsFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.PigServer
的用法示例。
在下文中一共展示了PigServer.existsFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPigServer
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testPigServer() throws Throwable {
log.debug("creating pig server");
PigContext pigContext = new PigContext(ExecType.MAPREDUCE, cluster.getProperties());
PigServer pig = new PigServer(pigContext);
System.out.println("testing capacity");
long capacity = pig.capacity();
assertTrue(capacity > 0);
String sampleFileName = "/tmp/fileTest";
if (!pig.existsFile(sampleFileName)) {
ElementDescriptor path = pigContext.getDfs().asElement(sampleFileName);
OutputStream os = path.create();
os.write("Ben was here!".getBytes());
os.close();
}
long length = pig.fileSize(sampleFileName);
assertTrue(length > 0);
}
示例2: testPigServer
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testPigServer() throws Throwable {
log.debug("creating pig server");
PigContext pigContext = new PigContext(cluster.getExecType(), cluster.getProperties());
PigServer pig = new PigServer(pigContext);
System.out.println("testing capacity");
long capacity = pig.capacity();
assertTrue(capacity > 0);
String sampleFileName = "/tmp/fileTest";
if (!pig.existsFile(sampleFileName)) {
ElementDescriptor path = pigContext.getDfs().asElement(sampleFileName);
OutputStream os = path.create();
os.write("Ben was here!".getBytes());
os.close();
}
long length = pig.fileSize(sampleFileName);
assertTrue(length > 0);
}