Skip to content

Bug with tuple #1909

@Tang8330

Description

@Tang8330

I'm running this:

func (i *snapshotIterator) Next() ([]map[string]any, error) {
	if i.done {
		return nil, fmt.Errorf("no more rows to scan")
	}

	if i.iter == nil {
		colNames := make([]string, len(i.columns))
		for idx, col := range i.columns {
			// Cassandra identifiers are typically lowercase; avoid quoting to keep it simple.
			colNames[idx] = col.Name
		}

		// Build fully-qualified table name keyspace.table
		stmt := fmt.Sprintf("SELECT %s FROM %s.%s", strings.Join(colNames, ","), i.keyspace, i.tableName)
		fmt.Println("stmt", stmt)
		i.iter = i.session.Query(stmt).PageSize(i.batchSize).Iter()
	}

	var rows []map[string]any
	for len(rows) < i.batchSize {
		row := make(map[string]any)
		if !i.iter.MapScan(row) {
			i.done = true
			break
		}

		out, err := i.normalizeRow(row)
		if err != nil {
			return nil, fmt.Errorf("failed to normalize row: %w", err)
		}

		rows = append(rows, out)
	}

	return rows, nil
}

You can clearly see that c_tuple_int_text is null:

Image

However, this is what I'm getting back:

stmt SELECT id,c_ascii,c_bigint,c_blob,c_boolean,c_date,c_decimal,c_double,c_float,c_frozen_list_int,c_inet,c_int,c_smallint,c_text,c_time,c_timestamp,c_timeuuid,c_tinyint,c_tuple_int_text,c_uuid,c_varchar,c_varint,c_list_int,c_map_text_int,c_set_int FROM artie_test.data_type_test
key c_double value 4.14159
key c_time value 12h34m56s
key c_timestamp value 2025-09-10 23:45:22.811 +0000 UTC
key c_tinyint value 42
key c_varint value 1234567890123456789
key c_timeuuid value 37a76f2c-8ea0-11f0-bed0-d6c22f62521e
key c_list_int value [10]
key c_map_text_int value map[a:1 b:2]
key c_set_int value [1]
key c_ascii value ascii_1
key c_boolean value false
key c_decimal value 123.45
key c_float value 3.71828
key c_tuple_int_text[0] value 0
key c_tuple_int_text[1] value
key c_varchar value varchar_1
key id value 2
key c_blob value [1 2 3 1]
key c_frozen_list_int value [1]
key c_inet value 10.0.1.2
key c_int value 1001
key c_smallint value 1234
key c_text value text_1
key c_uuid value baed9c37-e600-497d-857d-852d395dad07
key c_bigint value 9000000001
key c_date value 2025-09-10 00:00:00 +0000 UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions