public static Map<String, String> addFactColStartTimePropertyToFactProperties(XFactTable fact) { Map<String, String> props = new HashMap<String, String>(); props.putAll(JAXBUtils.mapFromXProperties(fact.getProperties())); props.putAll(JAXBUtils.columnStartAndEndTimeFromXColumns(fact.getColumns())); return props; }
public static Map<String, String> addFactColStartTimePropertyToFactProperties(XFactTable fact) { Map<String, String> props = new HashMap<String, String>(); props.putAll(JAXBUtils.mapFromXProperties(fact.getProperties())); props.putAll(JAXBUtils.columnStartAndEndTimeFromXColumns(fact.getColumns())); return props; }
public static Segmentation segmentationFromXSegmentation(XSegmentation seg) throws LensException { Map<String, String> props = new HashMap<>(); // Skip properties with keyword internal. These properties are internal to lens // and users are not supposed to see them. for(String prop : mapFromXProperties(seg.getProperties()).keySet()) { if (!(prop.toLowerCase().startsWith(MetastoreConstants.SEGMENTATION_KEY_PFX))) { props.put(prop, mapFromXProperties(seg.getProperties()).get(prop)); } } return new Segmentation(seg.getCubeName(), seg.getName(), segmentsFromXSegments(seg.getSegements()), seg.getWeight(), props); }
public static Storage storageFromXStorage(XStorage xs) { if (xs == null) { return null; } Storage storage; try { Class<?> clazz = Class.forName(xs.getClassname()); Constructor<?> constructor = clazz.getConstructor(String.class); storage = (Storage) constructor.newInstance(xs.getName()); storage.addProperties(mapFromXProperties(xs.getProperties())); return storage; } catch (Exception e) { log.error("Could not create storage class" + xs.getClassname() + "with name:" + xs.getName(), e); throw new WebApplicationException(e); } }
public static CubeVirtualFactTable cubeVirtualFactFromFactTable(XVirtualFactTable fact, FactTable sourceFactTable) throws LensException { Optional<Double> optionalWeight = Optional.fromNullable(fact.getWeight()); return new CubeVirtualFactTable(fact.getCubeName(), fact.getName(), optionalWeight, mapFromXProperties(fact.getProperties()), sourceFactTable); }
public static CubeVirtualFactTable cubeVirtualFactFromFactTable(XVirtualFactTable fact, FactTable sourceFactTable) throws LensException { Optional<Double> optionalWeight = Optional.fromNullable(fact.getWeight()); return new CubeVirtualFactTable(fact.getCubeName(), fact.getName(), optionalWeight, mapFromXProperties(fact.getProperties()), sourceFactTable); }
public static void updatePartitionFromXPartition(Partition partition, XPartition xp) throws ClassNotFoundException { partition.getParameters().putAll(mapFromXProperties(xp.getPartitionParameters())); partition.getTPartition().getSd().getSerdeInfo().setParameters(mapFromXProperties(xp.getSerdeParameters())); partition.setLocation(xp.getLocation()); if (xp.getInputFormat() != null) { partition.setInputFormatClass(Class.forName(xp.getInputFormat()).asSubclass(InputFormat.class)); } if (xp.getOutputFormat() != null) { Class<? extends HiveOutputFormat> outputFormatClass = Class.forName(xp.getOutputFormat()).asSubclass(HiveOutputFormat.class); partition.setOutputFormatClass(outputFormatClass); } partition.getParameters().put(MetastoreConstants.PARTITION_UPDATE_PERIOD, xp.getUpdatePeriod().name()); partition.getTPartition().getSd().getSerdeInfo().setSerializationLib(xp.getSerdeClassname()); }
public static void updatePartitionFromXPartition(Partition partition, XPartition xp) throws ClassNotFoundException { partition.getParameters().putAll(mapFromXProperties(xp.getPartitionParameters())); partition.getTPartition().getSd().getSerdeInfo().setParameters(mapFromXProperties(xp.getSerdeParameters())); partition.setLocation(xp.getLocation()); if (xp.getInputFormat() != null) { partition.setInputFormatClass(Class.forName(xp.getInputFormat()).asSubclass(InputFormat.class)); } if (xp.getOutputFormat() != null) { Class<? extends HiveOutputFormat> outputFormatClass = Class.forName(xp.getOutputFormat()).asSubclass(HiveOutputFormat.class); partition.setOutputFormatClass(outputFormatClass); } partition.getParameters().put(MetastoreConstants.PARTITION_UPDATE_PERIOD, xp.getUpdatePeriod().name()); partition.getTPartition().getSd().getSerdeInfo().setSerializationLib(xp.getSerdeClassname()); }
public static ExprColumn hiveExprColumnFromXExprColumn(XExprColumn xe) throws LensException { ExprColumn ec = new ExprColumn(new FieldSchema(xe.getName(), xe.getType().toLowerCase(), xe.getDescription()), xe.getDisplayString(), mapFromXProperties(xe.getTags()), exprSpecFromXExprColumn(xe.getExprSpec())); return ec; }
public void createSegmentation(XSegmentation cubeSeg) throws LensException { createSegmentation( cubeSeg.getCubeName(), cubeSeg.getName(), JAXBUtils.segmentsFromXSegments(cubeSeg.getSegements()), cubeSeg.getWeight(), JAXBUtils.mapFromXProperties(cubeSeg.getProperties())); }
public void createSegmentation(XSegmentation cubeSeg) throws LensException { createSegmentation( cubeSeg.getCubeName(), cubeSeg.getName(), JAXBUtils.segmentsFromXSegments(cubeSeg.getSegements()), cubeSeg.getWeight(), JAXBUtils.mapFromXProperties(cubeSeg.getProperties())); } public void createSegmentation(Segmentation cubeSeg)
public static ExprColumn hiveExprColumnFromXExprColumn(XExprColumn xe) throws LensException { ExprColumn ec = new ExprColumn(new FieldSchema(xe.getName(), xe.getType().toLowerCase(), xe.getDescription()), xe.getDisplayString(), mapFromXProperties(xe.getTags()), exprSpecFromXExprColumn(xe.getExprSpec())); return ec; }
public void createCubeDimensionTable(XDimensionTable xDimTable) throws LensException { List<FieldSchema> columns = JAXBUtils.fieldSchemaListFromColumns(xDimTable.getColumns()); Map<String, UpdatePeriod> updatePeriodMap = JAXBUtils.dumpPeriodsFromStorageTables(xDimTable.getStorageTables()); Map<String, String> properties = JAXBUtils.mapFromXProperties(xDimTable.getProperties()); Map<String, StorageTableDesc> storageDesc = JAXBUtils.tableDescPrefixMapFromXStorageTables( xDimTable.getStorageTables()); log.info("# Columns: " + columns); createCubeDimensionTable(xDimTable.getDimensionName(), xDimTable.getTableName(), columns, xDimTable.getWeight(), updatePeriodMap, properties, storageDesc); } /**
public void createCubeDimensionTable(XDimensionTable xDimTable) throws LensException { List<FieldSchema> columns = JAXBUtils.fieldSchemaListFromColumns(xDimTable.getColumns()); Map<String, UpdatePeriod> updatePeriodMap = JAXBUtils.dumpPeriodsFromStorageTables(xDimTable.getStorageTables()); Map<String, String> properties = JAXBUtils.mapFromXProperties(xDimTable.getProperties()); Map<String, StorageTableDesc> storageDesc = JAXBUtils.tableDescPrefixMapFromXStorageTables( xDimTable.getStorageTables()); log.info("# Columns: " + columns); createCubeDimensionTable(xDimTable.getDimensionName(), xDimTable.getTableName(), columns, xDimTable.getWeight(), updatePeriodMap, properties, storageDesc); }
public static CubeDimensionTable cubeDimTableFromDimTable(XDimensionTable dimensionTable) throws LensException { return new CubeDimensionTable(dimensionTable.getDimensionName(), dimensionTable.getTableName(), fieldSchemaListFromColumns(dimensionTable.getColumns()), dimensionTable.getWeight(), dumpPeriodsFromStorageTables(dimensionTable.getStorageTables()), mapFromXProperties(dimensionTable.getProperties())); }
public static CubeDimensionTable cubeDimTableFromDimTable(XDimensionTable dimensionTable) throws LensException { return new CubeDimensionTable(dimensionTable.getDimensionName(), dimensionTable.getTableName(), fieldSchemaListFromColumns(dimensionTable.getColumns()), dimensionTable.getWeight(), dumpPeriodsFromStorageTables(dimensionTable.getStorageTables()), mapFromXProperties(dimensionTable.getProperties())); }
public static CubeFactTable cubeFactFromFactTable(XFactTable fact) throws LensException { List<FieldSchema> columns = fieldSchemaListFromColumns(fact.getColumns()); Map<String, Set<UpdatePeriod>> storageUpdatePeriods = getFactUpdatePeriodsFromStorageTables( fact.getStorageTables()); Map<String, Map<UpdatePeriod, String>> storageTablePrefixMap = storageTablePrefixMapOfStorage( fact.getStorageTables()); return new CubeFactTable(fact.getCubeName(), fact.getName(), columns, storageUpdatePeriods, fact.getWeight(), mapFromXProperties(fact.getProperties()), storageTablePrefixMap); }
public static StoragePartitionDesc storagePartSpecFromXPartition( XPartition xpart) { StoragePartitionDesc partDesc = new StoragePartitionDesc( xpart.getFactOrDimensionTableName(), timePartSpecfromXTimePartSpec(xpart.getTimePartitionSpec()), nonTimePartSpecfromXNonTimePartSpec(xpart.getNonTimePartitionSpec()), UpdatePeriod.valueOf(xpart.getUpdatePeriod().name())); partDesc.setPartParams(mapFromXProperties(xpart.getPartitionParameters())); partDesc.setSerdeParams(mapFromXProperties(xpart.getSerdeParameters())); partDesc.setLocation(xpart.getLocation()); partDesc.setInputFormat(xpart.getInputFormat()); partDesc.setOutputFormat(xpart.getOutputFormat()); partDesc.setSerializationLib(xpart.getSerdeClassname()); return partDesc; }
public static StoragePartitionDesc storagePartSpecFromXPartition( XPartition xpart) { StoragePartitionDesc partDesc = new StoragePartitionDesc( xpart.getFactOrDimensionTableName(), timePartSpecfromXTimePartSpec(xpart.getTimePartitionSpec()), nonTimePartSpecfromXNonTimePartSpec(xpart.getNonTimePartitionSpec()), UpdatePeriod.valueOf(xpart.getUpdatePeriod().name())); partDesc.setPartParams(mapFromXProperties(xpart.getPartitionParameters())); partDesc.setSerdeParams(mapFromXProperties(xpart.getSerdeParameters())); partDesc.setLocation(xpart.getLocation()); partDesc.setInputFormat(xpart.getInputFormat()); partDesc.setOutputFormat(xpart.getOutputFormat()); partDesc.setSerializationLib(xpart.getSerdeClassname()); return partDesc; }
public static CubeFactTable cubeFactFromFactTable(XFactTable fact) throws LensException { List<FieldSchema> columns = fieldSchemaListFromColumns(fact.getColumns()); Map<String, Set<UpdatePeriod>> storageUpdatePeriods = getFactUpdatePeriodsFromStorageTables(fact.getStorageTables()); Map<String, Map<UpdatePeriod, String>> storageTablePrefixMap = storageTablePrefixMapOfStorage(fact.getStorageTables()); Map<String, Set<String>> storageTablePartitionColumns = getStorageTablePartitionColumnsFromTableDescs(fact.getStorageTables()); return new CubeFactTable(fact.getCubeName(), fact.getName(), columns, storageUpdatePeriods, fact.getWeight(), mapFromXProperties(fact.getProperties()), storageTablePrefixMap, storageTablePartitionColumns); }