public static FieldSchema fieldSchemaFromColumn(XColumn c) { if (c == null) { return null; } return new FieldSchema(c.getName(), c.getType().toLowerCase(), c.getComment()); }
public XColumn withComment(String value) { setComment(value); return this; }
public XColumn withName(String value) { setName(value); return this; }
public static Map<String, String> columnStartAndEndTimeFromXColumns(XColumns columns) { if (columns != null && !columns.getColumn().isEmpty()) { Map<String, String> colStartTimeMap = new HashMap<String, String>(); for (XColumn c : columns.getColumn()) { if (!(c.getStartTime() == null)) { colStartTimeMap.put(MetastoreConstants.FACT_COL_START_TIME_PFX.concat(c.getName()), c.getStartTime()); } if (!(c.getEndTime() == null)) { colStartTimeMap.put(MetastoreConstants.FACT_COL_END_TIME_PFX.concat(c.getName()), c.getEndTime()); } } return colStartTimeMap; } return null; }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { { String theName; theName = this.getName(); strategy.appendField(locator, this, "name", buffer, theName); } { String theType; theType = this.getType(); strategy.appendField(locator, this, "type", buffer, theType); } { String theComment; theComment = this.getComment(); strategy.appendField(locator, this, "comment", buffer, theComment); } { String theStartTime; theStartTime = this.getStartTime(); strategy.appendField(locator, this, "startTime", buffer, theStartTime); } { String theEndTime; theEndTime = this.getEndTime(); strategy.appendField(locator, this, "endTime", buffer, theEndTime); } return buffer; }
c.setName("col3"); c.setType("STRING"); c.setComment("Added column"); dt2.getColumns().getColumn().add(c); boolean foundCol = false; for (XColumn col : colList) { if (col.getName().equals("col3") && col.getType().equals("string") && "Added column".equalsIgnoreCase(col.getComment())) { foundCol = true; break;
public static XColumn columnFromFieldSchema(FieldSchema fs) { if (fs == null) { return null; } XColumn c = XCF.createXColumn(); c.setName(fs.getName()); c.setType(fs.getType()); c.setComment(fs.getComment()); return c; }
private XFactTable createFactTable(String factName, final String cubeName) { XFactTable f = cubeObjectFactory.createXFactTable(); f.setColumns(new XColumns()); f.setProperties(new XProperties()); f.setStorageTables(new XStorageTables()); f.setName(factName); f.setWeight(10.0); f.setCubeName(cubeName); XColumn c1 = cubeObjectFactory.createXColumn(); c1.setName("c1"); c1.setType("STRING"); c1.setComment("col1"); f.getColumns().getColumn().add(c1); XColumn c2 = cubeObjectFactory.createXColumn(); c2.setName("c2"); c2.setType("STRING"); c2.setComment("col2"); f.getColumns().getColumn().add(c2); XColumn c3 = cubeObjectFactory.createXColumn(); c3.setName("c3"); c3.setType("STRING"); c3.setComment("col3"); c3.setStartTime("2016-01-01"); c3.setEndTime("2017-01-01"); f.getColumns().getColumn().add(c3); Map<String, String> properties = LensUtil.getHashMap("foo", "bar"); f.getProperties().getProperty().addAll(JAXBUtils.xPropertiesFromMap(properties)); return f; }
public XColumn withType(String value) { setType(value); return this; }
public static Map<String, Set<String>> getStorageTablePartitionColumnsFromTableDescs(XStorageTables storageTables) { Map<String, Set<String>> storageTablePartitionColumns = new HashMap<>(); if (storageTables != null && !storageTables.getStorageTable().isEmpty()) { for (XStorageTableElement xStorageTableElement : storageTables.getStorageTable()) { Set<String> partitionColumns = new HashSet<>(); if (xStorageTableElement.getTableDesc() != null && xStorageTableElement.getTableDesc().getPartCols() != null) { for (XColumn xColumn : xStorageTableElement.getTableDesc().getPartCols().getColumn()) { partitionColumns.add(xColumn.getName()); } } storageTablePartitionColumns.put(xStorageTableElement.getStorageName(), partitionColumns); } } return storageTablePartitionColumns; }
/** * Create an instance of {@link XColumn } * */ public XColumn createXColumn() { return new XColumn(); }
public XColumn withEndTime(String value) { setEndTime(value); return this; }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { { String theName; theName = this.getName(); strategy.appendField(locator, this, "name", buffer, theName); } { String theType; theType = this.getType(); strategy.appendField(locator, this, "type", buffer, theType); } { String theComment; theComment = this.getComment(); strategy.appendField(locator, this, "comment", buffer, theComment); } { String theStartTime; theStartTime = this.getStartTime(); strategy.appendField(locator, this, "startTime", buffer, theStartTime); } { String theEndTime; theEndTime = this.getEndTime(); strategy.appendField(locator, this, "endTime", buffer, theEndTime); } return buffer; }
public static XColumn columnFromFieldSchema(FieldSchema fs) { if (fs == null) { return null; } XColumn c = XCF.createXColumn(); c.setName(fs.getName()); c.setType(fs.getType()); c.setComment(fs.getComment()); return c; }
public static Map<String, String> columnStartAndEndTimeFromXColumns(XColumns columns) { if (columns != null && !columns.getColumn().isEmpty()) { Map<String, String> colStartTimeMap = new HashMap<String, String>(); for (XColumn c : columns.getColumn()) { if (!(c.getStartTime() == null)) { colStartTimeMap.put(MetastoreConstants.FACT_COL_START_TIME_PFX.concat(c.getName()), c.getStartTime()); } if (!(c.getEndTime() == null)) { colStartTimeMap.put(MetastoreConstants.FACT_COL_END_TIME_PFX.concat(c.getName()), c.getEndTime()); } } return colStartTimeMap; } return null; }
public XColumn withType(String value) { setType(value); return this; }
assertEquals(actual.getColumns().getColumn().get(0).getName(), "col1"); assertEquals(actual.getStorageDescriptor().getPartCols().getColumn().size(), 1); assertEquals(actual.getStorageDescriptor().getPartCols().getColumn().get(0).getName(), "pcol1"); assertEquals(actual.getTableType(), TableType.MANAGED_TABLE.name()); assertFalse(actual.getStorageDescriptor().isExternal());
/** * Create an instance of {@link XColumn } * */ public XColumn createXColumn() { return new XColumn(); }
public XColumn withEndTime(String value) { setEndTime(value); return this; }