Skip to content

Commit 7a4d028

Browse files
committed
Merge branch 'release/2.6'
2 parents c7cfa54 + 6bd7824 commit 7a4d028

4 files changed

Lines changed: 35 additions & 2 deletions

File tree

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.0
1+
2.6.1

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22

3-
#### Version 2.6.0
3+
#### Version 2.6.1 (July 20, 2019)
4+
* Fixed a bug that caused a `ValueSymbol` containing a `Timestamp` value to be written in a CCL format that could not be re-parsed by a CCL parser. This bug cased a `SyntaxException` to thrown when attempting to tokenize a CCL statement generated by a Criteria that contained any `Timestamp` values.
5+
6+
#### Version 2.6.0 (July 16, 2019)
47
* Added support for **navigation keys**. A **navigation key** is used to traverse the document graph in Concourse. It is made up of multiple keys that are joined by the `.` character (i.e. `friends.friends.name`).
58

69
#### Version 2.5.2 (February 16, 2019)

src/main/java/com/cinchapi/ccl/grammar/ValueSymbol.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package com.cinchapi.ccl.grammar;
1717

1818
import com.cinchapi.common.base.AnyStrings;
19+
import com.cinchapi.common.reflect.Reflection;
1920

2021
/**
2122
* A {@link Symbol} that contains a value.;
@@ -48,6 +49,15 @@ else if((value instanceof String || value.getClass().getName()
4849
return new StringBuilder().append(wrap).append(value).append(wrap)
4950
.toString();
5051
}
52+
else if(value.getClass().getName()
53+
.equals("com.cinchapi.concourse.Timestamp")) {
54+
// NOTE: See com.cinchapi.concourse.util.Convert to see the
55+
// conventions for the way that a Timestamp is parsed from a long
56+
// (microseconds) or string (natural language or date time format)
57+
// wrapped in vertical bars.
58+
long micros = Reflection.call(value, "getMicros"); // (Authorized)
59+
return AnyStrings.format("|{}|", micros);
60+
}
5161
else {
5262
return value;
5363
}

src/test/java/com/cinchapi/ccl/ParserTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import com.cinchapi.ccl.syntax.Visitor;
3737
import com.cinchapi.common.reflect.Reflection;
3838
import com.cinchapi.concourse.Tag;
39+
import com.cinchapi.concourse.Timestamp;
3940
import com.cinchapi.concourse.lang.Criteria;
4041
import com.cinchapi.concourse.thrift.Operator;
4142
import com.cinchapi.concourse.time.Time;
@@ -1020,6 +1021,25 @@ public void testParseNumericNumber() {
10201021
}
10211022
}
10221023

1024+
@Test
1025+
public void testCriteriaWithTimestampValueParse() {
1026+
Timestamp start = Timestamp.now();
1027+
Timestamp end = Timestamp.now();
1028+
Criteria criteria = Criteria.where().key("foo")
1029+
.operator(Operator.BETWEEN).value(start).value(end).build();
1030+
Parser parser = createParser(criteria.getCclString());
1031+
int count = 0;
1032+
for (Symbol symbol : parser.tokenize()) {
1033+
if(symbol instanceof ValueSymbol) {
1034+
ValueSymbol $symbol = (ValueSymbol) symbol;
1035+
Assert.assertEquals(Timestamp.class, $symbol.value().getClass());
1036+
Assert.assertTrue($symbol.value().equals(start) || $symbol.value().equals(end));
1037+
++count;
1038+
}
1039+
}
1040+
Assert.assertEquals(2, count);
1041+
}
1042+
10231043
protected abstract Parser createParser(String ccl);
10241044

10251045
protected abstract Parser createParser(String ccl,

0 commit comments

Comments
 (0)