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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cassandra/cluster/schema/fetchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.

if column_data['type'][0] == "'"
# This is a custom column type.
type = Types.custom(column_data['type'].slice(1, column_data['type'].length - 2))
Expand Down