[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-19 Thread Grant Henke (Code Review)
Grant Henke has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/9363


Change subject: KUDU-721: Support range partitions on decimal columns
..

KUDU-721: Support range partitions on decimal columns

Add the DataType handling to enable range partitions on
decimal columns and a test that fails without the changes.

Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
---
M src/kudu/client/client-test.cc
M src/kudu/common/partition.cc
M src/kudu/util/decimal_util-test.cc
M src/kudu/util/decimal_util.cc
M src/kudu/util/decimal_util.h
5 files changed, 68 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/63/9363/1
--
To view, visit http://gerrit.cloudera.org:8080/9363
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
Gerrit-Change-Number: 9363
Gerrit-PatchSet: 1
Gerrit-Owner: Grant Henke 


[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-20 Thread Alexey Serbin (Code Review)
Alexey Serbin has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/9363 )

Change subject: KUDU-721: Support range partitions on decimal columns
..


Patch Set 1:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/client/client-test.cc
File src/kudu/client/client-test.cc:

http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/client/client-test.cc@1639
PS1, Line 1639: u_schema_
nit: I don't think we use identifiers like 'x_' for local variables; would 
'u_schema' suffice here?


http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/client/client-test.cc@1643
PS1, Line 1643: CHECK_OK
why not just ASSERT_OK() ?


http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/client/client-test.cc@1645
PS1, Line 1645:   unique_ptr lower_bound(u_schema_.NewRow());
  :   ASSERT_OK(lower_bound->SetUnscaledDecimal("key", -1));
  :   unique_ptr upper_bound(u_schema_.NewRow());
  :   ASSERT_OK(upper_bound->SetUnscaledDecimal("key", 99));
I think it would be nice to add a 'negative' test case (maybe, in some 
different scenario) to test for:
  * swapped upper/lower bounds (e.g., upper -1, lower 99)
  * bounds that lead to an empty partition (e.g. lower 10, upper 10)
  * bounds with MAX and MIN values


http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/common/partition.cc
File src/kudu/common/partition.cc:

http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/common/partition.cc@1043
PS1, Line 1043: ColumnSchema
const reference?



-- 
To view, visit http://gerrit.cloudera.org:8080/9363
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
Gerrit-Change-Number: 9363
Gerrit-PatchSet: 1
Gerrit-Owner: Grant Henke 
Gerrit-Reviewer: Alexey Serbin 
Gerrit-Reviewer: Dan Burkert 
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Comment-Date: Tue, 20 Feb 2018 22:59:18 +
Gerrit-HasComments: Yes


[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-20 Thread Dan Burkert (Code Review)
Dan Burkert has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/9363 )

Change subject: KUDU-721: Support range partitions on decimal columns
..


Patch Set 1:

LGTM with Alexey's points addressed


--
To view, visit http://gerrit.cloudera.org:8080/9363
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
Gerrit-Change-Number: 9363
Gerrit-PatchSet: 1
Gerrit-Owner: Grant Henke 
Gerrit-Reviewer: Alexey Serbin 
Gerrit-Reviewer: Dan Burkert 
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Comment-Date: Tue, 20 Feb 2018 23:07:43 +
Gerrit-HasComments: No


[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-20 Thread Grant Henke (Code Review)
Hello Alexey Serbin, Dan Burkert, Kudu Jenkins,

I'd like you to reexamine a change. Please visit

http://gerrit.cloudera.org:8080/9363

to look at the new patch set (#2).

Change subject: KUDU-721: Support range partitions on decimal columns
..

KUDU-721: Support range partitions on decimal columns

Add the DataType handling to enable range partitions on
decimal columns and a test that fails without the changes.

Also adds range partition tests for edge cases where:
* The upper bound is less than than the lower bound
* The upper bound is equal to the lower bound
* The bounds use MIN/MAX values

Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
---
M src/kudu/client/client-test.cc
M src/kudu/common/partition.cc
M src/kudu/util/decimal_util-test.cc
M src/kudu/util/decimal_util.cc
M src/kudu/util/decimal_util.h
5 files changed, 155 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/63/9363/2
--
To view, visit http://gerrit.cloudera.org:8080/9363
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
Gerrit-Change-Number: 9363
Gerrit-PatchSet: 2
Gerrit-Owner: Grant Henke 
Gerrit-Reviewer: Alexey Serbin 
Gerrit-Reviewer: Dan Burkert 
Gerrit-Reviewer: Kudu Jenkins


[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-20 Thread Grant Henke (Code Review)
Grant Henke has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/9363 )

Change subject: KUDU-721: Support range partitions on decimal columns
..


Patch Set 2:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/client/client-test.cc
File src/kudu/client/client-test.cc:

http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/client/client-test.cc@1639
PS1, Line 1639: schema;
> nit: I don't think we use identifiers like 'x_' for local variables; would
Ah, right. I copied this test from the UnixTimeMicros one above. Will update 
both.


http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/client/client-test.cc@1643
PS1, Line 1643: ASSERT_O
> why not just ASSERT_OK() ?
Done


http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/client/client-test.cc@1645
PS1, Line 1645:   unique_ptr lower_bound(schema.NewRow());
  :   ASSERT_OK(lower_bound->SetUnscaledDecimal("key", -1));
  :   unique_ptr upper_bound(schema.NewRow());
  :   ASSERT_OK(upper_bound->SetUnscaledDecimal("key", 99));
> I think it would be nice to add a 'negative' test case (maybe, in some diff
Done


http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/common/partition.cc
File src/kudu/common/partition.cc:

http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/common/partition.cc@1043
PS1, Line 1043: const ColumnS
> const reference?
Done



--
To view, visit http://gerrit.cloudera.org:8080/9363
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
Gerrit-Change-Number: 9363
Gerrit-PatchSet: 2
Gerrit-Owner: Grant Henke 
Gerrit-Reviewer: Alexey Serbin 
Gerrit-Reviewer: Dan Burkert 
Gerrit-Reviewer: Grant Henke 
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Comment-Date: Wed, 21 Feb 2018 05:01:38 +
Gerrit-HasComments: Yes


[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-21 Thread Alexey Serbin (Code Review)
Alexey Serbin has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/9363 )

Change subject: KUDU-721: Support range partitions on decimal columns
..


Patch Set 2: Code-Review+1

(5 comments)

http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/client/client-test.cc
File src/kudu/client/client-test.cc:

http://gerrit.cloudera.org:8080/#/c/9363/1/src/kudu/client/client-test.cc@1639
PS1, Line 1639: schema;
> Ah, right. I copied this test from the UnixTimeMicros one above. Will updat
Thanks!


http://gerrit.cloudera.org:8080/#/c/9363/2/src/kudu/client/client-test.cc
File src/kudu/client/client-test.cc:

http://gerrit.cloudera.org:8080/#/c/9363/2/src/kudu/client/client-test.cc@1662
PS2, Line 1662: TEST_F(ClientTest, TestSwappedRangeBounds) {
  :   KuduSchemaBuilder builder;
  :   KuduSchema schema;
  :   
builder.AddColumn("key")->Type(KuduColumnSchema::INT32)->NotNull()->PrimaryKey();
  :   
builder.AddColumn("value")->Type(KuduColumnSchema::INT32)->NotNull();
  :   ASSERT_OK(builder.Build(&schema));
  :
  :   unique_ptr lower_bound(schema.NewRow());
  :   ASSERT_OK(lower_bound->SetInt32("key", 90));
  :   unique_ptr upper_bound(schema.NewRow());
  :   ASSERT_OK(upper_bound->SetInt32("key", -1));
  :
  :   unique_ptr 
table_creator(client_->NewTableCreator());
  :   table_creator->add_range_partition(lower_bound.release(), 
upper_bound.release(),
  :  
KuduTableCreator::EXCLUSIVE_BOUND,
  :  
KuduTableCreator::INCLUSIVE_BOUND);
  :
  :   Status s = table_creator->table_name("TestSwappedRangeBounds")
  : .schema(&schema)
  : .num_replicas(1)
  : .set_range_partition_columns({ "key" })
  : .Create();
  :
  :   ASSERT_TRUE(s.IsInvalidArgument());
  :   ASSERT_STR_CONTAINS(s.ToString(),
  :   "Error creating table 
TestSwappedRangeBounds on the master: "
  :   "range partition lower bound must be 
less than the upper bound");
  : }
  :
  :
  : TEST_F(ClientTest, TestEqualRangeBounds) {
  :   KuduSchemaBuilder builder;
  :   KuduSchema schema;
  :   
builder.AddColumn("key")->Type(KuduColumnSchema::INT32)->NotNull()->PrimaryKey();
  :   
builder.AddColumn("value")->Type(KuduColumnSchema::INT32)->NotNull();
  :   ASSERT_OK(builder.Build(&schema));
  :
  :   unique_ptr lower_bound(schema.NewRow());
  :   ASSERT_OK(lower_bound->SetInt32("key", 10));
  :   unique_ptr upper_bound(schema.NewRow());
  :   ASSERT_OK(upper_bound->SetInt32("key", 10));
  :
  :   unique_ptr 
table_creator(client_->NewTableCreator());
  :   table_creator->add_range_partition(lower_bound.release(), 
upper_bound.release(),
  :  
KuduTableCreator::EXCLUSIVE_BOUND,
  :  
KuduTableCreator::INCLUSIVE_BOUND);
  :
  :   Status s = table_creator->table_name("TestEqualRangeBounds")
  :   .schema(&schema)
  :   .num_replicas(1)
  :   .set_range_partition_columns({ "key" })
  :   .Create();
  :
  :   ASSERT_TRUE(s.IsInvalidArgument());
  :   ASSERT_STR_CONTAINS(s.ToString(),
  :   "Error creating table 
TestEqualRangeBounds on the master: "
  :   "range partition lower bound must be 
less than the upper bound");
  : }
  :
  : TEST_F(ClientTest, TestMinMaxRangeBounds) {
  :   KuduSchemaBuilder builder;
  :   KuduSchema schema;
  :   
builder.AddColumn("key")->Type(KuduColumnSchema::INT32)->NotNull()->PrimaryKey();
  :   
builder.AddColumn("value")->Type(KuduColumnSchema::INT32)->NotNull();
  :   ASSERT_OK(builder.Build(&schema));
  :
  :   unique_ptr lower_bound(schema.NewRow());
  :   ASSERT_OK(lower_bound->SetInt32("key", INT32_MIN));
  :   unique_ptr upper_bound(schema.NewRow());
  :   ASSERT_OK(upper_bound->SetInt32("key", INT32_MAX));
  :
  :   unique_ptr 
table_creator(client_->NewTableCreator());
  :   table_creator->add_range_partition(lower_bound.release(), 
upper_bound.release(),
  :  

[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-21 Thread Grant Henke (Code Review)
Hello Alexey Serbin, Dan Burkert, Kudu Jenkins,

I'd like you to reexamine a change. Please visit

http://gerrit.cloudera.org:8080/9363

to look at the new patch set (#3).

Change subject: KUDU-721: Support range partitions on decimal columns
..

KUDU-721: Support range partitions on decimal columns

Add the DataType handling to enable range partitions on
decimal columns and a test that fails without the changes.

Also adds range partition tests for edge cases where:
* The upper bound is less than than the lower bound
* The upper bound is equal to the lower bound
* The bounds use MIN/MAX values

Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
---
M python/kudu/client.pyx
M src/kudu/client/client-test.cc
M src/kudu/common/partition.cc
M src/kudu/util/decimal_util-test.cc
M src/kudu/util/decimal_util.cc
M src/kudu/util/decimal_util.h
6 files changed, 157 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/63/9363/3
--
To view, visit http://gerrit.cloudera.org:8080/9363
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
Gerrit-Change-Number: 9363
Gerrit-PatchSet: 3
Gerrit-Owner: Grant Henke 
Gerrit-Reviewer: Alexey Serbin 
Gerrit-Reviewer: Dan Burkert 
Gerrit-Reviewer: Grant Henke 
Gerrit-Reviewer: Kudu Jenkins


[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-21 Thread Alexey Serbin (Code Review)
Alexey Serbin has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/9363 )

Change subject: KUDU-721: Support range partitions on decimal columns
..


Patch Set 3:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/9363/3/python/kudu/client.pyx
File python/kudu/client.pyx:

http://gerrit.cloudera.org:8080/#/c/9363/3/python/kudu/client.pyx@1437
PS3, Line 1437: ``
Is this intended or just a part from some other patch?


http://gerrit.cloudera.org:8080/#/c/9363/2/src/kudu/client/client-test.cc
File src/kudu/client/client-test.cc:

http://gerrit.cloudera.org:8080/#/c/9363/2/src/kudu/client/client-test.cc@1662
PS2, Line 1662: TEST_F(ClientTest, TestSwappedRangeBounds) {
  :   KuduSchemaBuilder builder;
  :   KuduSchema schema;
  :   
builder.AddColumn("key")->Type(KuduColumnSchema::INT32)->NotNull()->PrimaryKey();
  :   
builder.AddColumn("value")->Type(KuduColumnSchema::INT32)->NotNull();
  :   ASSERT_OK(builder.Build(&schema));
  :
  :   unique_ptr lower_bound(schema.NewRow());
  :   ASSERT_OK(lower_bound->SetInt32("key", 90));
  :   unique_ptr upper_bound(schema.NewRow());
  :   ASSERT_OK(upper_bound->SetInt32("key", -1));
  :
  :   unique_ptr 
table_creator(client_->NewTableCreator());
  :   table_creator->add_range_partition(lower_bound.release(), 
upper_bound.release(),
  :  
KuduTableCreator::EXCLUSIVE_BOUND,
  :  
KuduTableCreator::INCLUSIVE_BOUND);
  :
  :   Status s = table_creator->table_name("TestSwappedRangeBounds")
  : .schema(&schema)
  : .num_replicas(1)
  : .set_range_partition_columns({ "key" })
  : .Create();
  :
  :   ASSERT_TRUE(s.IsInvalidArgument());
  :   ASSERT_STR_CONTAINS(s.ToString(),
  :   "Error creating table 
TestSwappedRangeBounds on the master: "
  :   "range partition lower bound must be 
less than the upper bound");
  : }
  :
  :
  : TEST_F(ClientTest, TestEqualRangeBounds) {
  :   KuduSchemaBuilder builder;
  :   KuduSchema schema;
  :   
builder.AddColumn("key")->Type(KuduColumnSchema::INT32)->NotNull()->PrimaryKey();
  :   
builder.AddColumn("value")->Type(KuduColumnSchema::INT32)->NotNull();
  :   ASSERT_OK(builder.Build(&schema));
  :
  :   unique_ptr lower_bound(schema.NewRow());
  :   ASSERT_OK(lower_bound->SetInt32("key", 10));
  :   unique_ptr upper_bound(schema.NewRow());
  :   ASSERT_OK(upper_bound->SetInt32("key", 10));
  :
  :   unique_ptr 
table_creator(client_->NewTableCreator());
  :   table_creator->add_range_partition(lower_bound.release(), 
upper_bound.release(),
  :  
KuduTableCreator::EXCLUSIVE_BOUND,
  :  
KuduTableCreator::INCLUSIVE_BOUND);
  :
  :   Status s = table_creator->table_name("TestEqualRangeBounds")
  :   .schema(&schema)
  :   .num_replicas(1)
  :   .set_range_partition_columns({ "key" })
  :   .Create();
  :
  :   ASSERT_TRUE(s.IsInvalidArgument());
  :   ASSERT_STR_CONTAINS(s.ToString(),
  :   "Error creating table 
TestEqualRangeBounds on the master: "
  :   "range partition lower bound must be 
less than the upper bound");
  : }
  :
  : TEST_F(ClientTest, TestMinMaxRangeBounds) {
  :   KuduSchemaBuilder builder;
  :   KuduSchema schema;
  :   
builder.AddColumn("key")->Type(KuduColumnSchema::INT32)->NotNull()->PrimaryKey();
  :   
builder.AddColumn("value")->Type(KuduColumnSchema::INT32)->NotNull();
  :   ASSERT_OK(builder.Build(&schema));
  :
  :   unique_ptr lower_bound(schema.NewRow());
  :   ASSERT_OK(lower_bound->SetInt32("key", INT32_MIN));
  :   unique_ptr upper_bound(schema.NewRow());
  :   ASSERT_OK(upper_bound->SetInt32("key", INT32_MAX));
  :
  :   unique_ptr 
table_creator(client_->NewTableCreator());
  :   table_creator->add_range_partition(lower_bound.release(), 
upper_bound.release(),
  :  
KuduTableCreator::EXCLUSIVE_BOUND,
  

[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-21 Thread Alexey Serbin (Code Review)
Alexey Serbin has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/9363 )

Change subject: KUDU-721: Support range partitions on decimal columns
..


Patch Set 4: Code-Review+2


--
To view, visit http://gerrit.cloudera.org:8080/9363
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
Gerrit-Change-Number: 9363
Gerrit-PatchSet: 4
Gerrit-Owner: Grant Henke 
Gerrit-Reviewer: Alexey Serbin 
Gerrit-Reviewer: Dan Burkert 
Gerrit-Reviewer: Grant Henke 
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Comment-Date: Wed, 21 Feb 2018 19:15:48 +
Gerrit-HasComments: No


[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-21 Thread Grant Henke (Code Review)
Grant Henke has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/9363 )

Change subject: KUDU-721: Support range partitions on decimal columns
..


Patch Set 3:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/9363/3/python/kudu/client.pyx
File python/kudu/client.pyx:

http://gerrit.cloudera.org:8080/#/c/9363/3/python/kudu/client.pyx@1437
PS3, Line 1437: ``
> Is this intended or just a part from some other patch?
oh, my bad. Switching branches to quickly.



--
To view, visit http://gerrit.cloudera.org:8080/9363
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
Gerrit-Change-Number: 9363
Gerrit-PatchSet: 3
Gerrit-Owner: Grant Henke 
Gerrit-Reviewer: Alexey Serbin 
Gerrit-Reviewer: Dan Burkert 
Gerrit-Reviewer: Grant Henke 
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Comment-Date: Wed, 21 Feb 2018 19:01:37 +
Gerrit-HasComments: Yes


[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-21 Thread Grant Henke (Code Review)
Grant Henke has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/9363 )

Change subject: KUDU-721: Support range partitions on decimal columns
..


Patch Set 3:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/9363/2/src/kudu/client/client-test.cc
File src/kudu/client/client-test.cc:

http://gerrit.cloudera.org:8080/#/c/9363/2/src/kudu/client/client-test.cc@1662
PS2, Line 1662: TEST_F(ClientTest, TestSwappedRangeBounds) {
  :   KuduSchemaBuilder builder;
  :   KuduSchema schema;
  :   
builder.AddColumn("key")->Type(KuduColumnSchema::INT32)->NotNull()->PrimaryKey();
  :   
builder.AddColumn("value")->Type(KuduColumnSchema::INT32)->NotNull();
  :   ASSERT_OK(builder.Build(&schema));
  :
  :   unique_ptr lower_bound(schema.NewRow());
  :   ASSERT_OK(lower_bound->SetInt32("key", 90));
  :   unique_ptr upper_bound(schema.NewRow());
  :   ASSERT_OK(upper_bound->SetInt32("key", -1));
  :
  :   unique_ptr 
table_creator(client_->NewTableCreator());
  :   table_creator->add_range_partition(lower_bound.release(), 
upper_bound.release(),
  :  
KuduTableCreator::EXCLUSIVE_BOUND,
  :  
KuduTableCreator::INCLUSIVE_BOUND);
  :
  :   Status s = table_creator->table_name("TestSwappedRangeBounds")
  : .schema(&schema)
  : .num_replicas(1)
  : .set_range_partition_columns({ "key" })
  : .Create();
  : 
  :   ASSERT_TRUE(s.IsInvalidArgument());
  :   ASSERT_STR_CONTAINS(s.ToString(),
  :   "Error creating table 
TestSwappedRangeBounds on the master: "
  :   "range partition lower bound must be 
less than the upper bound");
  : }
  :
  :
  : TEST_F(ClientTest, TestEqualRangeBounds) {
  :   KuduSchemaBuilder builder;
  :   KuduSchema schema;
  :   
builder.AddColumn("key")->Type(KuduColumnSchema::INT32)->NotNull()->PrimaryKey();
  :   
builder.AddColumn("value")->Type(KuduColumnSchema::INT32)->NotNull();
  :   ASSERT_OK(builder.Build(&schema));
  :
  :   unique_ptr lower_bound(schema.NewRow());
  :   ASSERT_OK(lower_bound->SetInt32("key", 10));
  :   unique_ptr upper_bound(schema.NewRow());
  :   ASSERT_OK(upper_bound->SetInt32("key", 10));
  :
  :   unique_ptr 
table_creator(client_->NewTableCreator());
  :   table_creator->add_range_partition(lower_bound.release(), 
upper_bound.release(),
  :  
KuduTableCreator::EXCLUSIVE_BOUND,
  :  
KuduTableCreator::INCLUSIVE_BOUND);
  :
  :   Status s = table_creator->table_name("TestEqualRangeBounds")
  :   .schema(&schema)
  :   .num_replicas(1)
  :   .set_range_partition_columns({ "key" })
  :   .Create();
  :
  :   ASSERT_TRUE(s.IsInvalidArgument());
  :   ASSERT_STR_CONTAINS(s.ToString(),
  :   "Error creating table 
TestEqualRangeBounds on the master: "
  :   "range partition lower bound must be 
less than the upper bound");
  : }
  :
  : TEST_F(ClientTest, TestMinMaxRangeBounds) {
  :   KuduSchemaBuilder builder;
  :   KuduSchema schema;
  :   
builder.AddColumn("key")->Type(KuduColumnSchema::INT32)->NotNull()->PrimaryKey();
  :   
builder.AddColumn("value")->Type(KuduColumnSchema::INT32)->NotNull();
  :   ASSERT_OK(builder.Build(&schema));
  :
  :   unique_ptr lower_bound(schema.NewRow());
  :   ASSERT_OK(lower_bound->SetInt32("key", INT32_MIN));
  :   unique_ptr upper_bound(schema.NewRow());
  :   ASSERT_OK(upper_bound->SetInt32("key", INT32_MAX));
  :
  :   unique_ptr 
table_creator(client_->NewTableCreator());
  :   table_creator->add_range_partition(lower_bound.release(), 
upper_bound.release(),
  :  
KuduTableCreator::EXCLUSIVE_BOUND,
  :  
KuduTableCreator::INCLUSIVE_BOUND);
  :
  :   ASSERT_OK(table_creator->table_name("TestMinMaxRangeBounds")
  :   .schema(&schema)
  :   .num_replica

[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-21 Thread Grant Henke (Code Review)
Hello Alexey Serbin, Dan Burkert, Kudu Jenkins,

I'd like you to reexamine a change. Please visit

http://gerrit.cloudera.org:8080/9363

to look at the new patch set (#4).

Change subject: KUDU-721: Support range partitions on decimal columns
..

KUDU-721: Support range partitions on decimal columns

Add the DataType handling to enable range partitions on
decimal columns and a test that fails without the changes.

Also adds range partition tests for edge cases where:
* The upper bound is less than than the lower bound
* The upper bound is equal to the lower bound
* The bounds use MIN/MAX values

Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
---
M src/kudu/client/client-test.cc
M src/kudu/common/partition.cc
M src/kudu/util/decimal_util-test.cc
M src/kudu/util/decimal_util.cc
M src/kudu/util/decimal_util.h
5 files changed, 156 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/63/9363/4
--
To view, visit http://gerrit.cloudera.org:8080/9363
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
Gerrit-Change-Number: 9363
Gerrit-PatchSet: 4
Gerrit-Owner: Grant Henke 
Gerrit-Reviewer: Alexey Serbin 
Gerrit-Reviewer: Dan Burkert 
Gerrit-Reviewer: Grant Henke 
Gerrit-Reviewer: Kudu Jenkins


[kudu-CR] KUDU-721: Support range partitions on decimal columns

2018-02-21 Thread Grant Henke (Code Review)
Grant Henke has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/9363 )

Change subject: KUDU-721: Support range partitions on decimal columns
..

KUDU-721: Support range partitions on decimal columns

Add the DataType handling to enable range partitions on
decimal columns and a test that fails without the changes.

Also adds range partition tests for edge cases where:
* The upper bound is less than than the lower bound
* The upper bound is equal to the lower bound
* The bounds use MIN/MAX values

Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
Reviewed-on: http://gerrit.cloudera.org:8080/9363
Reviewed-by: Alexey Serbin 
Tested-by: Kudu Jenkins
---
M src/kudu/client/client-test.cc
M src/kudu/common/partition.cc
M src/kudu/util/decimal_util-test.cc
M src/kudu/util/decimal_util.cc
M src/kudu/util/decimal_util.h
5 files changed, 156 insertions(+), 10 deletions(-)

Approvals:
  Alexey Serbin: Looks good to me, approved
  Kudu Jenkins: Verified

--
To view, visit http://gerrit.cloudera.org:8080/9363
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I419d442dd233c73166c6e391907c8443ebecc917
Gerrit-Change-Number: 9363
Gerrit-PatchSet: 5
Gerrit-Owner: Grant Henke 
Gerrit-Reviewer: Alexey Serbin 
Gerrit-Reviewer: Dan Burkert 
Gerrit-Reviewer: Grant Henke 
Gerrit-Reviewer: Kudu Jenkins