You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2014/07/17 22:57:50 UTC
[1/6] git commit: colorize PK + clustering differently patch by Mihai
Seteu; reviewed by Robert Stupp for CASSANDRA-6910
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.1 f873a3278 -> 5dfee585d
refs/heads/trunk c996a36d7 -> db70f5a3f
colorize PK + clustering differently
patch by Mihai Seteu; reviewed by Robert Stupp for CASSANDRA-6910
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/14151a40
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/14151a40
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/14151a40
Branch: refs/heads/cassandra-2.1
Commit: 14151a40b110ef59ce2aa8acb991b8f4ae7a1f9a
Parents: f873a32
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Jul 17 15:56:36 2014 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Jul 17 15:57:01 2014 -0500
----------------------------------------------------------------------
bin/cqlsh | 46 +++++++++++++++++++++++++++++++++-------------
1 file changed, 33 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/14151a40/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 44756e2..c8ef874 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -119,7 +119,7 @@ if os.path.isdir(cqlshlibdir):
sys.path.insert(0, cqlshlibdir)
from cqlshlib import cqlhandling, cql3handling, pylexotron, sslhandling
-from cqlshlib.displaying import (RED, BLUE, ANSI_RESET, COLUMN_NAME_COLORS,
+from cqlshlib.displaying import (RED, BLUE, CYAN, ANSI_RESET, COLUMN_NAME_COLORS,
FormattedValue, colorme)
from cqlshlib.formatting import format_by_type, formatter_for, format_value_utype
from cqlshlib.util import trim_if_present
@@ -583,8 +583,14 @@ class Shell(cmd.Cmd):
self.decoding_errors.append(err)
return format_value(err, self.output_codec.name, addcolor=self.color)
- def myformat_colname(self, name):
- return self.myformat_value(name, colormap=COLUMN_NAME_COLORS)
+ def myformat_colname(self, name, cfMetaData):
+ column_colors = COLUMN_NAME_COLORS.copy()
+ # check column role and color appropriately
+ if name in [col.name for col in cfMetaData.partition_key]:
+ column_colors.default_factory = lambda : RED
+ elif name in [col.name for col in cfMetaData.clustering_key]:
+ column_colors.default_factory = lambda : CYAN
+ return self.myformat_value(name, colormap=column_colors)
def report_connection(self):
self.show_host()
@@ -910,7 +916,11 @@ class Shell(cmd.Cmd):
return False
if statement.query_string[:6].lower() == 'select' or statement.query_string.lower().startswith("list"):
- self.print_result(rows, with_default_limit)
+ parsed = cqlruleset.cql_parse(statement.query_string)[1]
+ ks = self.cql_unprotect_name(parsed.get_binding('ksname', None))
+ cf = self.cql_unprotect_name(parsed.get_binding('cfname'))
+ cfMetaData = self.get_table_meta(ks, cf)
+ self.print_result(rows, with_default_limit, cfMetaData)
elif rows:
# CAS INSERT/UPDATE
self.writeresult("")
@@ -918,12 +928,12 @@ class Shell(cmd.Cmd):
self.flush_output()
return True
- def print_result(self, rows, with_default_limit):
+ def print_result(self, rows, with_default_limit, cfMetaData):
self.decoding_errors = []
self.writeresult("")
- if rows :
- self.print_static_result(rows)
+ self.print_static_result(rows, cfMetaData)
+
self.writeresult("(%d rows)" % len(rows))
self.writeresult("")
@@ -941,12 +951,16 @@ class Shell(cmd.Cmd):
% DEFAULT_SELECT_LIMIT, color=RED)
self.writeresult("")
-
- def print_static_result(self, rows):
+ def print_static_result(self, rows, cfMetaData):
if not rows:
+ # print header only
+ colnames = cfMetaData.columns.keys() # full header
+ formatted_names = [self.myformat_colname(name, cfMetaData) for name in colnames]
+ self.print_formatted_result(formatted_names, None)
return
+
colnames = rows[0]._fields
- formatted_names = [self.myformat_colname(name) for name in colnames]
+ formatted_names = [self.myformat_colname(name, cfMetaData) for name in colnames]
formatted_values = [map(self.myformat_value, row) for row in rows]
if self.expand_enabled:
self.print_formatted_result_vertically(formatted_names, formatted_values)
@@ -956,15 +970,21 @@ class Shell(cmd.Cmd):
def print_formatted_result(self, formatted_names, formatted_values):
# determine column widths
widths = [n.displaywidth for n in formatted_names]
- for fmtrow in formatted_values:
- for num, col in enumerate(fmtrow):
- widths[num] = max(widths[num], col.displaywidth)
+ if formatted_values is not None:
+ for fmtrow in formatted_values:
+ for num, col in enumerate(fmtrow):
+ widths[num] = max(widths[num], col.displaywidth)
# print header
header = ' | '.join(hdr.ljust(w, color=self.color) for (hdr, w) in zip(formatted_names, widths))
self.writeresult(' ' + header.rstrip())
self.writeresult('-%s-' % '-+-'.join('-' * w for w in widths))
+ # stop if there are no rows
+ if formatted_values is None:
+ self.writeresult("")
+ return;
+
# print row data
for row in formatted_values:
line = ' | '.join(col.rjust(w, color=self.color) for (col, w) in zip(row, widths))
[2/6] git commit: colorize PK + clustering differently patch by Mihai
Seteu; reviewed by Robert Stupp for CASSANDRA-6910
Posted by jb...@apache.org.
colorize PK + clustering differently
patch by Mihai Seteu; reviewed by Robert Stupp for CASSANDRA-6910
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/14151a40
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/14151a40
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/14151a40
Branch: refs/heads/trunk
Commit: 14151a40b110ef59ce2aa8acb991b8f4ae7a1f9a
Parents: f873a32
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Jul 17 15:56:36 2014 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Jul 17 15:57:01 2014 -0500
----------------------------------------------------------------------
bin/cqlsh | 46 +++++++++++++++++++++++++++++++++-------------
1 file changed, 33 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/14151a40/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 44756e2..c8ef874 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -119,7 +119,7 @@ if os.path.isdir(cqlshlibdir):
sys.path.insert(0, cqlshlibdir)
from cqlshlib import cqlhandling, cql3handling, pylexotron, sslhandling
-from cqlshlib.displaying import (RED, BLUE, ANSI_RESET, COLUMN_NAME_COLORS,
+from cqlshlib.displaying import (RED, BLUE, CYAN, ANSI_RESET, COLUMN_NAME_COLORS,
FormattedValue, colorme)
from cqlshlib.formatting import format_by_type, formatter_for, format_value_utype
from cqlshlib.util import trim_if_present
@@ -583,8 +583,14 @@ class Shell(cmd.Cmd):
self.decoding_errors.append(err)
return format_value(err, self.output_codec.name, addcolor=self.color)
- def myformat_colname(self, name):
- return self.myformat_value(name, colormap=COLUMN_NAME_COLORS)
+ def myformat_colname(self, name, cfMetaData):
+ column_colors = COLUMN_NAME_COLORS.copy()
+ # check column role and color appropriately
+ if name in [col.name for col in cfMetaData.partition_key]:
+ column_colors.default_factory = lambda : RED
+ elif name in [col.name for col in cfMetaData.clustering_key]:
+ column_colors.default_factory = lambda : CYAN
+ return self.myformat_value(name, colormap=column_colors)
def report_connection(self):
self.show_host()
@@ -910,7 +916,11 @@ class Shell(cmd.Cmd):
return False
if statement.query_string[:6].lower() == 'select' or statement.query_string.lower().startswith("list"):
- self.print_result(rows, with_default_limit)
+ parsed = cqlruleset.cql_parse(statement.query_string)[1]
+ ks = self.cql_unprotect_name(parsed.get_binding('ksname', None))
+ cf = self.cql_unprotect_name(parsed.get_binding('cfname'))
+ cfMetaData = self.get_table_meta(ks, cf)
+ self.print_result(rows, with_default_limit, cfMetaData)
elif rows:
# CAS INSERT/UPDATE
self.writeresult("")
@@ -918,12 +928,12 @@ class Shell(cmd.Cmd):
self.flush_output()
return True
- def print_result(self, rows, with_default_limit):
+ def print_result(self, rows, with_default_limit, cfMetaData):
self.decoding_errors = []
self.writeresult("")
- if rows :
- self.print_static_result(rows)
+ self.print_static_result(rows, cfMetaData)
+
self.writeresult("(%d rows)" % len(rows))
self.writeresult("")
@@ -941,12 +951,16 @@ class Shell(cmd.Cmd):
% DEFAULT_SELECT_LIMIT, color=RED)
self.writeresult("")
-
- def print_static_result(self, rows):
+ def print_static_result(self, rows, cfMetaData):
if not rows:
+ # print header only
+ colnames = cfMetaData.columns.keys() # full header
+ formatted_names = [self.myformat_colname(name, cfMetaData) for name in colnames]
+ self.print_formatted_result(formatted_names, None)
return
+
colnames = rows[0]._fields
- formatted_names = [self.myformat_colname(name) for name in colnames]
+ formatted_names = [self.myformat_colname(name, cfMetaData) for name in colnames]
formatted_values = [map(self.myformat_value, row) for row in rows]
if self.expand_enabled:
self.print_formatted_result_vertically(formatted_names, formatted_values)
@@ -956,15 +970,21 @@ class Shell(cmd.Cmd):
def print_formatted_result(self, formatted_names, formatted_values):
# determine column widths
widths = [n.displaywidth for n in formatted_names]
- for fmtrow in formatted_values:
- for num, col in enumerate(fmtrow):
- widths[num] = max(widths[num], col.displaywidth)
+ if formatted_values is not None:
+ for fmtrow in formatted_values:
+ for num, col in enumerate(fmtrow):
+ widths[num] = max(widths[num], col.displaywidth)
# print header
header = ' | '.join(hdr.ljust(w, color=self.color) for (hdr, w) in zip(formatted_names, widths))
self.writeresult(' ' + header.rstrip())
self.writeresult('-%s-' % '-+-'.join('-' * w for w in widths))
+ # stop if there are no rows
+ if formatted_values is None:
+ self.writeresult("")
+ return;
+
# print row data
for row in formatted_values:
line = ' | '.join(col.rjust(w, color=self.color) for (col, w) in zip(row, widths))
[3/6] git commit: Merge branch 'cassandra-2.1' into trunk
Posted by jb...@apache.org.
Merge branch 'cassandra-2.1' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/82d81992
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/82d81992
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/82d81992
Branch: refs/heads/trunk
Commit: 82d819920af6d21e68315109f56f0c1a3682838b
Parents: c996a36 14151a4
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Jul 17 15:57:08 2014 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Jul 17 15:57:08 2014 -0500
----------------------------------------------------------------------
bin/cqlsh | 46 +++++++++++++++++++++++++++++++++-------------
1 file changed, 33 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
[6/6] git commit: Merge branch 'cassandra-2.1' into trunk
Posted by jb...@apache.org.
Merge branch 'cassandra-2.1' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/db70f5a3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/db70f5a3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/db70f5a3
Branch: refs/heads/trunk
Commit: db70f5a3fb81f662ac81f36612589d8b42632953
Parents: 82d8199 5dfee58
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Jul 17 15:57:43 2014 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Jul 17 15:57:43 2014 -0500
----------------------------------------------------------------------
----------------------------------------------------------------------
[5/6] git commit: fix build on os x
Posted by jb...@apache.org.
fix build on os x
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5dfee585
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5dfee585
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5dfee585
Branch: refs/heads/cassandra-2.1
Commit: 5dfee585dd08c70542a33acdaf55acd5adbc7a05
Parents: 14151a4
Author: Jonathan Ellis <jb...@apache.org>
Authored: Fri Jun 27 14:04:55 2014 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Jul 17 15:57:30 2014 -0500
----------------------------------------------------------------------
build.xml | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/5dfee585/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index c1302eb..40dfbf6 100644
--- a/build.xml
+++ b/build.xml
@@ -688,13 +688,17 @@
name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<!-- Order matters! -->
- <javac debug="true" debuglevel="${debuglevel}"
- destdir="${build.classes.thrift}" includeantruntime="false" source="${source.version}" target="${target.version}">
+ <javac fork="true"
+ debug="true" debuglevel="${debuglevel}"
+ destdir="${build.classes.thrift}" includeantruntime="false" source="${source.version}" target="${target.version}"
+ memorymaximumsize="512M">
<src path="${interface.thrift.dir}/gen-java"/>
<classpath refid="cassandra.classpath"/>
</javac>
- <javac debug="true" debuglevel="${debuglevel}"
- destdir="${build.classes.main}" includeantruntime="false" source="${source.version}" target="${target.version}">
+ <javac fork="true"
+ debug="true" debuglevel="${debuglevel}"
+ destdir="${build.classes.main}" includeantruntime="false" source="${source.version}" target="${target.version}"
+ memorymaximumsize="512M">
<src path="${build.src.java}"/>
<src path="${build.src.gen-java}"/>
<classpath refid="cassandra.classpath"/>
[4/6] git commit: fix build on os x
Posted by jb...@apache.org.
fix build on os x
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5dfee585
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5dfee585
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5dfee585
Branch: refs/heads/trunk
Commit: 5dfee585dd08c70542a33acdaf55acd5adbc7a05
Parents: 14151a4
Author: Jonathan Ellis <jb...@apache.org>
Authored: Fri Jun 27 14:04:55 2014 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Jul 17 15:57:30 2014 -0500
----------------------------------------------------------------------
build.xml | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/5dfee585/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index c1302eb..40dfbf6 100644
--- a/build.xml
+++ b/build.xml
@@ -688,13 +688,17 @@
name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<!-- Order matters! -->
- <javac debug="true" debuglevel="${debuglevel}"
- destdir="${build.classes.thrift}" includeantruntime="false" source="${source.version}" target="${target.version}">
+ <javac fork="true"
+ debug="true" debuglevel="${debuglevel}"
+ destdir="${build.classes.thrift}" includeantruntime="false" source="${source.version}" target="${target.version}"
+ memorymaximumsize="512M">
<src path="${interface.thrift.dir}/gen-java"/>
<classpath refid="cassandra.classpath"/>
</javac>
- <javac debug="true" debuglevel="${debuglevel}"
- destdir="${build.classes.main}" includeantruntime="false" source="${source.version}" target="${target.version}">
+ <javac fork="true"
+ debug="true" debuglevel="${debuglevel}"
+ destdir="${build.classes.main}" includeantruntime="false" source="${source.version}" target="${target.version}"
+ memorymaximumsize="512M">
<src path="${build.src.java}"/>
<src path="${build.src.gen-java}"/>
<classpath refid="cassandra.classpath"/>