public int getVariantOrdNum(Object value) {
        if (value != null && value.getClass().isArray()) {
            // TODO: add cache by value class
            Class<?> c = value.getClass();
            while (c.isArray()) {
                c = c.getComponentType();
            }
            return arrayToVariantOrdNumMap.getOrDefault(c, -1);
        } else if (value != null && value instanceof List<?>) {
            // TODO: add cache by instance of the list
            Object tmpV = ((List) value).get(0);
            Class<?> valueClass = tmpV.getClass();
            while (tmpV instanceof List<?>) {
                tmpV = ((List) tmpV).get(0);
                valueClass = tmpV.getClass();
            }
            return arrayToVariantOrdNumMap.getOrDefault(valueClass, -1);
        } else if (value != null && value instanceof Map<?,?>) {
            // TODO: add cache by instance of map
            Map<?, ?> map = (Map<?, ?>) value;
            if (!map.isEmpty()) {
                for (Map.Entry<?, ?> e : map.entrySet()) {
                    if (e.getValue() != null) {
                        int keyOrdNum = mapKeyToVariantOrdNumMap.getOrDefault(e.getKey().getClass(), -1);
                        int valueOrdNum = mapValueToVariantOrdNumMap.getOrDefault(e.getValue().getClass(), -1);

                        if (keyOrdNum == valueOrdNum) {
                            return valueOrdNum; // exact match
                        } else if (keyOrdNum != -1 && valueOrdNum != -1) {
                            if (ClickHouseDataType.DATA_TYPE_TO_CLASS.get(nested.get(keyOrdNum).getValueInfo().getDataType()).contains(e.getValue().getClass())){
                                return keyOrdNum; // can write to map found by key class because values are compatible
                            } else {
                                return valueOrdNum;
                            }
                        }

                        break;
                    }
                }
            }
            return -1;
        } else {
            return classToVariantOrdNumMap.getOrDefault(value.getClass(), -1);
        }
    }
Sets zero-based column index and column count.

@param index zero-based column index, negative number is treated as zero
@param count column count, should be always greater than one
clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseColumn.java