private void populate(String name, DataType dataType) {
        if (dataType instanceof TensorDataType) {
            TensorType type = ((TensorDataType)dataType).getTensorType();
            if (type.dimensions().stream().anyMatch(d -> d.isIndexed() && d.size().isEmpty()))
                throw new IllegalArgumentException("Illegal type in field " + name + " type " + type +
                                                   ": Dense tensor dimensions must have a size");
            addQueryCommand("type " + type);
        }
        else if (dataType instanceof WeightedSetDataType) {
            var nested = ((WeightedSetDataType) dataType).getNestedType().getName();
            addQueryCommand("type WeightedSet<" + nested + ">");
        }
        else {
            addQueryCommand("type " + dataType.getName());
        }
    }
Creates a new field

@param name the name of the field
@param dataType the datatype of the field
@param owner the owning document (used to check for id collisions)
@param fieldMatching the matching object to set for the field
config-model/src/main/java/com/yahoo/schema/document/SDField.java