fn test_cases()

in crates/paimon/src/spec/types.rs [1556:2052]


    fn test_cases() -> Vec<(&'static str, DataType)> {
        vec![
            (
                "array_type",
                DataType::Array(ArrayType {
                    nullable: false,
                    element_type: DataType::Int(IntType::with_nullable(false)).into(),
                }),
            ),
            (
                "array_type_nullable",
                DataType::Array(ArrayType {
                    nullable: true,
                    element_type: DataType::Int(IntType::with_nullable(true)).into(),
                }),
            ),
            (
                "bigint_type",
                DataType::BigInt(BigIntType { nullable: false }),
            ),
            (
                "bigint_type_nullable",
                DataType::BigInt(BigIntType { nullable: true }),
            ),
            (
                "binary_type",
                DataType::Binary(BinaryType {
                    nullable: false,
                    length: 22,
                }),
            ),
            (
                "binary_type_nullable",
                DataType::Binary(BinaryType {
                    nullable: true,
                    length: 22,
                }),
            ),
            (
                "boolean_type",
                DataType::Boolean(BooleanType { nullable: false }),
            ),
            (
                "boolean_type_nullable",
                DataType::Boolean(BooleanType { nullable: true }),
            ),
            (
                "char_type",
                DataType::Char(CharType {
                    nullable: false,
                    length: 33,
                }),
            ),
            (
                "char_type_nullable",
                DataType::Char(CharType {
                    nullable: true,
                    length: 33,
                }),
            ),
            ("date_type", DataType::Date(DateType { nullable: false })),
            (
                "date_type_nullable",
                DataType::Date(DateType { nullable: true }),
            ),
            (
                "decimal_type",
                DataType::Decimal(DecimalType {
                    nullable: false,
                    precision: 10,
                    scale: 2,
                }),
            ),
            (
                "decimal_type_nullable",
                DataType::Decimal(DecimalType {
                    nullable: true,
                    precision: 10,
                    scale: 2,
                }),
            ),
            (
                "double_type",
                DataType::Double(DoubleType { nullable: false }),
            ),
            (
                "double_type_nullable",
                DataType::Double(DoubleType { nullable: true }),
            ),
            ("float_type", DataType::Float(FloatType { nullable: false })),
            (
                "float_type_nullable",
                DataType::Float(FloatType { nullable: true }),
            ),
            ("int_type", DataType::Int(IntType { nullable: false })),
            (
                "int_type_nullable",
                DataType::Int(IntType { nullable: true }),
            ),
            (
                "local_zoned_timestamp_type",
                DataType::LocalZonedTimestamp(LocalZonedTimestampType {
                    nullable: false,
                    precision: 3,
                }),
            ),
            (
                "local_zoned_timestamp_type_nullable",
                DataType::LocalZonedTimestamp(LocalZonedTimestampType {
                    nullable: true,
                    precision: 6,
                }),
            ),
            (
                "map_type",
                DataType::Map(MapType {
                    nullable: false,
                    key_type: DataType::VarChar(VarCharType {
                        nullable: true,
                        length: 20,
                    })
                    .into(),
                    value_type: DataType::Int(IntType { nullable: false }).into(),
                }),
            ),
            (
                "map_type_nullable",
                DataType::Map(MapType {
                    nullable: true,
                    key_type: DataType::VarChar(VarCharType {
                        nullable: true,
                        length: 20,
                    })
                    .into(),
                    value_type: DataType::Int(IntType { nullable: true }).into(),
                }),
            ),
            (
                "multiset_type",
                DataType::Multiset(MultisetType {
                    nullable: false,
                    element_type: DataType::Int(IntType { nullable: false }).into(),
                }),
            ),
            (
                "multiset_type_nullable",
                DataType::Multiset(MultisetType {
                    nullable: true,
                    element_type: DataType::Int(IntType { nullable: true }).into(),
                }),
            ),
            (
                "row_type",
                DataType::Row(RowType {
                    nullable: false,
                    fields: vec![
                        DataField::new(0, "a".into(), DataType::Int(IntType { nullable: false })),
                        DataField::new(
                            1,
                            "b".into(),
                            DataType::VarChar(VarCharType {
                                nullable: false,
                                length: 20,
                            }),
                        ),
                    ],
                }),
            ),
            (
                "row_type_nullable",
                DataType::Row(RowType {
                    nullable: true,
                    fields: vec![
                        DataField::new(0, "a".into(), DataType::Int(IntType { nullable: true })),
                        DataField::new(
                            1,
                            "b".into(),
                            DataType::VarChar(VarCharType {
                                nullable: true,
                                length: 20,
                            }),
                        ),
                    ],
                }),
            ),
            (
                "smallint_type",
                DataType::SmallInt(SmallIntType { nullable: false }),
            ),
            (
                "smallint_type_nullable",
                DataType::SmallInt(SmallIntType { nullable: true }),
            ),
            (
                "time_type",
                DataType::Time(TimeType {
                    nullable: false,
                    precision: 9,
                }),
            ),
            (
                "time_type_nullable",
                DataType::Time(TimeType {
                    nullable: true,
                    precision: 0,
                }),
            ),
            (
                "timestamp_type",
                DataType::Timestamp(TimestampType {
                    nullable: false,
                    precision: 6,
                }),
            ),
            (
                "timestamp_type_nullable",
                DataType::Timestamp(TimestampType {
                    nullable: true,
                    precision: 6,
                }),
            ),
            (
                "tinyint_type",
                DataType::TinyInt(TinyIntType { nullable: false }),
            ),
            (
                "tinyint_type_nullable",
                DataType::TinyInt(TinyIntType { nullable: true }),
            ),
            (
                "varbinary_type",
                DataType::VarBinary(VarBinaryType {
                    nullable: false,
                    length: 233,
                }),
            ),
            (
                "varbinary_type_nullable",
                DataType::VarBinary(VarBinaryType {
                    nullable: true,
                    length: 233,
                }),
            ),
            (
                "varchar_type",
                DataType::VarChar(VarCharType {
                    nullable: false,
                    length: 33,
                }),
            ),
            (
                "varchar_type_nullable",
                DataType::VarChar(VarCharType {
                    nullable: true,
                    length: 33,
                }),
            ),
            (
                "highly_complex_nested_row_type",
                DataType::Row(RowType::new(vec![
                    DataField::new(
                        0,
                        "outer_row1".to_string(),
                        DataType::Row(RowType::new(vec![
                            DataField::new(
                                0,
                                "middle1_decimal".to_string(),
                                DataType::Decimal(DecimalType::with_nullable(true, 12, 3).unwrap()),
                            ),
                            DataField::new(
                                1,
                                "middle1_inner_row1".to_string(),
                                DataType::Row(RowType::new(vec![
                                    DataField::new(
                                        0,
                                        "inner1_boolean".to_string(),
                                        DataType::Boolean(BooleanType::new()),
                                    ),
                                    DataField::new(
                                        1,
                                        "inner1_int".to_string(),
                                        DataType::Int(IntType::new()),
                                    ),
                                    DataField::new(
                                        2,
                                        "inner1_varchar".to_string(),
                                        DataType::VarChar(
                                            VarCharType::with_nullable(true, 100).unwrap(),
                                        ),
                                    ),
                                ])),
                            ),
                            DataField::new(
                                2,
                                "middle1_array".to_string(),
                                DataType::Array(ArrayType::new(DataType::Map(MapType::new(
                                    DataType::VarChar(
                                        VarCharType::with_nullable(true, 50).unwrap(),
                                    ),
                                    DataType::Int(IntType::new()),
                                )))),
                            ),
                        ])),
                    ),
                    DataField::new(
                        1,
                        "outer_row2".to_string(),
                        DataType::Row(RowType::new(vec![
                            DataField::new(
                                0,
                                "middle2_multiset".to_string(),
                                DataType::Multiset(MultisetType::new(DataType::Timestamp(
                                    TimestampType::with_nullable(true, 6).unwrap(),
                                ))),
                            ),
                            DataField::new(
                                1,
                                "middle2_inner_row2".to_string(),
                                DataType::Row(RowType::new(vec![
                                    DataField::new(
                                        0,
                                        "inner2_char".to_string(),
                                        DataType::Char(CharType::with_nullable(true, 50).unwrap()),
                                    ),
                                    DataField::new(
                                        1,
                                        "inner2_float".to_string(),
                                        DataType::Float(FloatType::new()),
                                    ),
                                    DataField::new(
                                        2,
                                        "inner2_binary".to_string(),
                                        DataType::Binary(
                                            BinaryType::with_nullable(true, 256).unwrap(),
                                        ),
                                    ),
                                ])),
                            ),
                            DataField::new(
                                2,
                                "middle2_map".to_string(),
                                DataType::Map(MapType::new(
                                    DataType::Char(CharType::with_nullable(true, 10).unwrap()),
                                    DataType::Row(RowType::new(vec![
                                        DataField::new(
                                            0,
                                            "inner1_boolean".to_string(),
                                            DataType::Boolean(BooleanType::new()),
                                        ),
                                        DataField::new(
                                            1,
                                            "inner1_int".to_string(),
                                            DataType::Int(IntType::new()),
                                        ),
                                        DataField::new(
                                            2,
                                            "inner1_varchar".to_string(),
                                            DataType::VarChar(
                                                VarCharType::with_nullable(true, 100).unwrap(),
                                            ),
                                        ),
                                    ])),
                                )),
                            ),
                        ])),
                    ),
                    DataField::new(
                        2,
                        "outer_map".to_string(),
                        DataType::Map(MapType::new(
                            DataType::VarChar(VarCharType::with_nullable(true, 30).unwrap()),
                            DataType::Row(RowType::new(vec![
                                DataField::new(
                                    0,
                                    "middle1_decimal".to_string(),
                                    DataType::Decimal(
                                        DecimalType::with_nullable(true, 12, 3).unwrap(),
                                    ),
                                ),
                                DataField::new(
                                    1,
                                    "middle1_inner_row1".to_string(),
                                    DataType::Row(RowType::new(vec![
                                        DataField::new(
                                            0,
                                            "inner1_boolean".to_string(),
                                            DataType::Boolean(BooleanType::new()),
                                        ),
                                        DataField::new(
                                            1,
                                            "inner1_int".to_string(),
                                            DataType::Int(IntType::new()),
                                        ),
                                        DataField::new(
                                            2,
                                            "inner1_varchar".to_string(),
                                            DataType::VarChar(
                                                VarCharType::with_nullable(true, 100).unwrap(),
                                            ),
                                        ),
                                    ])),
                                ),
                                DataField::new(
                                    2,
                                    "middle1_array".to_string(),
                                    DataType::Array(ArrayType::new(DataType::Map(MapType::new(
                                        DataType::VarChar(
                                            VarCharType::with_nullable(true, 50).unwrap(),
                                        ),
                                        DataType::Int(IntType::new()),
                                    )))),
                                ),
                            ])),
                        )),
                    ),
                    DataField::new(
                        3,
                        "outer_array".to_string(),
                        DataType::Array(ArrayType::new(DataType::Row(RowType::new(vec![
                            DataField::new(
                                0,
                                "middle2_multiset".to_string(),
                                DataType::Multiset(MultisetType::new(DataType::Timestamp(
                                    TimestampType::with_nullable(true, 6).unwrap(),
                                ))),
                            ),
                            DataField::new(
                                1,
                                "middle2_inner_row2".to_string(),
                                DataType::Row(RowType::new(vec![
                                    DataField::new(
                                        0,
                                        "inner2_char".to_string(),
                                        DataType::Char(CharType::with_nullable(true, 50).unwrap()),
                                    ),
                                    DataField::new(
                                        1,
                                        "inner2_float".to_string(),
                                        DataType::Float(FloatType::new()),
                                    ),
                                    DataField::new(
                                        2,
                                        "inner2_binary".to_string(),
                                        DataType::Binary(
                                            BinaryType::with_nullable(true, 256).unwrap(),
                                        ),
                                    ),
                                ])),
                            ),
                            DataField::new(
                                2,
                                "middle2_map".to_string(),
                                DataType::Map(MapType::new(
                                    DataType::Char(CharType::with_nullable(true, 10).unwrap()),
                                    DataType::Row(RowType::new(vec![
                                        DataField::new(
                                            0,
                                            "inner1_boolean".to_string(),
                                            DataType::Boolean(BooleanType::new()),
                                        ),
                                        DataField::new(
                                            1,
                                            "inner1_int".to_string(),
                                            DataType::Int(IntType::new()),
                                        ),
                                        DataField::new(
                                            2,
                                            "inner1_varchar".to_string(),
                                            DataType::VarChar(
                                                VarCharType::with_nullable(true, 100).unwrap(),
                                            ),
                                        ),
                                    ])),
                                )),
                            ),
                        ])))),
                    ),
                    DataField::new(
                        4,
                        "outer_multiset".to_string(),
                        DataType::Multiset(MultisetType::new(DataType::Row(RowType::new(vec![
                            DataField::new(
                                0,
                                "deep_inner_decimal".to_string(),
                                DataType::Decimal(DecimalType::with_nullable(true, 10, 2).unwrap()),
                            ),
                            DataField::new(
                                1,
                                "deep_inner_varbinary".to_string(),
                                DataType::VarBinary(VarBinaryType::try_new(true, 128).unwrap()),
                            ),
                        ])))),
                    ),
                ])),
            ),
        ]
    }