Java Code Examples for org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category#PRIMITIVE

The following examples show how to use org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category#PRIMITIVE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HiveUtils.java    From incubator-hivemall with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static PrimitiveObjectInspector asDoubleCompatibleOI(
        @Nonnull final ObjectInspector argOI) throws UDFArgumentTypeException {
    if (argOI.getCategory() != Category.PRIMITIVE) {
        throw new UDFArgumentTypeException(0, "Only primitive type arguments are accepted but "
                + argOI.getTypeName() + " is passed.");
    }
    final PrimitiveObjectInspector oi = (PrimitiveObjectInspector) argOI;
    switch (oi.getPrimitiveCategory()) {
        case BYTE:
        case SHORT:
        case INT:
        case LONG:
        case FLOAT:
        case DOUBLE:
        case DECIMAL:
        case STRING:
        case TIMESTAMP:
            break;
        default:
            throw new UDFArgumentTypeException(0,
                "Only numeric or string type arguments are accepted but " + argOI.getTypeName()
                        + " is passed.");
    }
    return oi;
}
 
Example 2
Source File: HiveTestUDFImpls.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@Override
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
  if (arguments.length != 1) {
    throw new UDFArgumentLengthException(String.format("%s needs 1 argument, got %d", udfName, arguments.length));
  }

  if (arguments[0].getCategory() != Category.PRIMITIVE ||
      ((PrimitiveObjectInspector) arguments[0]).getPrimitiveCategory() != inputType) {
    String actual = arguments[0].getCategory() + (arguments[0].getCategory() == Category.PRIMITIVE ?
        "[" + ((PrimitiveObjectInspector) arguments[0]).getPrimitiveCategory() + "]" : "");
    throw new UDFArgumentException(
        String.format("%s only takes primitive type %s, got %s", udfName, inputType, actual));
  }
  argumentOI = arguments[0];
  return PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector(outputType);
}
 
Example 3
Source File: HiveUtils.java    From incubator-hivemall with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static PrimitiveObjectInspector asIntegerOI(@Nonnull final ObjectInspector[] argOIs,
        final int argIndex) throws UDFArgumentException {
    final ObjectInspector argOI = getObjectInspector(argOIs, argIndex);
    if (argOI.getCategory() != Category.PRIMITIVE) {
        throw new UDFArgumentTypeException(argIndex,
            "Only primitive type arguments are accepted but " + argOI.getTypeName()
                    + " is passed.");
    }
    final PrimitiveObjectInspector oi = (PrimitiveObjectInspector) argOI;
    switch (oi.getPrimitiveCategory()) {
        case INT:
        case SHORT:
        case LONG:
        case BYTE:
            break;
        default:
            throw new UDFArgumentTypeException(argIndex,
                "Unexpected type '" + argOI.getTypeName() + "' is passed.");
    }
    return oi;
}
 
Example 4
Source File: HiveGeometryOIHelper.java    From spatial-framework-for-hadoop with Apache License 2.0 5 votes vote down vote up
public static HiveGeometryOIHelper create(ObjectInspector oi, int argIndex) throws UDFArgumentException {
	if (oi.getCategory() != Category.PRIMITIVE) {
		throw new UDFArgumentException("Geometry argument must be a primitive type");
	}
	
	return new HiveGeometryOIHelper(oi, argIndex);
}
 
Example 5
Source File: HiveUtils.java    From incubator-hivemall with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static PrimitiveObjectInspector asIntCompatibleOI(
        @Nonnull final ObjectInspector[] argOIs, final int argIndex)
        throws UDFArgumentException {
    ObjectInspector argOI = getObjectInspector(argOIs, argIndex);
    if (argOI.getCategory() != Category.PRIMITIVE) {
        throw new UDFArgumentTypeException(argIndex,
            "Only primitive type arguments are accepted but " + argOI.getTypeName()
                    + " is passed.");
    }
    final PrimitiveObjectInspector oi = (PrimitiveObjectInspector) argOI;
    switch (oi.getPrimitiveCategory()) {
        case INT:
        case SHORT:
        case LONG:
        case FLOAT:
        case DOUBLE:
        case DECIMAL:
        case BOOLEAN:
        case BYTE:
        case STRING:
            break;
        default:
            throw new UDFArgumentTypeException(argIndex,
                "Unexpected type '" + argOI.getTypeName() + "' is passed.");
    }
    return oi;
}
 
Example 6
Source File: HiveUtils.java    From incubator-hivemall with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static PrimitiveObjectInspector asPrimitiveObjectInspector(
        @Nonnull final ObjectInspector[] argOIs, final int argIndex)
        throws UDFArgumentException {
    final ObjectInspector oi = getObjectInspector(argOIs, argIndex);
    if (oi.getCategory() != Category.PRIMITIVE) {
        throw new UDFArgumentException("Expecting PrimitiveObjectInspector for argOIs["
                + argIndex + "] but got " + TypeInfoUtils.getTypeInfoFromObjectInspector(oi));
    }
    return (PrimitiveObjectInspector) oi;
}
 
Example 7
Source File: HiveUtils.java    From incubator-hivemall with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static PrimitiveObjectInspector asPrimitiveObjectInspector(
        @Nonnull final ObjectInspector oi) throws UDFArgumentException {
    if (oi.getCategory() != Category.PRIMITIVE) {
        throw new UDFArgumentException("Expecting PrimitiveObjectInspector: "
                + TypeInfoUtils.getTypeInfoFromObjectInspector(oi));
    }
    return (PrimitiveObjectInspector) oi;
}
 
Example 8
Source File: ST_BinEnvelope.java    From spatial-framework-for-hadoop with Apache License 2.0 5 votes vote down vote up
private boolean isPrimitiveNumber(ObjectInspector oi) {
	if (oi.getCategory() != Category.PRIMITIVE) {
		return false;
	}
	
	return EnumSet.of(PrimitiveCategory.DOUBLE,PrimitiveCategory.INT,PrimitiveCategory.LONG,
					PrimitiveCategory.SHORT, PrimitiveCategory.FLOAT, PrimitiveCategory.DECIMAL)
				  .contains(((PrimitiveObjectInspector)oi).getPrimitiveCategory());
}
 
Example 9
Source File: ArrayNullsRemoverGenericUDF.java    From occurrence with Apache License 2.0 5 votes vote down vote up
@Override
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
  if (arguments.length != 1) {
    throw new UDFArgumentException("removeNulls takes an array as argument");
  }
  if (arguments[0].getCategory() != Category.LIST) {
    throw new UDFArgumentException("removeNulls takes an array as argument");
  }
  retValInspector = (StandardListObjectInspector) ObjectInspectorUtils.getStandardObjectInspector(arguments[0]);
  if (retValInspector.getListElementObjectInspector().getCategory() != Category.PRIMITIVE) {
    primitiveObjectInspector = (PrimitiveObjectInspector) retValInspector.getListElementObjectInspector();
  }
  return retValInspector;
}
 
Example 10
Source File: HdfsSerDeImportService.java    From hadoop-etl-udfs with MIT License 5 votes vote down vote up
private static void addJsonObjectPair(JsonObjectBuilder job, String key, Object obj, ObjectInspector objInsp, JsonBuilderFactory jsonFactory) {
    if (obj == null)
        job.addNull(key);
    else if (objInsp.getCategory() == Category.PRIMITIVE) {
        Object o = getJavaObjectFromFieldData(obj, objInsp);
        if (o instanceof Integer)
            job.add(key, (Integer) o);
        else if (o instanceof Byte)
            job.add(key, (Byte) o);
        else if (o instanceof Short)
            job.add(key, (Short) o);
        else if (o instanceof Long)
            job.add(key, (Long) o);
        else if (o instanceof Float)
            job.add(key, (Float) o);
        else if (o instanceof Double)
            job.add(key, (Double) o);
        else if (o instanceof BigDecimal)
            job.add(key, (BigDecimal) o);
        else if (o instanceof Boolean)
            job.add(key, (Boolean) o);
        else
            job.add(key, o.toString());
    }
    else if (objInsp.getCategory() == Category.LIST) {
        job.add(key, getJsonArrayFromFieldData(obj, objInsp, jsonFactory));
    }
    else {
        job.add(key, getJsonObjectFromFieldData(obj, objInsp, jsonFactory));
    }
}
 
Example 11
Source File: ST_GeomFromJson.java    From spatial-framework-for-hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public ObjectInspector initialize(ObjectInspector[] arguments)
		throws UDFArgumentException {
	
	if (arguments.length != 1) {
		throw new UDFArgumentLengthException("ST_GeomFromJson takes only one argument");
	}

	ObjectInspector argJsonOI = arguments[0];
	
	if (argJsonOI.getCategory() == Category.PRIMITIVE)
	{
		PrimitiveObjectInspector poi = (PrimitiveObjectInspector)argJsonOI;
		
		if (poi.getPrimitiveCategory() != PrimitiveCategory.STRING)
		{
			throw new UDFArgumentTypeException(0, "ST_GeomFromJson argument category must be either a string primitive or struct");
		}
	} else if (argJsonOI.getCategory() != Category.STRUCT) {
		
	} else {
		throw new UDFArgumentTypeException(0, "ST_GeomFromJson argument category must be either a string primitive or struct");
	}
	
	jsonOI = argJsonOI;

	return GeometryUtils.geometryTransportObjectInspector;
}
 
Example 12
Source File: HiveMetadataUtils.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private static boolean isFieldTypeVarchar(FieldSchema hiveField) {
  final TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(hiveField.getType());
  if (typeInfo.getCategory() == Category.PRIMITIVE) {
    PrimitiveTypeInfo pTypeInfo = (PrimitiveTypeInfo) typeInfo;
    if (pTypeInfo.getPrimitiveCategory() == PrimitiveObjectInspector.PrimitiveCategory.VARCHAR ||
      pTypeInfo.getPrimitiveCategory() == PrimitiveObjectInspector.PrimitiveCategory.CHAR) {
      return true;
    }
  }
  return false;
}
 
Example 13
Source File: HiveORCVectorizedReader.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private boolean isSupportedType(Category category) {
  return (category == Category.PRIMITIVE ||
    category == Category.LIST ||
    category == Category.STRUCT ||
    category == Category.MAP ||
    category == Category.UNION);
}
 
Example 14
Source File: HiveMetadataUtils.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private static boolean isFieldTypeVarchar(FieldSchema hiveField) {
  final TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(hiveField.getType());
  if (typeInfo.getCategory() == Category.PRIMITIVE) {
    PrimitiveTypeInfo pTypeInfo = (PrimitiveTypeInfo) typeInfo;
    if (pTypeInfo.getPrimitiveCategory() == PrimitiveObjectInspector.PrimitiveCategory.VARCHAR ||
      pTypeInfo.getPrimitiveCategory() == PrimitiveObjectInspector.PrimitiveCategory.CHAR) {
      return true;
    }
  }
  return false;
}
 
Example 15
Source File: HiveORCVectorizedReader.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private boolean isSupportedType(Category category) {
  return (category == Category.PRIMITIVE ||
    category == Category.LIST ||
    category == Category.STRUCT ||
    category == Category.MAP ||
    category == Category.UNION);
}
 
Example 16
Source File: HiveORCVectorizedResolver.java    From pxf with Apache License 2.0 5 votes vote down vote up
@Override
public List<List<OneField>> getFieldsForBatch(OneRow batch) {

    VectorizedRowBatch vectorizedBatch = (VectorizedRowBatch) batch.getData();

    /* Allocate empty result set */
    int columnsNumber = context.getColumns();
    resolvedBatch = new ArrayList<>(vectorizedBatch.size);

    /* Create empty template row */
    ArrayList<OneField> templateRow = new ArrayList<OneField>(columnsNumber);
    ArrayList<OneField> currentRow;
    for (int j = 0; j < context.getColumns(); j++) {
        templateRow.add(null);
    }
    /* Replicate template row*/
    for (int i = 0; i < vectorizedBatch.size; i++) {
        currentRow = new ArrayList<>(templateRow);
        resolvedBatch.add(currentRow);
    }

    /* process all columns*/
    List<? extends StructField> allStructFieldRefs = soi.getAllStructFieldRefs();
    for (int columnIndex = 0; columnIndex < vectorizedBatch.numCols; columnIndex++) {
        ObjectInspector oi = allStructFieldRefs.get(columnIndex).getFieldObjectInspector();
        if (oi.getCategory() == Category.PRIMITIVE) {
            resolvePrimitiveColumn(columnIndex, oi, vectorizedBatch);
        } else {
            throw new UnsupportedTypeException("Unable to resolve column index:" + columnIndex
                    + ". Only primitive types are supported.");
        }
    }

    return resolvedBatch;
}
 
Example 17
Source File: ST_GeomFromGeoJson.java    From spatial-framework-for-hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public ObjectInspector initialize(ObjectInspector[] arguments)
		throws UDFArgumentException {
	
	if (arguments.length != 1) {
		throw new UDFArgumentLengthException("ST_GeomFromJson takes only one argument");
	}

	ObjectInspector argJsonOI = arguments[0];
	
	if (argJsonOI.getCategory() == Category.PRIMITIVE)
	{
		PrimitiveObjectInspector poi = (PrimitiveObjectInspector)argJsonOI;
		
		if (poi.getPrimitiveCategory() != PrimitiveCategory.STRING)
		{
			throw new UDFArgumentTypeException(0, "ST_GeomFromJson argument category must be either a string primitive or struct");
		}
	} else if (argJsonOI.getCategory() != Category.STRUCT) {
		
	} else {
		throw new UDFArgumentTypeException(0, "ST_GeomFromJson argument category must be either a string primitive or struct");
	}
	
	jsonOI = argJsonOI;

	return GeometryUtils.geometryTransportObjectInspector;
}
 
Example 18
Source File: HiveUtils.java    From incubator-hivemall with Apache License 2.0 4 votes vote down vote up
public static boolean isPrimitiveOI(@Nonnull final ObjectInspector oi) {
    return oi.getCategory() == Category.PRIMITIVE;
}
 
Example 19
Source File: SingleLevelArraySchemaConverter.java    From presto with Apache License 2.0 4 votes vote down vote up
private static Type convertType(String name, TypeInfo typeInfo,
        Repetition repetition)
{
    if (typeInfo.getCategory() == Category.PRIMITIVE) {
        if (typeInfo.equals(TypeInfoFactory.stringTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.BINARY, repetition).as(OriginalType.UTF8)
                    .named(name);
        }
        else if (typeInfo.equals(TypeInfoFactory.intTypeInfo) ||
                typeInfo.equals(TypeInfoFactory.shortTypeInfo) ||
                typeInfo.equals(TypeInfoFactory.byteTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.INT32, repetition).named(name);
        }
        else if (typeInfo.equals(TypeInfoFactory.longTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.INT64, repetition).named(name);
        }
        else if (typeInfo.equals(TypeInfoFactory.doubleTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.DOUBLE, repetition).named(name);
        }
        else if (typeInfo.equals(TypeInfoFactory.floatTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.FLOAT, repetition).named(name);
        }
        else if (typeInfo.equals(TypeInfoFactory.booleanTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.BOOLEAN, repetition).named(name);
        }
        else if (typeInfo.equals(TypeInfoFactory.binaryTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.BINARY, repetition).named(name);
        }
        else if (typeInfo.equals(TypeInfoFactory.timestampTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.INT96, repetition).named(name);
        }
        else if (typeInfo.equals(TypeInfoFactory.voidTypeInfo)) {
            throw new UnsupportedOperationException("Void type not implemented");
        }
        else if (typeInfo.getTypeName().toLowerCase(Locale.ENGLISH).startsWith(
                serdeConstants.CHAR_TYPE_NAME)) {
            if (repetition == Repetition.OPTIONAL) {
                return Types.optional(PrimitiveTypeName.BINARY).as(OriginalType.UTF8).named(name);
            }
            else {
                return Types.repeated(PrimitiveTypeName.BINARY).as(OriginalType.UTF8).named(name);
            }
        }
        else if (typeInfo.getTypeName().toLowerCase(Locale.ENGLISH).startsWith(
                serdeConstants.VARCHAR_TYPE_NAME)) {
            if (repetition == Repetition.OPTIONAL) {
                return Types.optional(PrimitiveTypeName.BINARY).as(OriginalType.UTF8).named(name);
            }
            else {
                return Types.repeated(PrimitiveTypeName.BINARY).as(OriginalType.UTF8).named(name);
            }
        }
        else if (typeInfo instanceof DecimalTypeInfo) {
            DecimalTypeInfo decimalTypeInfo = (DecimalTypeInfo) typeInfo;
            int prec = decimalTypeInfo.precision();
            int scale = decimalTypeInfo.scale();
            int bytes = ParquetHiveSerDe.PRECISION_TO_BYTE_COUNT[prec - 1];
            if (repetition == Repetition.OPTIONAL) {
                return Types.optional(PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY).length(bytes).as(OriginalType.DECIMAL).scale(scale).precision(prec).named(name);
            }
            else {
                return Types.repeated(PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY).length(bytes).as(OriginalType.DECIMAL).scale(scale).precision(prec).named(name);
            }
        }
        else if (typeInfo.equals(TypeInfoFactory.dateTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.INT32, repetition).as(OriginalType.DATE).named(name);
        }
        else if (typeInfo.equals(TypeInfoFactory.unknownTypeInfo)) {
            throw new UnsupportedOperationException("Unknown type not implemented");
        }
        else {
            throw new IllegalArgumentException("Unknown type: " + typeInfo);
        }
    }
    else if (typeInfo.getCategory() == Category.LIST) {
        return convertArrayType(name, (ListTypeInfo) typeInfo, repetition);
    }
    else if (typeInfo.getCategory() == Category.STRUCT) {
        return convertStructType(name, (StructTypeInfo) typeInfo, repetition);
    }
    else if (typeInfo.getCategory() == Category.MAP) {
        return convertMapType(name, (MapTypeInfo) typeInfo, repetition);
    }
    else if (typeInfo.getCategory() == Category.UNION) {
        throw new UnsupportedOperationException("Union type not implemented");
    }
    else {
        throw new IllegalArgumentException("Unknown type: " + typeInfo);
    }
}
 
Example 20
Source File: SingleLevelArrayMapKeyValuesSchemaConverter.java    From presto with Apache License 2.0 4 votes vote down vote up
private static Type convertType(String name, TypeInfo typeInfo, Repetition repetition)
{
    if (typeInfo.getCategory() == Category.PRIMITIVE) {
        if (typeInfo.equals(TypeInfoFactory.stringTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.BINARY, repetition).as(OriginalType.UTF8)
                    .named(name);
        }
        if (typeInfo.equals(TypeInfoFactory.intTypeInfo) ||
                typeInfo.equals(TypeInfoFactory.shortTypeInfo) ||
                typeInfo.equals(TypeInfoFactory.byteTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.INT32, repetition).named(name);
        }
        if (typeInfo.equals(TypeInfoFactory.longTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.INT64, repetition).named(name);
        }
        if (typeInfo.equals(TypeInfoFactory.doubleTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.DOUBLE, repetition).named(name);
        }
        if (typeInfo.equals(TypeInfoFactory.floatTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.FLOAT, repetition).named(name);
        }
        if (typeInfo.equals(TypeInfoFactory.booleanTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.BOOLEAN, repetition).named(name);
        }
        if (typeInfo.equals(TypeInfoFactory.binaryTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.BINARY, repetition).named(name);
        }
        if (typeInfo.equals(TypeInfoFactory.timestampTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.INT96, repetition).named(name);
        }
        if (typeInfo.equals(TypeInfoFactory.voidTypeInfo)) {
            throw new UnsupportedOperationException("Void type not implemented");
        }
        if (typeInfo.getTypeName().toLowerCase(Locale.ENGLISH).startsWith(
                serdeConstants.CHAR_TYPE_NAME)) {
            if (repetition == Repetition.OPTIONAL) {
                return Types.optional(PrimitiveTypeName.BINARY).as(OriginalType.UTF8).named(name);
            }
            return Types.repeated(PrimitiveTypeName.BINARY).as(OriginalType.UTF8).named(name);
        }
        if (typeInfo.getTypeName().toLowerCase(Locale.ENGLISH).startsWith(
                serdeConstants.VARCHAR_TYPE_NAME)) {
            if (repetition == Repetition.OPTIONAL) {
                return Types.optional(PrimitiveTypeName.BINARY).as(OriginalType.UTF8).named(name);
            }
            return Types.repeated(PrimitiveTypeName.BINARY).as(OriginalType.UTF8).named(name);
        }
        if (typeInfo instanceof DecimalTypeInfo) {
            DecimalTypeInfo decimalTypeInfo = (DecimalTypeInfo) typeInfo;
            int prec = decimalTypeInfo.precision();
            int scale = decimalTypeInfo.scale();
            int bytes = ParquetHiveSerDe.PRECISION_TO_BYTE_COUNT[prec - 1];
            if (repetition == Repetition.OPTIONAL) {
                return Types.optional(PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY).length(bytes).as(OriginalType.DECIMAL).scale(scale).precision(prec).named(name);
            }
            return Types.repeated(PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY).length(bytes).as(OriginalType.DECIMAL).scale(scale).precision(prec).named(name);
        }
        if (typeInfo.equals(TypeInfoFactory.dateTypeInfo)) {
            return Types.primitive(PrimitiveTypeName.INT32, repetition).as(OriginalType.DATE).named(name);
        }
        if (typeInfo.equals(TypeInfoFactory.unknownTypeInfo)) {
            throw new UnsupportedOperationException("Unknown type not implemented");
        }
        throw new IllegalArgumentException("Unknown type: " + typeInfo);
    }
    if (typeInfo.getCategory() == Category.LIST) {
        return convertArrayType(name, (ListTypeInfo) typeInfo, repetition);
    }
    if (typeInfo.getCategory() == Category.STRUCT) {
        return convertStructType(name, (StructTypeInfo) typeInfo, repetition);
    }
    if (typeInfo.getCategory() == Category.MAP) {
        return convertMapType(name, (MapTypeInfo) typeInfo, repetition);
    }
    if (typeInfo.getCategory() == Category.UNION) {
        throw new UnsupportedOperationException("Union type not implemented");
    }
    throw new IllegalArgumentException("Unknown type: " + typeInfo);
}