public Segmentation getSegmentation(String segName) throws LensException { return getSegmentation(segName, true); } public Segmentation getSegmentation(String segName, boolean throwException) throws LensException {
public Segmentation getSegmentation(String segName) throws LensException { return getSegmentation(segName, true); }
/** * Get all segmentations in metastore * * @return List of segmentation objects * @throws LensException */ public Collection<Segmentation> getAllSegmentations() throws LensException { if (!allSegmentationPopulated) { List<Segmentation> segs = new ArrayList<>(); try { for (String table : getAllHiveTableNames()) { Segmentation seg = getSegmentation(table, false); if (seg != null) { segs.add(seg); } } } catch (HiveException e) { throw new LensException("Could not get all fact tables", e); } allFactTablesPopulated = enableCaching; return segs; } else { return allSegmentations.values(); } }
/** * Get all segmentations in metastore * * @return List of segmentation objects * @throws LensException */ public Collection<Segmentation> getAllSegmentations() throws LensException { if (!allSegmentationPopulated) { List<Segmentation> segs = new ArrayList<>(); try { for (String table : getAllHiveTableNames()) { Segmentation seg = getSegmentation(table, false); if (seg != null) { segs.add(seg); } } } catch (HiveException e) { throw new LensException("Could not get all fact tables", e); } allFactTablesPopulated = enableCaching; return segs; } else { return allSegmentations.values(); } }
/** * * @param baseCubeName The cube name ot which segmentation belong to * @param segmentationName The segmentation name * @param segments Participating cube segements * @param weight Weight of segmentation * @param properties Properties of segmentation * @throws LensException */ public void createSegmentation(String baseCubeName, String segmentationName, Set<Segment> segments, double weight, Map<String, String> properties) throws LensException { Segmentation cubeSeg = new Segmentation(baseCubeName, segmentationName, segments, weight, properties); createSegmentation(cubeSeg); // do a get to update cache getSegmentation(segmentationName); }
/** * * @param baseCubeName The cube name ot which segmentation belong to * @param segmentationName The segmentation name * @param segments Participating cube segements * @param weight Weight of segmentation * @param properties Properties of segmentation * @throws LensException */ public void createSegmentation(String baseCubeName, String segmentationName, Set<Segment> segments, double weight, Map<String, String> properties) throws LensException { Segmentation cubeSeg = new Segmentation(baseCubeName, segmentationName, segments, weight, properties); createSegmentation(cubeSeg); // do a get to update cache getSegmentation(segmentationName); }
@Override public XSegmentation getSegmentation(LensSessionHandle sessionid, String cubeSegName) throws LensException { try (SessionContext ignored = new SessionContext(sessionid)){ CubeMetastoreClient msClient = getClient(sessionid); Segmentation cubeSeg = msClient.getSegmentation(cubeSegName); return JAXBUtils.xsegmentationFromSegmentation(cubeSeg); } }
public void alterSegmentation(String segName, Segmentation seg) throws HiveException, LensException { getTableWithTypeFailFast(segName, CubeTableType.SEGMENTATION); if (!(getSegmentation(segName) == seg)) { dropSegmentation(segName); createSegmentation(seg); updateSegmentationCache(segName); } }
public void alterSegmentation(String segName, Segmentation seg) throws HiveException, LensException { getTableWithTypeFailFast(segName, CubeTableType.SEGMENTATION); checkIfAuthorized(); if (!(getSegmentation(segName) == seg)) { dropSegmentation(segName); createSegmentation(seg); updateSegmentationCache(segName); } }
assertEquals(client.getSegmentation(segmentName).getSegments().size(), 3); client.alterSegmentation(segmentName, segmentation); assertNotNull(client.getSegmentation(segmentName)); assertEquals(client.getSegmentation(segmentName).getSegments().size(), 4); assertEquals(client.getSegmentation(segmentName).getBaseCube(), "segCubeAltered"); assertEquals(client.getSegmentation(segmentName).weight(), 100.0); assertEquals(client.getSegmentation(segmentName).getSegments().size(), 3);