public XPartition withLocation(String value) { setLocation(value); return this; }
public XPartition withLocation(String value) { setLocation(value); return this; }
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); } }
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); } }
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); } }
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); } }
/** * 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); }
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; }
xp.setSerdeParameters(new XProperties()); xp.setName(p.getCompleteName()); xp.setLocation(p.getLocation()); xp.setInputFormat(p.getInputFormatClass().getCanonicalName()); xp.setOutputFormat(p.getOutputFormatClass().getCanonicalName());
xp.setSerdeParameters(new XProperties()); xp.setName(p.getCompleteName()); xp.setLocation(p.getLocation()); xp.setInputFormat(p.getInputFormatClass().getCanonicalName()); xp.setOutputFormat(p.getOutputFormatClass().getCanonicalName());
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)
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();
xp.setLocation(xp.getLocation() + "/a/b/c"); APIResult partUpdateResult = target().path("metastore/dimtables/").path(table).path("storages/test/partition") .queryParam("sessionid", lensSessionId).request(mediaType)
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)