Skip to content

Commit

Permalink
Fixed CharRangeFilter to properly handle the new NULL_CHAR value (#1566)
Browse files Browse the repository at this point in the history
* Fixed CharRangeFilter to properly handle the new NULL_CHAR.

* Added a min and max value for char.
  • Loading branch information
chipkent authored Nov 16, 2021
1 parent 9f70fe5 commit 53f9df8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ static SelectFilter makeCharRangeFilter(String columnName, Condition condition,
case LESS_THAN_OR_EQUAL:
return new CharRangeFilter(columnName, RangeConditionFilter.parseCharFilter(value), QueryConstants.NULL_CHAR, true, true);
case GREATER_THAN:
return new CharRangeFilter(columnName, RangeConditionFilter.parseCharFilter(value), Character.MAX_VALUE, false, true);
return new CharRangeFilter(columnName, RangeConditionFilter.parseCharFilter(value), QueryConstants.MAX_CHAR, false, true);
case GREATER_THAN_OR_EQUAL:
return new CharRangeFilter(columnName, RangeConditionFilter.parseCharFilter(value), Character.MAX_VALUE, true, true);
return new CharRangeFilter(columnName, RangeConditionFilter.parseCharFilter(value), QueryConstants.MAX_CHAR, true, true);
default:
throw new IllegalArgumentException("RangeConditionFilter does not support condition " + condition);
}
Expand Down
10 changes: 10 additions & 0 deletions Util/src/main/java/io/deephaven/util/QueryConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ private QueryConstants() {}
*/
public static final Character NULL_CHAR_BOXED = NULL_CHAR;

/**
* Minimum value of type char.
*/
public static final char MIN_CHAR = Character.MIN_VALUE;

/**
* Maximum value of type char.
*/
public static final char MAX_CHAR = Character.MAX_VALUE - 1;


/////////////////////////////////////////////////////////////////

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace highlevel {
class DeephavenConstants {
public:
static constexpr const char16_t NULL_CHAR = std::numeric_limits<char16_t>::max();
static constexpr const char16_t MIN_CHAR = std::numeric_limits<char16_t>::min();
static constexpr const char16_t MAX_CHAR = std::numeric_limits<char16_t>::max() - 1;

static constexpr const float NULL_FLOAT = -std::numeric_limits<float>::max();
static constexpr const float NAN_FLOAT = std::numeric_limits<float>::quiet_NaN();
Expand Down

0 comments on commit 53f9df8

Please sign in to comment.