public void CreateWithTypes() { var type = new MapTypeInfo(TypeInfo.String, TypeInfo.Int); Assert.AreSame(TypeInfo.String, type.KeyTypeInfo); Assert.AreSame(TypeInfo.Int, type.ElementTypeInfo); }
public byte[,] GetMapTypeArr() { byte[,] mapType = null; int row = 0; int column = 0; if (!string.IsNullOrEmpty(MapTypeInfo)) { string[] rowArr = MapTypeInfo.Split('|'); row = rowArr.Length; for (int i = 0; i < rowArr.Length; i++) { string[] columnArr = rowArr[i].Split('_'); if (column == 0) { column = columnArr.Length; mapType = new byte[row, column]; } for (int j = 0; j < columnArr.Length; j++) { byte.TryParse(columnArr[j], out mapType[i, j]); } } return(mapType); } else { return(null); } }
public OrcMapObjectInspector(MapTypeInfo info) { key = createObjectInspector(info.getMapKeyTypeInfo()); value = createObjectInspector(info.getMapValueTypeInfo()); }
public OrcMapObjectInspector(MapTypeInfo info) { key = createObjectInspector(info.getMapKeyTypeInfo()); value = createObjectInspector(info.getMapValueTypeInfo()); }
public static TypeDescription convertTypeInfo(TypeInfo info) { switch (info.getCategory()) { case ObjectInspectorCategory.PRIMITIVE: { PrimitiveTypeInfo pinfo = (PrimitiveTypeInfo)info; switch (pinfo.getPrimitiveCategory()) { case PrimitiveCategory.BOOLEAN: return(TypeDescription.createBoolean()); case PrimitiveCategory.BYTE: return(TypeDescription.createByte()); case PrimitiveCategory.SHORT: return(TypeDescription.createShort()); case PrimitiveCategory.INT: return(TypeDescription.createInt()); case PrimitiveCategory.LONG: return(TypeDescription.createLong()); case PrimitiveCategory.FLOAT: return(TypeDescription.createFloat()); case PrimitiveCategory.DOUBLE: return(TypeDescription.createDouble()); case PrimitiveCategory.STRING: return(TypeDescription.createString()); case PrimitiveCategory.DATE: return(TypeDescription.createDate()); case PrimitiveCategory.TIMESTAMP: return(TypeDescription.createTimestamp()); case PrimitiveCategory.BINARY: return(TypeDescription.createBinary()); case PrimitiveCategory.DECIMAL: { DecimalTypeInfo dinfo = (DecimalTypeInfo)pinfo; return(TypeDescription.createDecimal() .withScale(dinfo.scale()) .withPrecision(dinfo.precision())); } case PrimitiveCategory.VARCHAR: { BaseCharTypeInfo cinfo = (BaseCharTypeInfo)pinfo; return(TypeDescription.createVarchar() .withMaxLength(cinfo.getLength())); } case PrimitiveCategory.CHAR: { BaseCharTypeInfo cinfo = (BaseCharTypeInfo)pinfo; return(TypeDescription.createChar() .withMaxLength(cinfo.getLength())); } default: throw new ArgumentException("ORC doesn't handle primitive" + " category " + pinfo.getPrimitiveCategory()); } } case ObjectInspectorCategory.LIST: { ListTypeInfo linfo = (ListTypeInfo)info; return(TypeDescription.createList (convertTypeInfo(linfo.getListElementTypeInfo()))); } case ObjectInspectorCategory.MAP: { MapTypeInfo minfo = (MapTypeInfo)info; return(TypeDescription.createMap (convertTypeInfo(minfo.getMapKeyTypeInfo()), convertTypeInfo(minfo.getMapValueTypeInfo()))); } case ObjectInspectorCategory.UNION: { UnionTypeInfo minfo = (UnionTypeInfo)info; TypeDescription result = TypeDescription.createUnion(); foreach (TypeInfo child in minfo.getAllUnionObjectTypeInfos()) { result.addUnionChild(convertTypeInfo(child)); } return(result); } case ObjectInspectorCategory.STRUCT: { StructTypeInfo sinfo = (StructTypeInfo)info; TypeDescription result = TypeDescription.createStruct(); foreach (string fieldName in sinfo.getAllStructFieldNames()) { result.addField(fieldName, convertTypeInfo(sinfo.getStructFieldTypeInfo(fieldName))); } return(result); } default: throw new ArgumentException("ORC doesn't handle " + info.getCategory()); } }