private static void processComplexTypes()

in calcite-adapter/src/main/java/software/amazon/documentdb/jdbc/metadata/DocumentDbTableSchemaGenerator.java [545:573]


    private static void processComplexTypes(
            final Map<String, DocumentDbSchemaTable> tableMap,
            final List<DocumentDbMetadataColumn> foreignKeys,
            final String collectionName,
            final Entry<String, BsonValue> entry,
            final String fieldPath,
            final BsonType bsonType,
            final DocumentDbMetadataColumn prevMetadataColumn,
            final JdbcType nextSqlType,
            final Map<String, String> tableNameMap) {
        if (nextSqlType == JdbcType.JAVA_OBJECT && bsonType != BsonType.NULL) {
            // This will create/update virtual table.
            processDocument(entry.getValue().asDocument(),
                    tableMap, foreignKeys, fieldPath, collectionName, false, tableNameMap);

        } else if (nextSqlType == JdbcType.ARRAY && bsonType != BsonType.NULL) {
            // This will create/update virtual table.
            processArray(entry.getValue().asArray(),
                    tableMap, foreignKeys, fieldPath, 0, collectionName, tableNameMap);
        } else {
            // Process a scalar data type.
            if (prevMetadataColumn != null && prevMetadataColumn.getVirtualTableName() != null
                    && bsonType != BsonType.NULL) {
                // This column has been promoted to a scalar type from a complex type.
                // Remove the previously defined virtual table.
                tableMap.remove(prevMetadataColumn.getVirtualTableName());
            }
        }
    }