本文整理了Java中org.apache.lens.api.metastore.XPartition.setLocation()
方法的一些代码示例,展示了XPartition.setLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XPartition.setLocation()
方法的具体详情如下:
包路径:org.apache.lens.api.metastore.XPartition
类名称:XPartition
方法名:setLocation
[英]Sets the value of the location property.
[中]设置location属性的值。
代码示例来源:origin: apache/lens
public XPartition withLocation(String value) {
setLocation(value);
return this;
}
代码示例来源:origin: org.apache.lens/lens-api
public XPartition withLocation(String value) {
setLocation(value);
return this;
}
代码示例来源:origin: apache/lens
private void createFactPartition(String fileName, String fact, String storage) throws JAXBException, IOException {
XPartition partition = (XPartition) SampleMetastore.readFromXML(fileName);
String partLocation = partition.getLocation();
if (!partLocation.startsWith("/")) {
partition.setLocation("file://" + System.getProperty("lens.home") + "/" + partLocation);
}
result = metaClient.addPartitionToFactTable(fact, storage, partition);
if (result.getStatus().equals(APIResult.Status.FAILED)) {
System.err.println("Adding partition from:" + fileName + " failed");
retCode = 1;
} else {
System.out.println("Added partition from:" + fileName);
}
}
代码示例来源:origin: apache/lens
private void createDimTablePartition(String fileName, String dimTable, String storage)
throws JAXBException, IOException {
XPartition partition = (XPartition) SampleMetastore.readFromXML(fileName);
String partLocation = partition.getLocation();
if (!partLocation.startsWith("/")) {
partition.setLocation("file://" + System.getProperty("lens.home") + "/" + partLocation);
}
result = metaClient.addPartitionToDimensionTable(dimTable, storage, partition);
if (result.getStatus().equals(APIResult.Status.FAILED)) {
System.err.println("Adding partition from:"+ fileName + " failed");
retCode = 1;
} else {
System.out.println("Added partition from:" + fileName);
}
}
代码示例来源:origin: apache/lens
private void createFactPartitions(String fileName, String fact, String storage) throws JAXBException, IOException {
XPartitionList partitionList = (XPartitionList) SampleMetastore.readFromXML(fileName);
for (XPartition partition : partitionList.getPartition()) {
String partLocation = partition.getLocation();
if (!partLocation.startsWith("/")) {
partition.setLocation("file://" + System.getProperty("lens.home") + "/" + partLocation);
}
}
result = metaClient.addPartitionsToFactTable(fact, storage, partitionList);
if (result.getStatus().equals(APIResult.Status.FAILED)) {
System.err.println("Adding partitions from:" + fileName + " failed");
retCode = 1;
} else {
System.out.println("Added partitions from:" + fileName);
}
}
代码示例来源:origin: apache/lens
private void createDimTablePartitions(String fileName, String dimTable, String storage)
throws JAXBException, IOException {
XPartitionList partitionList = (XPartitionList) SampleMetastore.readFromXML(fileName);
for (XPartition partition : partitionList.getPartition()) {
String partLocation = partition.getLocation();
if (!partLocation.startsWith("/")) {
partition.setLocation("file://" + System.getProperty("lens.home") + "/" + partLocation);
}
}
result = metaClient.addPartitionsToDimensionTable(dimTable, storage, partitionList);
if (result.getStatus().equals(APIResult.Status.FAILED)) {
System.err.println("Adding partitions from:" + fileName + " failed");
retCode = 1;
} else {
System.out.println("Added partitions from:" + fileName);
}
}
代码示例来源:origin: apache/lens
/**
* Sets up query command instances and adds partitions to a table.
* @throws Exception
*/
@BeforeClass
public void setup() throws Exception {
LensClient client = new LensClient();
LensCubeCommands command = new LensCubeCommands();
command.setClient(client);
log.debug("Starting to test cube commands");
URL cubeSpec = TestLensQueryCommands.class.getClassLoader().getResource("schema/cubes/base/sample-cube.xml");
command.createCube(new File(cubeSpec.toURI()));
TestLensDimensionCommands.createDimension();
TestLensDimensionTableCommands.addDim1Table("dim_table", "schema/dimtables/dim_table.xml", "local");
// Add partition
URL dataDir = TestLensQueryCommands.class.getClassLoader().getResource("dim2-part");
XPartition xp = new XPartition();
xp.setFactOrDimensionTableName("dim_table");
xp.setLocation(new Path(dataDir.toURI()).toString());
xp.setUpdatePeriod(XUpdatePeriod.HOURLY);
XTimePartSpec timePart = new XTimePartSpec();
XTimePartSpecElement partElement = new XTimePartSpecElement();
partElement.setKey("dt");
partElement.setValue(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
timePart.getPartSpecElement().add(partElement);
xp.setTimePartitionSpec(timePart);
APIResult result = client.addPartitionToDim("dim_table", "local", xp);
assertEquals(result.getStatus(), APIResult.Status.SUCCEEDED);
}
代码示例来源:origin: apache/lens
private XPartition createPartition(String cubeTableName, final List<XTimePartSpecElement>
timePartSpecs, String updatePeriod) {
XPartition xp = cubeObjectFactory.createXPartition();
xp.setLocation(new Path(new File("target").getAbsolutePath(), "part/test_part").toString());
xp.setFactOrDimensionTableName(cubeTableName);
xp.setNonTimePartitionSpec(new XPartSpec());
xp.setTimePartitionSpec(new XTimePartSpec());
xp.setPartitionParameters(new XProperties());
xp.setSerdeParameters(new XProperties());
for (XTimePartSpecElement timePartSpec : timePartSpecs) {
xp.getTimePartitionSpec().getPartSpecElement().add(timePartSpec);
}
if (updatePeriod==null) {
xp.setUpdatePeriod(XUpdatePeriod.HOURLY);
} else {
XUpdatePeriod updatePeriod1=XUpdatePeriod.valueOf(updatePeriod.toUpperCase());
xp.setUpdatePeriod(updatePeriod1);
}
return xp;
}
代码示例来源:origin: org.apache.lens/lens-cube
xp.setSerdeParameters(new XProperties());
xp.setName(p.getCompleteName());
xp.setLocation(p.getLocation());
xp.setInputFormat(p.getInputFormatClass().getCanonicalName());
xp.setOutputFormat(p.getOutputFormatClass().getCanonicalName());
代码示例来源:origin: apache/lens
xp.setSerdeParameters(new XProperties());
xp.setName(p.getCompleteName());
xp.setLocation(p.getLocation());
xp.setInputFormat(p.getInputFormatClass().getCanonicalName());
xp.setOutputFormat(p.getOutputFormatClass().getCanonicalName());
代码示例来源:origin: apache/lens
assertEquals(partAddResult.getStatus(), Status.FAILED);
xp.setLocation(xp.getLocation() + "/a/b/c");
APIResult partUpdateResult = target().path("metastore/facts/").path(table).path("storages/S1/partition")
.queryParam("sessionid", lensSessionId).request(mediaType)
代码示例来源:origin: apache/lens
XPartition xp = new XPartition();
xp.setFactOrDimensionTableName("dim_table");
xp.setLocation(new File("target/test-classes/dim2-part").getAbsolutePath());
xp.setUpdatePeriod(XUpdatePeriod.HOURLY);
XTimePartSpec timePart = new XTimePartSpec();
代码示例来源:origin: apache/lens
xp.setLocation(xp.getLocation() + "/a/b/c");
APIResult partUpdateResult = target().path("metastore/dimtables/").path(table).path("storages/test/partition")
.queryParam("sessionid", lensSessionId).request(mediaType)
代码示例来源:origin: apache/lens
assertEquals(partAddResult.getStatus(), Status.FAILED);
xp.setLocation(xp.getLocation() + "/a/b/c");
APIResult partUpdateResult = target().path("metastore/facts/").path(table).path("storages/S2/partition")
.queryParam("sessionid", lensSessionId)
内容来源于网络,如有侵权,请联系作者删除!