[python] - Fix bug with Python 3 in ColumnSpec.rename method The rename method in the ColumnSpec class is not properly converting strings to bytes, which adversly impacts only Python 3 since Python 3 treats strings and byte strings differently. This patch adds the appropriate tobytes() method call in the ColumnSpec class and removes the unecessary one from the AlterTable class.
Change-Id: Ia8b178af9baa44c7c3f31ceab604d68785890683 Reviewed-on: http://gerrit.cloudera.org:8080/5087 Reviewed-by: Todd Lipcon <[email protected]> Tested-by: Kudu Jenkins Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/866e861d Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/866e861d Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/866e861d Branch: refs/heads/master Commit: 866e861d0c81b4f0a92835bdd3000a1e61a38e3a Parents: 23cbc63 Author: Jordan Birdsell <[email protected]> Authored: Tue Nov 15 00:13:25 2016 -0500 Committer: Todd Lipcon <[email protected]> Committed: Tue Nov 15 06:24:48 2016 +0000 ---------------------------------------------------------------------- python/kudu/client.pyx | 2 +- python/kudu/schema.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/866e861d/python/kudu/client.pyx ---------------------------------------------------------------------- diff --git a/python/kudu/client.pyx b/python/kudu/client.pyx index f5a87f8..355004e 100644 --- a/python/kudu/client.pyx +++ b/python/kudu/client.pyx @@ -2658,7 +2658,7 @@ cdef class TableAlterer: result.spec = self._alterer.AlterColumn(tobytes(name)) if rename_to: - result.rename(tobytes(rename_to)) + result.rename(rename_to) return result http://git-wip-us.apache.org/repos/asf/kudu/blob/866e861d/python/kudu/schema.pyx ---------------------------------------------------------------------- diff --git a/python/kudu/schema.pyx b/python/kudu/schema.pyx index f4fa218..ab5548a 100644 --- a/python/kudu/schema.pyx +++ b/python/kudu/schema.pyx @@ -328,7 +328,7 @@ cdef class ColumnSpec: """ Change the column name. """ - self.spec.RenameTo(new_name) + self.spec.RenameTo(tobytes(new_name)) return self def block_size(self, block_size):
