tensorbase icon indicating copy to clipboard operation
tensorbase copied to clipboard

support Nullable types

Open jinmingjian opened this issue 4 years ago • 9 comments

part of #18

jinmingjian avatar May 07 '21 13:05 jinmingjian

/assign

Enochack avatar May 24 '21 02:05 Enochack

I'd like to pick this issue. Is it resolved now?

Enochack avatar May 24 '21 02:05 Enochack

@Thysinner thanks. No one resolve this. And this issue is a little non-trivial. :pray:

jinmingjian avatar May 24 '21 04:05 jinmingjian

What's your idea about the issue? It will be great if I could continue to make progress on the basis of your ideas.

Enochack avatar May 24 '21 04:05 Enochack

@Thysinner I mean you may pick up issues by your understanding. There are many good-first-issues or help-wanted issues. However, if you understand this issue, it is still great to make it done. I will help you if you meet problem.

jinmingjian avatar May 24 '21 04:05 jinmingjian

Refer to https://clickhouse.tech/docs/en/sql-reference/data-types/nullable/, the Nullable wrapped data types are restricted. And I saw the TB grammar file has restricted the wrapped data types to simple type and decimal type. So could we assume that the Nullable wrapped data types in the meta data are always valid since the grammar file is forcing users to create valid Nullable columns?

Enochack avatar May 24 '21 08:05 Enochack

Otherwise, we will always need to check the wrapped data type like this

BqlType::Nullable(bt) => match bt {
    BqlType::Int(_)
    | BqlType::UInt(_)
    | BqlType::Float(_)
    | BqlType::DateTime
    | BqlType::Date
    | BqlType::Decimal(_, _) => bt.size(),
    _ => Err(MetaError::InvalidNullableDataType),
}

Which is ugly and likely to consume more CPU

Enochack avatar May 24 '21 08:05 Enochack

@Thysinner this is not important for prototyping. Just show a primary working PR. Then we can start from that.

jinmingjian avatar May 24 '21 08:05 jinmingjian

Thanks for the suggestion

Enochack avatar May 24 '21 09:05 Enochack