public XDimAttribute withChainRefColumn(XChainColumn... values) { if (values!= null) { for (XChainColumn value: values) { getChainRefColumn().add(value); } } return this; }
public XDimAttribute withValues(Collection<String> values) { if (values!= null) { getValues().addAll(values); } return this; }
@Override public XDimAttribute withDescription(String value) { setDescription(value); return this; }
xd.setName(cd.getName()); xd.setDescription(cd.getDescription()); xd.setDisplayString(cd.getDisplayString()); xd.setStartTime(getXMLGregorianCalendar(cd.getStartTime())); xd.setEndTime(getXMLGregorianCalendar(cd.getEndTime())); xd.setTags(getXProperties(xPropertiesFromMap(cd.getTags()))); if (cd instanceof ReferencedDimAttribute) { ReferencedDimAttribute rd = (ReferencedDimAttribute) cd; xcc.setDestTable(baseTable.getChainByName(crCol.getChainName()).getDestTable()); xd.getChainRefColumn().add(xcc); xd.setType(rd.getType()); Optional<Long> numOfDistinctValues = rd.getNumOfDistinctValues(); if (numOfDistinctValues.isPresent()) { xd.setNumDistinctValues(numOfDistinctValues.get()); xd.getValues().addAll(rd.getValues().get()); xd.setType(bd.getType()); Optional<Long> numOfDistinctValues = bd.getNumOfDistinctValues(); if (numOfDistinctValues.isPresent()) { xd.setNumDistinctValues(numOfDistinctValues.get()); xd.getValues().addAll(bd.getValues().get()); xd.setHierarchy(hierarchy);
theChainRefColumn = (((this.chainRefColumn!= null)&&(!this.chainRefColumn.isEmpty()))?this.getChainRefColumn():null); strategy.appendField(locator, this, "chainRefColumn", buffer, theChainRefColumn); theHierarchy = this.getHierarchy(); strategy.appendField(locator, this, "hierarchy", buffer, theHierarchy); theValues = (((this.values!= null)&&(!this.values.isEmpty()))?this.getValues():null); strategy.appendField(locator, this, "values", buffer, theValues); theType = this.getType(); strategy.appendField(locator, this, "type", buffer, theType); theStartTime = this.getStartTime(); strategy.appendField(locator, this, "startTime", buffer, theStartTime); theEndTime = this.getEndTime(); strategy.appendField(locator, this, "endTime", buffer, theEndTime); theNumDistinctValues = this.getNumDistinctValues(); strategy.appendField(locator, this, "numDistinctValues", buffer, theNumDistinctValues);
Date startDate = getDateFromXML(xd.getStartTime()); Date endDate = getDateFromXML(xd.getEndTime()); if (xd.getHierarchy() != null) { List<CubeDimAttribute> hierarchy = new ArrayList<>(); for (XDimAttribute hd : xd.getHierarchy().getDimAttribute()) { hierarchy.add(hiveDimAttrFromXDimAttr(hd)); hiveDim = new HierarchicalDimAttribute(xd.getName(), xd.getDescription(), hierarchy); } else if (xd.getChainRefColumn() != null && !xd.getChainRefColumn().isEmpty()) { hiveDim = new ReferencedDimAttribute(new FieldSchema(xd.getName(), xd.getType().toLowerCase(), xd.getDescription()), xd.getDisplayString(), getChainRefColumns(xd.getChainRefColumn()), startDate, endDate, null, xd.getNumDistinctValues(), xd.getValues(), mapFromXProperties(xd.getTags()) ); } else { hiveDim = new BaseDimAttribute(new FieldSchema(xd.getName(), xd.getType().toLowerCase(), xd.getDescription()), xd.getDisplayString(), startDate, endDate, null,
xd3.setName("col3"); xd3.setType("STRING"); xd3.setDescription("inline column"); xd3.setDisplayString("Column3"); xd3.getValues().add("Val1"); xd3.getValues().add("Val2"); xd3.getValues().add("Val3"); xd4.setName("col4"); xd4.setDescription("hierarchical column"); xd4.setDisplayString("Column4"); XDimAttributes hierarchy = new XDimAttributes(); XDimAttribute hd1 = cubeObjectFactory.createXDimAttribute(); hd1.setName("col4-h1"); hd1.setType("STRING"); hd1.setDescription("inline column"); hd1.setDisplayString("Column4-h1"); hd1.getValues().add("Val1-h1"); hd1.getValues().add("Val2-h1"); hd1.getValues().add("Val3-h1"); hierarchy.getDimAttribute().add(hd1); XDimAttribute hd2 = cubeObjectFactory.createXDimAttribute(); hd2.setName("col4-h2"); hd2.setType("STRING"); hd2.setDescription("base column"); hd2.setDisplayString("Column4-h2"); hierarchy.getDimAttribute().add(hd2); XDimAttribute hd3 = cubeObjectFactory.createXDimAttribute(); hd3.setName("col4-h3");
cube.setProperties(new XProperties()); XDimAttribute xd1 = cubeObjectFactory.createXDimAttribute(); xd1.setName("dim1"); xd1.setType("STRING"); xd1.setDescription("first dimension"); xd1.setDisplayString("Dimension1"); xd1.setStartTime(startDate); xd1.setNumDistinctValues(2000L); xd2.setName("dim2"); xd2.setType("INT"); xd2.setDescription("second dimension"); xd2.setDisplayString("Dimension2"); xd2.setEndTime(endDate); xd3.setName("testdim2col2"); xd3.setType("STRING"); xd3.setDescription("ref chained dimension"); xd3.setDisplayString("Chained Dimension"); XChainColumn xcc = new XChainColumn(); xcc.setChainName("chain1"); xcc.setRefCol("col2"); xd3.getChainRefColumn().add(xcc); xd3.setNumDistinctValues(1000L); xd4.setName("dim4"); xd4.setType("struct<a:INT,b:array<string>,c:map<int,array<struct<x:int,y:array<int>>>");
); XDimAttribute xd1 = cubeObjectFactory.createXDimAttribute(); xd1.setName("col1"); xd1.setType("STRING"); xd1.setDescription("first column"); xd1.setDisplayString("Column1"); xd1.setStartTime(startDate); xd2.setName("col2"); xd2.setType("INT"); xd2.setDescription("second column"); xd2.setDisplayString("Column2"); xd2.setEndTime(endDate);
public static XDimAttribute createXDimAttribute(final String name, final Optional<DateTime> startDate, final Optional<DateTime> endDate) throws DatatypeConfigurationException { XDimAttribute xDimAttribute = new XDimAttribute(); xDimAttribute.setName(name); xDimAttribute.setType("STRING"); if (startDate.isPresent()) { xDimAttribute.setStartTime(createXMLGregorianCalendar(startDate.get().toDate())); } if (endDate.isPresent()) { xDimAttribute.setEndTime(createXMLGregorianCalendar(endDate.get().toDate())); } return xDimAttribute; }
boolean chainValidated = false; for (XDimAttribute attr : actual.getDimAttributes().getDimAttribute()) { if (attr.getName().equalsIgnoreCase("testdim2col2")) { assertEquals(attr.getChainRefColumn().get(0).getDestTable(), "testdim"); chainValidated = true; break;
@Override public XDimAttribute withDisplayString(String value) { setDisplayString(value); return this; }
public XDimAttribute withStartTime(XMLGregorianCalendar value) { setStartTime(value); return this; }
public XDimAttribute withNumDistinctValues(Long value) { setNumDistinctValues(value); return this; }
public XDimAttribute withEndTime(XMLGregorianCalendar value) { setEndTime(value); return this; }
@Override public XDimAttribute withName(String value) { setName(value); return this; }
public XDimAttribute withHierarchy(XDimAttributes value) { setHierarchy(value); return this; }
xd.setName(cd.getName()); xd.setDescription(cd.getDescription()); xd.setDisplayString(cd.getDisplayString()); xd.setStartTime(getXMLGregorianCalendar(cd.getStartTime())); xd.setEndTime(getXMLGregorianCalendar(cd.getEndTime())); xd.setTags(getXProperties(xPropertiesFromMap(cd.getTags()))); if (cd instanceof ReferencedDimAttribute) { ReferencedDimAttribute rd = (ReferencedDimAttribute) cd; xcc.setDestTable(baseTable.getChainByName(crCol.getChainName()).getDestTable()); xd.getChainRefColumn().add(xcc); xd.setType(rd.getType()); Optional<Long> numOfDistinctValues = rd.getNumOfDistinctValues(); if (numOfDistinctValues.isPresent()) { xd.setNumDistinctValues(numOfDistinctValues.get()); xd.getValues().addAll(rd.getValues().get()); xd.setType(bd.getType()); Optional<Long> numOfDistinctValues = bd.getNumOfDistinctValues(); if (numOfDistinctValues.isPresent()) { xd.setNumDistinctValues(numOfDistinctValues.get()); xd.getValues().addAll(bd.getValues().get()); xd.setHierarchy(hierarchy);