Skip to content
Open
Show file tree
Hide file tree
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 bolt/type/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ class DecimalType : public ScalarType<KIND> {
public:
static_assert(KIND == TypeKind::BIGINT || KIND == TypeKind::HUGEINT);
static constexpr uint8_t kMaxPrecision = KIND == TypeKind::BIGINT ? 18 : 38;
static constexpr uint8_t kMinPrecision = KIND == TypeKind::BIGINT ? 0 : 19;
static constexpr uint8_t kMinPrecision = KIND == TypeKind::BIGINT ? 1 : 19;

inline bool equivalent(const Type& other) const override {
if (!Type::hasSameTypeId(other)) {
Expand Down
3 changes: 3 additions & 0 deletions bolt/type/tests/TypeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ TEST(TypeTest, shortDecimal) {
EXPECT_NE(*DECIMAL(9, 5), *shortDecimal);
EXPECT_NE(*DECIMAL(10, 4), *shortDecimal);

BOLT_ASSERT_THROW(
DECIMAL(0, 0), "Precision of decimal type must be at least 1");

EXPECT_STREQ(shortDecimal->name(), "DECIMAL");
EXPECT_EQ(shortDecimal->parameters().size(), 2);
EXPECT_TRUE(
Expand Down