public static List<DataType> flattenToDataTypes(DataType dataType) {
        final LogicalType type = dataType.getLogicalType();
        if (type.is(DISTINCT_TYPE)) {
            return flattenToDataTypes(dataType.getChildren().get(0));
        } else if (isCompositeType(type)) {
            return dataType.getChildren();
        }
        return Collections.singletonList(dataType);
    }
@Test
    void testFlattenToDataTypes() {
        assertThat(DataTypeUtils.flattenToDataTypes(INT())).containsOnly(INT());

        assertThat(DataTypeUtils.flattenToDataTypes(ROW(FIELD("a", INT()), FIELD("b", BOOLEAN()))))
                .containsExactly(INT(), BOOLEAN());
    }