private static SqlDataType getDataType()

in java/clickhouse-client/src/main/java/com/epam/deltix/clickhouse/util/ParseHelper.java [81:121]


    private static SqlDataType getDataType(Class<?> currentType,
                                           SchemaArrayElement arrayAnnotation,
                                           ClickhouseDataType dataTypeAnnotation,
                                           Partition partitionAnnotation,
                                           Index indexAnnotation,
                                           IntrospectionType introspectionType) {
        SqlDataType dataType;

        if (dataTypeAnnotation != null && (dataTypeAnnotation.value() == DataTypes.NESTED)) {
            if (arrayAnnotation != null)
                validateNestedDataType(dataTypeAnnotation.value(), currentType);
            else
                throw illegalNestedAnnotation(currentType);
        }

        DataTypes requestedType = dataTypeAnnotation == null ? null : dataTypeAnnotation.value();

        if (arrayAnnotation != null) {
            Class<?> nestedType = arrayAnnotation.nestedType();

            if (isSimpleType(nestedType)) {
                dataType = parseSimpleDataType(requestedType, nestedType);
                dataType = wrapWithNullableDataTypeIfApplicable(nestedType, dataType, partitionAnnotation, indexAnnotation);

                dataType = new ArraySqlType(dataType);
            } else {
                dataType = new NestedDataType(Introspector.getColumnDeclarations(nestedType, introspectionType));
            }
        } else {
            Class<?> componentType = currentType.getComponentType();
            if (componentType != null) {
                dataType = parseSimpleDataType(requestedType, componentType);
                dataType = new ArraySqlType(dataType);
            } else {
                dataType = parseSimpleDataType(requestedType, currentType);
                dataType = wrapWithNullableDataTypeIfApplicable(currentType, dataType, partitionAnnotation, indexAnnotation);
            }
        }

        return dataType;
    }