[4/8] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.X

2016-10-17 Thread aleksey
Merge branch 'cassandra-3.0' into cassandra-3.X


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f5f44f69
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f5f44f69
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f5f44f69

Branch: refs/heads/cassandra-3.X
Commit: f5f44f69e46fec7e2eb7242dcfb2484baa631371
Parents: e722046 7872318
Author: Aleksey Yeschenko 
Authored: Mon Oct 17 18:16:45 2016 +0100
Committer: Aleksey Yeschenko 
Committed: Mon Oct 17 18:19:30 2016 +0100

--
 CHANGES.txt |   1 +
 .../cassandra/cql3/functions/AggregateFcts.java | 328 ++-
 .../validation/operations/AggregationTest.java  | 147 ++---
 3 files changed, 273 insertions(+), 203 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5f44f69/CHANGES.txt
--
diff --cc CHANGES.txt
index 5023590,d5419c6..4f5bd57
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,86 -1,5 +1,87 @@@
 -3.0.10
 +3.10
 + * Make cassandra.yaml docs for batch_size_*_threshold_in_kb reflect changes 
in CASSANDRA-10876 (CASSANDRA-12761)
 + * cqlsh fails to format collections when using aliases (CASSANDRA-11534)
 + * Check for hash conflicts in prepared statements (CASSANDRA-12733)
 + * Exit query parsing upon first error (CASSANDRA-12598)
 + * Fix cassandra-stress to use single seed in UUID generation 
(CASSANDRA-12729)
 + * CQLSSTableWriter does not allow Update statement (CASSANDRA-12450)
 + * Config class uses boxed types but DD exposes primitive types 
(CASSANDRA-12199)
 + * Add pre- and post-shutdown hooks to Storage Service (CASSANDRA-12461)
 + * Add hint delivery metrics (CASSANDRA-12693)
 + * Remove IndexInfo cache from FileIndexInfoRetriever (CASSANDRA-12731)
 + * ColumnIndex does not reuse buffer (CASSANDRA-12502)
 + * cdc column addition still breaks schema migration tasks (CASSANDRA-12697)
 + * Upgrade metrics-reporter dependencies (CASSANDRA-12089)
 + * Tune compaction thread count via nodetool (CASSANDRA-12248)
 + * Add +=/-= shortcut syntax for update queries (CASSANDRA-12232)
 + * Include repair session IDs in repair start message (CASSANDRA-12532)
 + * Add a blocking task to Index, run before joining the ring (CASSANDRA-12039)
 + * Fix NPE when using CQLSSTableWriter (CASSANDRA-12667)
 + * Support optional backpressure strategies at the coordinator 
(CASSANDRA-9318)
 + * Make randompartitioner work with new vnode allocation (CASSANDRA-12647)
 + * Fix cassandra-stress graphing (CASSANDRA-12237)
 + * Allow filtering on partition key columns for queries without secondary 
indexes (CASSANDRA-11031)
 + * Fix Cassandra Stress reporting thread model and precision (CASSANDRA-12585)
 + * Add JMH benchmarks.jar (CASSANDRA-12586)
 + * Add row offset support to SASI (CASSANDRA-11990)
 + * Cleanup uses of AlterTableStatementColumn (CASSANDRA-12567)
 + * Add keep-alive to streaming (CASSANDRA-11841)
 + * Tracing payload is passed through newSession(..) (CASSANDRA-11706)
 + * avoid deleting non existing sstable files and improve related log messages 
(CASSANDRA-12261)
 + * json/yaml output format for nodetool compactionhistory (CASSANDRA-12486)
 + * Retry all internode messages once after a connection is
 +   closed and reopened (CASSANDRA-12192)
 + * Add support to rebuild from targeted replica (CASSANDRA-9875)
 + * Add sequence distribution type to cassandra stress (CASSANDRA-12490)
 + * "SELECT * FROM foo LIMIT ;" does not error out (CASSANDRA-12154)
 + * Define executeLocally() at the ReadQuery Level (CASSANDRA-12474)
 + * Extend read/write failure messages with a map of replica addresses
 +   to error codes in the v5 native protocol (CASSANDRA-12311)
 + * Fix rebuild of SASI indexes with existing index files (CASSANDRA-12374)
 + * Let DatabaseDescriptor not implicitly startup services (CASSANDRA-9054, 
12550)
 + * Fix clustering indexes in presence of static columns in SASI 
(CASSANDRA-12378)
 + * Fix queries on columns with reversed type on SASI indexes (CASSANDRA-12223)
 + * Added slow query log (CASSANDRA-12403)
 + * Count full coordinated request against timeout (CASSANDRA-12256)
 + * Allow TTL with null value on insert and update (CASSANDRA-12216)
 + * Make decommission operation resumable (CASSANDRA-12008)
 + * Add support to one-way targeted repair (CASSANDRA-9876)
 + * Remove clientutil jar (CASSANDRA-11635)
 + * Fix compaction throughput throttle (CASSANDRA-12366, CASSANDRA-12717)
 + * Delay releasing Memtable memory on flush until PostFlush has finished 
running (CASSANDRA-12358)
 + * Cassandra stress should dump all setting on startup (CASSANDRA-11914)
 + * Make it possible to compact a given token range (CASSANDRA-10643)
 + * Allow updating 

[4/8] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.X

2016-10-14 Thread carl
http://git-wip-us.apache.org/repos/asf/cassandra/blob/206a7bba/src/java/org/apache/cassandra/cql3/ColumnIdentifier.java
--
diff --cc src/java/org/apache/cassandra/cql3/ColumnIdentifier.java
index 7a23231,ceb81be..70f7590
--- a/src/java/org/apache/cassandra/cql3/ColumnIdentifier.java
+++ b/src/java/org/apache/cassandra/cql3/ColumnIdentifier.java
@@@ -218,11 -232,139 +218,11 @@@ public class ColumnIdentifier implement
  return ByteBufferUtil.compareUnsigned(this.bytes, that.bytes);
  }
  
 -/**
 - * Because Thrift-created tables may have a non-text comparator, we 
cannot determine the proper 'key' until
 - * we know the comparator. ColumnIdentifier.Raw is a placeholder that can 
be converted to a real ColumnIdentifier
 - * once the comparator is known with prepare(). This should only be used 
with identifiers that are actual
 - * column names. See CASSANDRA-8178 for more background.
 - */
 -public static interface Raw extends Selectable.Raw
 -{
 -
 -public ColumnIdentifier prepare(CFMetaData cfm);
 -
 -/**
 - * Returns a string representation of the identifier that is safe to 
use directly in CQL queries.
 - * In necessary, the string will be double-quoted, and any quotes 
inside the string will be escaped.
 - */
 -public String toCQLString();
 -}
 -
 -public static class Literal implements Raw
 -{
 -private final String rawText;
 -private final String text;
 -
 -public Literal(String rawText, boolean keepCase)
 -{
 -this.rawText = rawText;
 -this.text =  keepCase ? rawText : rawText.toLowerCase(Locale.US);
 -}
 -
 -public ColumnIdentifier prepare(CFMetaData cfm)
 -{
 -if (!cfm.isStaticCompactTable())
 -return getInterned(text, true);
 -
 -AbstractType thriftColumnNameType = cfm.thriftColumnNameType();
 -if (thriftColumnNameType instanceof UTF8Type)
 -return getInterned(text, true);
 -
 -// We have a Thrift-created table with a non-text comparator. 
Check if we have a match column, otherwise assume we should use
 -// thriftColumnNameType
 -ByteBuffer bufferName = ByteBufferUtil.bytes(text);
 -for (ColumnDefinition def : cfm.allColumns())
 -{
 -if (def.name.bytes.equals(bufferName))
 -return def.name;
 -}
 -return getInterned(thriftColumnNameType, 
thriftColumnNameType.fromString(rawText), text);
 -}
 -
 -public boolean processesSelection()
 -{
 -return false;
 -}
 -
 -@Override
 -public final int hashCode()
 -{
 -return text.hashCode();
 -}
 -
 -@Override
 -public final boolean equals(Object o)
 -{
 -if(!(o instanceof Literal))
 -return false;
 -
 -Literal that = (Literal) o;
 -return text.equals(that.text);
 -}
 -
 -@Override
 -public String toString()
 -{
 -return text;
 -}
 -
 -public String toCQLString()
 -{
 -return maybeQuote(text);
 -}
 -}
 -
 -public static class ColumnIdentifierValue implements Raw
 -{
 -private final ColumnIdentifier identifier;
 -
 -public ColumnIdentifierValue(ColumnIdentifier identifier)
 -{
 -this.identifier = identifier;
 -}
 -
 -public ColumnIdentifier prepare(CFMetaData cfm)
 -{
 -return identifier;
 -}
 -
 -public boolean processesSelection()
 -{
 -return false;
 -}
 -
 -@Override
 -public final int hashCode()
 -{
 -return identifier.hashCode();
 -}
 -
 -@Override
 -public final boolean equals(Object o)
 -{
 -if(!(o instanceof ColumnIdentifierValue))
 -return false;
 -ColumnIdentifierValue that = (ColumnIdentifierValue) o;
 -return identifier.equals(that.identifier);
 -}
 -
 -@Override
 -public String toString()
 -{
 -return identifier.toString();
 -}
 -
 -public String toCQLString()
 -{
 -return maybeQuote(identifier.text);
 -}
 -}
 -
 +@VisibleForTesting
  public static String maybeQuote(String text)
  {
- if (UNQUOTED_IDENTIFIER.matcher(text).matches())
+ if (UNQUOTED_IDENTIFIER.matcher(text).matches() && 
!ReservedKeywords.isReserved(text))
  return text;
 -
 -return '"' + 
PATTERN_DOUBLE_QUOTE.matcher(text).replaceAll(Matcher.quoteReplacement("\"\"")) 
+ '"';
 +return '"' +