Skip to content

Improve support of integer keys in data type Map#21157

Merged
nikitamikhaylov merged 7 commits intoClickHouse:masterfrom
CurtizJ:fix-type-map
Mar 11, 2021
Merged

Improve support of integer keys in data type Map#21157
nikitamikhaylov merged 7 commits intoClickHouse:masterfrom
CurtizJ:fix-type-map

Conversation

@CurtizJ
Copy link
Copy Markdown
Member

@CurtizJ CurtizJ commented Feb 24, 2021

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Improve support of integer keys in data type Map.

@robot-clickhouse robot-clickhouse added the pr-improvement Pull request with some product improvements label Feb 24, 2021
@nikitamikhaylov nikitamikhaylov self-assigned this Feb 25, 2021
Copy link
Copy Markdown
Member

@nikitamikhaylov nikitamikhaylov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also there are some questions


void DataTypeMap::assertKeyType() const
{
if (!key_type->isValueRepresentedByInteger() && !isStringOrFixedString(*key_type) && !WhichDataType(key_type).isNothing())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you check type Nothing here? How nothing can represent a map key?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To allow creating of empty maps for queries like this select count() from t where m != map()

}
}

/// For maps
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it needed? To define equality operation on Map type or I am wrong?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's needed for comparisons.

{
return ParserSubquery().parse(pos, node, expected)
|| ParserTupleOfLiterals().parse(pos, node, expected)
|| ParserMapOfLiterals().parse(pos, node, expected)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Does this code enable when I query select map(1, 2) ?

Copy link
Copy Markdown
Member Author

@CurtizJ CurtizJ Mar 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParserMapOfLiterals was used to parse literals in form of {key : value}, but currently we decided to remove this syntax.

@nikitamikhaylov nikitamikhaylov merged commit 5ac5ae3 into ClickHouse:master Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants