Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a case sensitivity issue when fetching the clustering order #256

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sebweaver
Copy link

@sebweaver sebweaver commented Jul 4, 2019

I discovered this issue when using the driver with a Scylla database, which is supposed to use the same protocol. Scylla returns DESC instead of desc. So I think this fix could handle both cases.

@@ -1361,7 +1361,7 @@ def create_table_options(table_data, compaction_strategy, is_compact)
def create_column(column_data, types)
name = column_data['column_name']
is_static = column_data['kind'].to_s.casecmp('STATIC').zero?
order = column_data['clustering_order'] == 'desc' ? :desc : :asc
order = column_data['clustering_order'].to_s.casecmp('DESC').zero? ? :desc : :asc
Copy link

Choose a reason for hiding this comment

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

Why not use casecmp? ? It would allow to write it like this:

column_data['clustering_order'].to_s.casecmp?('DESC') ? :desc : :asc

Copy link
Author

Choose a reason for hiding this comment

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

@kapcod Sure! I wrote it like that just to be consistent with the style of the line above which uses casecmp('STATIC').zero?. But I can change it with casecmp? (which is more straightforward) if you prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants