You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by fr...@apache.org on 2018/06/02 09:20:32 UTC
[1/4] calcite-avatica git commit: [CALCITE-2303] In EXTRACT function,
support MICROSECONDS, MILLISECONDS, EPOCH, ISODOW,
ISOYEAR and DECADE time units (Sergey Nuyanzin) [Forced Update!]
Repository: calcite-avatica
Updated Branches:
refs/heads/branch-avatica-1.12 bd9c968e8 -> 0dd3d6ea1 (forced update)
[CALCITE-2303] In EXTRACT function, support MICROSECONDS, MILLISECONDS, EPOCH, ISODOW, ISOYEAR and DECADE time units (Sergey Nuyanzin)
Also, fixed issue related to week extraction (wrong ISO-8601 week
calculation in some cases, additional tests provided).
Close apache/calcite-avatica#50
Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica/commit/b8639882
Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica/tree/b8639882
Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica/diff/b8639882
Branch: refs/heads/branch-avatica-1.12
Commit: b863988291db6cd64b1517d238b49e98aaaf24d2
Parents: 4beeef4
Author: snuyanzin <sn...@gmail.com>
Authored: Sun May 27 13:49:17 2018 +0300
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Jun 1 10:52:03 2018 -0700
----------------------------------------------------------------------
.../calcite/avatica/util/DateTimeUtils.java | 55 ++++-
.../apache/calcite/avatica/util/TimeUnit.java | 11 +-
.../calcite/avatica/util/TimeUnitRange.java | 2 +
.../calcite/avatica/util/DateTimeUtilsTest.java | 208 ++++++++++++++++++-
4 files changed, 263 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/b8639882/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java b/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
index e1f6999..b4148dc 100644
--- a/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
+++ b/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
@@ -87,6 +87,11 @@ public class DateTimeUtils {
public static final long MILLIS_PER_DAY = 86400000; // = 24 * 60 * 60 * 1000
/**
+ * The number of seconds in a day.
+ */
+ public static final long SECONDS_PER_DAY = 86_400; // = 24 * 60 * 60
+
+ /**
* Calendar set to the epoch (1970-01-01 00:00:00 UTC). Useful for
* initializing other values. Calendars are not immutable, so be careful not
* to screw up this object for everyone else.
@@ -729,7 +734,13 @@ public class DateTimeUtils {
}
public static long unixDateExtract(TimeUnitRange range, long date) {
- return julianExtract(range, (int) date + EPOCH_JULIAN);
+ switch (range) {
+ case EPOCH:
+ // no need to extract year/month/day, just multiply
+ return date * SECONDS_PER_DAY;
+ default:
+ return julianExtract(range, (int) date + EPOCH_JULIAN);
+ }
}
private static int julianExtract(TimeUnitRange range, int julian) {
@@ -758,6 +769,14 @@ public class DateTimeUtils {
switch (range) {
case YEAR:
return year;
+ case ISOYEAR:
+ int weekNumber = getIso8601WeekNumber(julian, year, month, day);
+ if (weekNumber == 1 && month == 12) {
+ return year + 1;
+ } else if (month == 1 && weekNumber > 50) {
+ return year - 1;
+ }
+ return year;
case QUARTER:
return (month + 2) / 3;
case MONTH:
@@ -766,15 +785,15 @@ public class DateTimeUtils {
return day;
case DOW:
return (int) floorMod(julian + 1, 7) + 1; // sun=1, sat=7
+ case ISODOW:
+ return (int) floorMod(julian, 7) + 1; // mon=1, sun=7
case WEEK:
- long fmofw = firstMondayOfFirstWeek(year);
- if (julian < fmofw) {
- fmofw = firstMondayOfFirstWeek(year - 1);
- }
- return (int) (julian - fmofw) / 7 + 1;
+ return getIso8601WeekNumber(julian, year, month, day);
case DOY:
final long janFirst = ymdToJulian(year, 1, 1);
return (int) (julian - janFirst) + 1;
+ case DECADE:
+ return year / 10;
case CENTURY:
return year > 0
? (year + 99) / 100
@@ -798,6 +817,30 @@ public class DateTimeUtils {
return janFirst + (11 - janFirstDow) % 7 - 3;
}
+ /** Returns the ISO-8601 week number based on year, month, day.
+ * Per ISO-8601 it is the Monday of the week that contains Jan 4,
+ * or equivalently, it is a Monday between Dec 29 and Jan 4.
+ * Sometimes it is in the year before the given year, sometimes after. */
+ private static int getIso8601WeekNumber(int julian, int year, int month, int day) {
+ long fmofw = firstMondayOfFirstWeek(year);
+ if (month == 12 && day > 28) {
+ if (31 - day + 4 > 7 - ((int) floorMod(julian, 7) + 1)
+ && 31 - day + (int) (floorMod(julian, 7) + 1) >= 4) {
+ return (int) (julian - fmofw) / 7 + 1;
+ } else {
+ return 1;
+ }
+ } else if (month == 1 && day < 5) {
+ if (4 - day <= 7 - ((int) floorMod(julian, 7) + 1)
+ && day - ((int) (floorMod(julian, 7) + 1)) >= -3) {
+ return 1;
+ } else {
+ return (int) (julian - firstMondayOfFirstWeek(year - 1)) / 7 + 1;
+ }
+ }
+ return (int) (julian - fmofw) / 7 + 1;
+ }
+
/** Extracts a time unit from a UNIX date (milliseconds since epoch). */
public static int unixTimestampExtract(TimeUnitRange range,
long timestamp) {
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/b8639882/core/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java b/core/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java
index 251c4cf..4516410 100644
--- a/core/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java
+++ b/core/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java
@@ -21,15 +21,16 @@ import java.math.BigDecimal;
/**
* Enumeration of time units used to construct an interval.
*
- * <p>Only {@link #YEAR}, {@link #YEAR}, {@link #MONTH}, {@link #DAY},
+ * <p>Only {@link #YEAR}, {@link #MONTH}, {@link #DAY},
* {@link #HOUR}, {@link #MINUTE}, {@link #SECOND} can be the unit of a SQL
* interval.
*
* <p>The others ({@link #QUARTER}, {@link #WEEK}, {@link #MILLISECOND},
* {@link #DOW}, {@link #DOY}, {@link #EPOCH}, {@link #DECADE}, {@link #CENTURY},
- * {@link #MILLENNIUM} and {@link #MICROSECOND}) are convenient to use internally,
- * when converting to and from UNIX timestamps. And also may be arguments to the
- * {@code EXTRACT}, {@code TIMESTAMPADD} and {@code TIMESTAMPDIFF} functions.
+ * {@link #MILLENNIUM}, {@link #MICROSECOND}, {@link #ISODOW} and {@link #ISOYEAR})
+ * are convenient to use internally, when converting to and from UNIX timestamps.
+ * And also may be arguments to the {@code EXTRACT}, {@code TIMESTAMPADD} and
+ * {@code TIMESTAMPDIFF} functions.
*/
public enum TimeUnit {
YEAR(true, ' ', BigDecimal.valueOf(12) /* months */, null),
@@ -43,12 +44,14 @@ public enum TimeUnit {
BigDecimal.valueOf(60)),
QUARTER(true, '*', BigDecimal.valueOf(3) /* months */, BigDecimal.valueOf(4)),
+ ISOYEAR(true, ' ', BigDecimal.valueOf(12) /* months */, null),
WEEK(false, '*', BigDecimal.valueOf(DateTimeUtils.MILLIS_PER_DAY * 7),
BigDecimal.valueOf(53)),
MILLISECOND(false, '.', BigDecimal.ONE, BigDecimal.valueOf(1000)),
MICROSECOND(false, '.', BigDecimal.ONE.scaleByPowerOfTen(-3),
BigDecimal.valueOf(1000000)),
DOW(false, '-', null, null),
+ ISODOW(false, '-', null, null),
DOY(false, '-', null, null),
EPOCH(false, '*', null, null),
DECADE(true, '*', BigDecimal.valueOf(120) /* months */, null),
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/b8639882/core/src/main/java/org/apache/calcite/avatica/util/TimeUnitRange.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/avatica/util/TimeUnitRange.java b/core/src/main/java/org/apache/calcite/avatica/util/TimeUnitRange.java
index 42d44dc..2e65ed3 100644
--- a/core/src/main/java/org/apache/calcite/avatica/util/TimeUnitRange.java
+++ b/core/src/main/java/org/apache/calcite/avatica/util/TimeUnitRange.java
@@ -39,11 +39,13 @@ public enum TimeUnitRange {
SECOND(TimeUnit.SECOND, null),
// non-standard time units cannot participate in ranges
+ ISOYEAR(TimeUnit.ISOYEAR, null),
QUARTER(TimeUnit.QUARTER, null),
WEEK(TimeUnit.WEEK, null),
MILLISECOND(TimeUnit.MILLISECOND, null),
MICROSECOND(TimeUnit.MICROSECOND, null),
DOW(TimeUnit.DOW, null),
+ ISODOW(TimeUnit.ISODOW, null),
DOY(TimeUnit.DOY, null),
EPOCH(TimeUnit.EPOCH, null),
DECADE(TimeUnit.DECADE, null),
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/b8639882/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java b/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java
index ea25349..9c9bc34 100644
--- a/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java
+++ b/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java
@@ -313,6 +313,15 @@ public class DateTimeUtilsTest {
assertThat(unixDateExtract(TimeUnitRange.DOW, 365), is(6L));
assertThat(unixDateExtract(TimeUnitRange.DOW, 366), is(7L));
+ // 1969/12/31 was a Wed (4)
+ assertThat(unixDateExtract(TimeUnitRange.ISODOW, -1), is(3L)); // wed
+ assertThat(unixDateExtract(TimeUnitRange.ISODOW, 0), is(4L)); // thu
+ assertThat(unixDateExtract(TimeUnitRange.ISODOW, 1), is(5L)); // fri
+ assertThat(unixDateExtract(TimeUnitRange.ISODOW, 2), is(6L)); // sat
+ assertThat(unixDateExtract(TimeUnitRange.ISODOW, 3), is(7L)); // sun
+ assertThat(unixDateExtract(TimeUnitRange.ISODOW, 365), is(5L));
+ assertThat(unixDateExtract(TimeUnitRange.ISODOW, 366), is(6L));
+
assertThat(unixDateExtract(TimeUnitRange.DOY, -1), is(365L));
assertThat(unixDateExtract(TimeUnitRange.DOY, 0), is(1L));
assertThat(unixDateExtract(TimeUnitRange.DOY, 1), is(2L));
@@ -342,14 +351,64 @@ public class DateTimeUtilsTest {
is(1L)); // thu
assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2005, 1, 1)),
is(53L)); // sat
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2005, 1, 2)),
+ is(53L)); // sun
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2005, 12, 31)),
+ is(52L)); // sat
assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2006, 1, 1)),
is(52L)); // sun
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2006, 1, 2)),
+ is(1L)); // mon
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2006, 12, 31)),
+ is(52L)); // sun
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2007, 1, 1)),
+ is(1L)); // mon
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2007, 12, 30)),
+ is(52L)); // sun
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2007, 12, 31)),
+ is(1L)); // mon
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2008, 12, 28)),
+ is(52L)); // sun
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2008, 12, 29)),
+ is(1L)); // mon
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2008, 12, 30)),
+ is(1L)); // tue
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2008, 12, 31)),
+ is(1L)); // wen
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2009, 1, 1)),
+ is(1L)); // thu
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2009, 12, 31)),
+ is(53L)); // thu
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2010, 1, 1)),
+ is(53L)); // fri
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2010, 1, 2)),
+ is(53L)); // sat
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2010, 1, 3)),
+ is(53L)); // sun
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2010, 1, 4)),
+ is(1L)); // mon
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2012, 12, 30)),
+ is(52L)); // sun
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2012, 12, 31)),
+ is(1L)); // mon
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2014, 12, 30)),
+ is(1L)); // tue
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2014, 12, 31)),
+ is(1L)); // wen
assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(1970, 1, 1)),
is(1L)); // thu
- assertThat(unixDateExtract(TimeUnitRange.WEEK, -1), is(53L)); // wed
+ // Based on the rule: The number of the ISO 8601 week-numbering week of the year.
+ // By definition, ISO weeks start on Mondays and the first week of a year contains
+ // January 4 of that year. In other words, the first Thursday of a year is in
+ // week 1 of that year.
+ // For that reason 1969-12-31, 1969-12-30 and 1969-12-29 are in the 1-st ISO week of 1970
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, -4), is(52L)); // sun
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, -3), is(1L)); // mon
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, -2), is(1L)); // tue
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, -1), is(1L)); // wed
assertThat(unixDateExtract(TimeUnitRange.WEEK, 0), is(1L)); // thu
- assertThat(unixDateExtract(TimeUnitRange.WEEK, 1), is(1L)); // fru
+ assertThat(unixDateExtract(TimeUnitRange.WEEK, 1), is(1L)); // fri
assertThat(unixDateExtract(TimeUnitRange.WEEK, 2), is(1L)); // sat
assertThat(unixDateExtract(TimeUnitRange.WEEK, 3), is(1L)); // sun
assertThat(unixDateExtract(TimeUnitRange.WEEK, 4), is(2L)); // mon
@@ -428,6 +487,32 @@ public class DateTimeUtilsTest {
unixDateExtract(TimeUnitRange.CENTURY, ymdToUnixDate(-2, 1, 1)),
is(-1L));
+ //The 201st decade started on 2010/01/01. A little bit different but based on
+ //https://www.postgresql.org/docs/9.1/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
+ assertThat(
+ unixDateExtract(TimeUnitRange.DECADE, ymdToUnixDate(2010, 1, 1)),
+ is(201L));
+ assertThat(
+ unixDateExtract(TimeUnitRange.DECADE, ymdToUnixDate(2000, 12, 31)),
+ is(200L));
+ assertThat(
+ unixDateExtract(TimeUnitRange.DECADE, ymdToUnixDate(1852, 6, 7)),
+ is(185L));
+ assertThat(
+ unixDateExtract(TimeUnitRange.DECADE, ymdToUnixDate(1, 2, 1)),
+ is(0L));
+ // TODO: For a small time range around year 1, due to the Gregorian shift,
+ // we end up in the wrong decade. Should be 1.
+ assertThat(
+ unixDateExtract(TimeUnitRange.DECADE, ymdToUnixDate(1, 1, 1)),
+ is(0L));
+ assertThat(
+ unixDateExtract(TimeUnitRange.DECADE, ymdToUnixDate(-2, 1, 1)),
+ is(0L));
+ assertThat(
+ unixDateExtract(TimeUnitRange.DECADE, ymdToUnixDate(-20, 1, 1)),
+ is(-2L));
+
// The 3rd millennium started on 2001/01/01
assertThat(
unixDateExtract(TimeUnitRange.MILLENNIUM, ymdToUnixDate(2001, 1, 1)),
@@ -447,6 +532,117 @@ public class DateTimeUtilsTest {
assertThat(
unixDateExtract(TimeUnitRange.MILLENNIUM, ymdToUnixDate(-2, 1, 1)),
is(-1L));
+
+ // The ISO 8601 week-numbering year that the date falls in (not applicable
+ // to intervals). Each ISO 8601 week-numbering year begins with the Monday
+ // of the week containing the 4th of January, so in early January or late
+ // December the ISO year may be different from the Gregorian year. See the
+ // week field for more information.
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2003, 1, 1)),
+ is(2003L)); // wed
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2004, 1, 1)),
+ is(2004L)); // thu
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2005, 1, 1)),
+ is(2004L)); // sat
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2005, 1, 2)),
+ is(2004L)); // sun
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2005, 1, 3)),
+ is(2005L)); // mon
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2005, 12, 31)),
+ is(2005L)); // sat
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2006, 1, 1)),
+ is(2005L)); // sun
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2006, 1, 2)),
+ is(2006L)); // mon
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2006, 12, 31)),
+ is(2006L)); // sun
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2007, 1, 1)),
+ is(2007L)); // mon
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2007, 12, 30)),
+ is(2007L)); // sun
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2007, 12, 31)),
+ is(2008L)); // mon
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2008, 12, 28)),
+ is(2008L)); // sun
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2008, 12, 29)),
+ is(2009L)); // mon
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2008, 12, 30)),
+ is(2009L)); // tue
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2008, 12, 31)),
+ is(2009L)); // wen
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2009, 1, 1)),
+ is(2009L)); // thu
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2009, 12, 31)),
+ is(2009L)); // thu
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2010, 1, 1)),
+ is(2009L)); // fri
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2010, 1, 2)),
+ is(2009L)); // sat
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2010, 1, 3)),
+ is(2009L)); // sun
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2010, 1, 4)),
+ is(2010L)); // mon
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2012, 12, 29)),
+ is(2012L)); // sat
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2012, 12, 30)),
+ is(2012L)); // sun
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2012, 12, 31)),
+ is(2013L)); // mon
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2014, 12, 30)),
+ is(2015L)); // tue
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(2014, 12, 31)),
+ is(2015L)); // wen
+ assertThat(
+ unixDateExtract(TimeUnitRange.ISOYEAR, ymdToUnixDate(1970, 1, 1)),
+ is(1970L)); // thu
+
+ // For date and timestamp values, the number of seconds since 1970-01-01 00:00:00 UTC
+ // (can be negative); for interval values, the total number of seconds in the interval
+ assertThat(
+ unixDateExtract(TimeUnitRange.EPOCH, ymdToUnixDate(2001, 1, 1)),
+ is(978_307_200L));
+ assertThat(
+ unixDateExtract(TimeUnitRange.EPOCH, ymdToUnixDate(1969, 12, 31)),
+ is(-86_400L));
+ assertThat(
+ unixDateExtract(TimeUnitRange.EPOCH, ymdToUnixDate(1970, 1, 1)),
+ is(0L));
+ assertThat(
+ unixDateExtract(TimeUnitRange.EPOCH, ymdToUnixDate(1, 1, 1)),
+ is(-62_135_596_800L));
+ assertThat(
+ unixDateExtract(TimeUnitRange.EPOCH, ymdToUnixDate(1, 2, 1)),
+ is(-62_132_918_400L));
+ assertThat(
+ unixDateExtract(TimeUnitRange.EPOCH, ymdToUnixDate(-2, 1, 1)),
+ is(-62_230_291_200L));
}
@Test public void testUnixDate() {
@@ -522,14 +718,20 @@ public class DateTimeUtilsTest {
is((long) month));
assertThat(unixDateExtract(TimeUnitRange.DAY, unixDate),
is((long) day));
+ final long isoYear = unixDateExtract(TimeUnitRange.ISOYEAR, unixDate);
+ assertTrue(isoYear >= year - 1 && isoYear <= year + 1);
final long w = unixDateExtract(TimeUnitRange.WEEK, unixDate);
assertTrue(w >= 1 && w <= 53);
final long dow = unixDateExtract(TimeUnitRange.DOW, unixDate);
assertTrue(dow >= 1 && dow <= 7);
+ final long iso_dow = unixDateExtract(TimeUnitRange.ISODOW, unixDate);
+ assertTrue(iso_dow >= 1 && iso_dow <= 7);
final long doy = unixDateExtract(TimeUnitRange.DOY, unixDate);
- assertTrue(doy >= 1 && dow <= 366);
+ assertTrue(doy >= 1 && doy <= 366);
final long q = unixDateExtract(TimeUnitRange.QUARTER, unixDate);
assertTrue(q >= 1 && q <= 4);
+ final long d = unixDateExtract(TimeUnitRange.DECADE, unixDate);
+ assertTrue(d == year / 10);
final long c = unixDateExtract(TimeUnitRange.CENTURY, unixDate);
assertTrue(c == (year > 0 ? (year + 99) / 100 : (year - 99) / 100));
final long m = unixDateExtract(TimeUnitRange.MILLENNIUM, unixDate);
[4/4] calcite-avatica git commit: [CALCITE-2330] Release Avatica 1.12
Posted by fr...@apache.org.
[CALCITE-2330] Release Avatica 1.12
Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica/commit/0dd3d6ea
Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica/tree/0dd3d6ea
Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica/diff/0dd3d6ea
Branch: refs/heads/branch-avatica-1.12
Commit: 0dd3d6ea1f9082da0f4c08cb757b0e5bb3c4ffe2
Parents: 05c59af
Author: Francis Chuang <fr...@apache.org>
Authored: Thu May 31 10:41:27 2018 +1000
Committer: francis Chuang <fr...@apache.org>
Committed: Sat Jun 2 19:20:10 2018 +1000
----------------------------------------------------------------------
site/_docs/history.md | 63 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/0dd3d6ea/site/_docs/history.md
----------------------------------------------------------------------
diff --git a/site/_docs/history.md b/site/_docs/history.md
index dcd8d84..9b76361 100644
--- a/site/_docs/history.md
+++ b/site/_docs/history.md
@@ -28,6 +28,69 @@ For a full list of releases, see
Downloads are available on the
[downloads page]({{ site.baseurl }}/downloads/avatica.html).
+## <a href="https://github.com/apache/calcite-avatica/releases/tag/calcite-avatica-1.11.0">1.12.0</a> / 2018-06-15
+{: #v1-12-0}
+
+Apache Calcite Avatica 1.12.0 includes fixes for more than 15 bugs and new features. ZIP archives will no longer be
+produced from this release onwards.
+
+Compatibility: This release is tested
+on Linux, macOS, Microsoft Windows;
+using Oracle JDK 8, 9, 10, 11;
+using IBM Java 8;
+Guava versions 14.0 to 23.0;
+other software versions as specified in `pom.xml`.
+
+Features and bug fixes
+
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1520">CALCITE-1520</a>]
+ Implement isValid for AvaticaConnection
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2212">CALCITE-2212</a>]
+ Enforce minimum JDK 8 via maven-enforcer-plugin
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2268">CALCITE-2268</a>]
+ Bump HSQLDB to 2.4.0 in Avatica Docker image
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2272">CALCITE-2272</a>]
+ Bump dependencies: Apache Parent POM 19, JDK 10 Surefire and JDK 10 Javadoc
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2218">CALCITE-2218</a>]
+ Fix AvaticaResultSet#getRow()
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2272">CALCITE-2272</a>]
+ Fix Javadoc generation
+* Add Docker Hub image for HSQLDB
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2289">CALCITE-2289</a>]
+ Enable html5 for Javadoc on JDK 9+
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2284">CALCITE-2284</a>]
+ Allow Jetty Server to be customized before startup
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2333">CALCITE-2333</a>]
+ Stop generating ZIP archives for release
+* Bump HSQLDB dependency to 2.4.1
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2294">CALCITE-2294</a>]
+ Allow customization for AvaticaServerConfiguration for plugging new authentication mechanisms (Karan Mehta)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1884">CALCITE-1884</a>]
+ DateTimeUtils produces incorrect results for days before the Gregorian cutover (Haohui Mai and Sergey Nuyanzin)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2303">CALCITE-2303</a>]
+ Support MICROSECONDS, MILLISECONDS, EPOCH, ISODOW, ISOYEAR and DECADE time units in EXTRACT function (Sergey Nuyanzin)
+
+Tests
+
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2210">CALCITE-2210</a>]
+ Remove oraclejdk7, add oraclejdk9, add oraclejdk10, and add ibmjava to .travis.yml
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2255">CALCITE-2255</a>]
+ Add JDK 11 .travis.yml
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-2022">CALCITE-2022</a>]
+ Add dynamic drive calculation to correctly determine trust store location when testing on Windows (Sergey Nuyanzin)
+
+Website and Documentation
+
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1160">CALCITE-1160</a>]
+ Redirect from Avatica community to Calcite community
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1937">CALCITE-1937</a>]
+ Update Avatica website to support the inclusion of Avatica-Go's content and add option for using docker to develop
+ and build the website
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1914">CALCITE-1914</a>]
+ Add DOAP (Description of a Project) file for Avatica
+* Fix broken link in HOWTO
+* Add missing license header to avatica-go docs generation script
+
## <a href="https://github.com/apache/calcite-avatica/releases/tag/calcite-avatica-1.11.0">1.11.0</a> / 2018-03-09
{: #v1-11-0}
[2/4] calcite-avatica git commit: [CALCITE-1884] DateTimeUtils
produces incorrect results for days before the Gregorian cutover (Haohui Mai,
Julian Hyde, Sergey Nuyanzin)
Posted by fr...@apache.org.
[CALCITE-1884] DateTimeUtils produces incorrect results for days before the Gregorian cutover (Haohui Mai, Julian Hyde, Sergey Nuyanzin)
Remove conversion to Gregorian in case of DateTimeUtils#ymdToJulian, and added tests.
Close apache/calcite-avatica#11
Close apache/calcite-avatica#52
Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica/commit/4beeef40
Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica/tree/4beeef40
Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica/diff/4beeef40
Branch: refs/heads/branch-avatica-1.12
Commit: 4beeef40d0fc1d3ce5d361b177e94fb156234f43
Parents: 4ac7e1c
Author: snuyanzin <sn...@gmail.com>
Authored: Tue May 29 18:08:05 2018 +0300
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Jun 1 10:52:03 2018 -0700
----------------------------------------------------------------------
.../calcite/avatica/util/DateTimeUtils.java | 6 +-
.../calcite/avatica/util/DateTimeUtilsTest.java | 88 ++++++++++++++++++--
2 files changed, 81 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/4beeef40/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java b/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
index 0f3d466..e1f6999 100644
--- a/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
+++ b/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
@@ -902,16 +902,12 @@ public class DateTimeUtils {
int a = (14 - month) / 12;
int y = year + 4800 - a;
int m = month + 12 * a - 3;
- int j = day + (153 * m + 2) / 5
+ return day + (153 * m + 2) / 5
+ 365 * y
+ y / 4
- y / 100
+ y / 400
- 32045;
- if (j < 2299161) {
- j = day + (153 * m + 2) / 5 + 365 * y + y / 4 - 32083;
- }
- return j;
}
public static long unixTimestamp(int year, int month, int day, int hour,
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/4beeef40/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java b/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java
index f433884..ea25349 100644
--- a/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java
+++ b/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java
@@ -25,8 +25,6 @@ import java.util.Locale;
import static org.apache.calcite.avatica.util.DateTimeUtils.EPOCH_JULIAN;
import static org.apache.calcite.avatica.util.DateTimeUtils.addMonths;
import static org.apache.calcite.avatica.util.DateTimeUtils.dateStringToUnixDate;
-
-
import static org.apache.calcite.avatica.util.DateTimeUtils.digitCount;
import static org.apache.calcite.avatica.util.DateTimeUtils.floorDiv;
import static org.apache.calcite.avatica.util.DateTimeUtils.floorMod;
@@ -142,6 +140,19 @@ public class DateTimeUtilsTest {
checkDateString("1972-02-29", 0 + 365 * 2 + 31 + (29 - 1));
//noinspection PointlessArithmeticExpression
checkDateString("1972-03-01", 0 + 365 * 2 + 31 + 29 + (1 - 1));
+
+ final int d1900 = -(70 * 365 + 70 / 4);
+ final int century = 100 * 365 + 100 / 4;
+ checkDateString("1900-01-01", d1900);
+ // +1 because 1800 is not a leap year
+ final int d1800 = d1900 - century + 1;
+ checkDateString("1800-01-01", d1800);
+ final int d1700 = d1800 - century + 1;
+ checkDateString("1700-01-01", d1700);
+ final int d1600 = d1700 - century;
+ checkDateString("1600-01-01", d1600);
+ final int d1500 = d1600 - century + 1;
+ checkDateString("1500-01-01", d1500); // fails, about 10 days off
}
private void checkDateString(String s, int d) {
@@ -410,11 +421,9 @@ public class DateTimeUtilsTest {
assertThat(
unixDateExtract(TimeUnitRange.CENTURY, ymdToUnixDate(1, 2, 1)),
is(1L));
- // TODO: For a small time range around year 1, due to the Gregorian shift,
- // we end up in the wrong century. Should be 1.
assertThat(
unixDateExtract(TimeUnitRange.CENTURY, ymdToUnixDate(1, 1, 1)),
- is(0L));
+ is(1L));
assertThat(
unixDateExtract(TimeUnitRange.CENTURY, ymdToUnixDate(-2, 1, 1)),
is(-1L));
@@ -429,11 +438,9 @@ public class DateTimeUtilsTest {
assertThat(
unixDateExtract(TimeUnitRange.MILLENNIUM, ymdToUnixDate(1852, 6, 7)),
is(2L));
- // TODO: For a small time range around year 1, due to the Gregorian shift,
- // we end up in the wrong millennium. Should be 1.
assertThat(
unixDateExtract(TimeUnitRange.MILLENNIUM, ymdToUnixDate(1, 1, 1)),
- is(0L));
+ is(1L));
assertThat(
unixDateExtract(TimeUnitRange.MILLENNIUM, ymdToUnixDate(1, 2, 1)),
is(1L));
@@ -442,6 +449,71 @@ public class DateTimeUtilsTest {
is(-1L));
}
+ @Test public void testUnixDate() {
+ int days = DateTimeUtils.dateStringToUnixDate("1500-04-30");
+ assertThat(DateTimeUtils.unixDateToString(days), is("1500-04-30"));
+ assertThat(
+ DateTimeUtils.unixDateToString(
+ DateTimeUtils.dateStringToUnixDate(
+ DateTimeUtils.unixDateToString(
+ DateTimeUtils.dateStringToUnixDate(
+ DateTimeUtils.unixDateToString(
+ DateTimeUtils.dateStringToUnixDate("1500-04-30")))))),
+ is("1500-04-30"));
+
+ final int d1900 = -(70 * 365 + 70 / 4);
+ final int century = 100 * 365 + 100 / 4;
+ checkDateString("1900-01-01", d1900);
+ // +1 because 1800 is not a leap year
+ final int d1800 = d1900 - century + 1;
+ checkDateString("1800-01-01", d1800);
+ final int d1700 = d1800 - century + 1;
+ checkDateString("1700-01-01", d1700);
+ final int d1600 = d1700 - century;
+ checkDateString("1600-01-01", d1600);
+ final int d1500 = d1600 - century + 1;
+ checkDateString("1500-01-01", d1500);
+ final int d1400 = d1500 - century + 1;
+ checkDateString("1400-01-01", d1400);
+ final int d1300 = d1400 - century + 1;
+ checkDateString("1300-01-01", d1300);
+ final int d1200 = d1300 - century;
+ checkDateString("1200-01-01", d1200);
+ final int d1100 = d1200 - century + 1;
+ checkDateString("1100-01-01", d1100);
+ final int d1000 = d1100 - century + 1;
+ checkDateString("1000-01-01", d1000);
+ final int d900 = d1000 - century + 1;
+ checkDateString("0900-01-01", d900);
+ final int d800 = d900 - century;
+ checkDateString("0800-01-01", d800);
+ final int d700 = d800 - century + 1;
+ checkDateString("0700-01-01", d700);
+ final int d600 = d700 - century + 1;
+ checkDateString("0600-01-01", d600);
+ final int d500 = d600 - century + 1;
+ checkDateString("0500-01-01", d500);
+ final int d400 = d500 - century;
+ checkDateString("0400-01-01", d400);
+ final int d300 = d400 - century + 1;
+ checkDateString("0300-01-01", d300);
+ final int d200 = d300 - century + 1;
+ checkDateString("0200-01-01", d200);
+ final int d100 = d200 - century + 1;
+ checkDateString("0100-01-01", d100);
+ final int d000 = d100 - century;
+ checkDateString("0000-01-01", d000);
+ }
+
+ @Test public void testDateConversion() {
+ for (int i = 0; i < 4000; ++i) {
+ for (int j = 1; j <= 12; ++j) {
+ String date = String.format(Locale.ENGLISH, "%04d-%02d-28", i, j);
+ assertThat(unixDateToString(ymdToUnixDate(i, j, 28)), is(date));
+ }
+ }
+ }
+
private void thereAndBack(int year, int month, int day) {
final int unixDate = ymdToUnixDate(year, month, day);
assertThat(unixDateExtract(TimeUnitRange.YEAR, unixDate),
[3/4] calcite-avatica git commit: Cosmetic changes
Posted by fr...@apache.org.
Cosmetic changes
Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica/commit/05c59afe
Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica/tree/05c59afe
Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica/diff/05c59afe
Branch: refs/heads/branch-avatica-1.12
Commit: 05c59afed5d2cf0840e12dbe8c4727aa4b8aba17
Parents: b863988
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Jun 1 10:59:25 2018 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Jun 1 10:59:47 2018 -0700
----------------------------------------------------------------------
.../avatica/remote/RemoteProtobufService.java | 1 -
.../org/apache/calcite/avatica/util/ArrayImpl.java | 1 -
.../apache/calcite/avatica/MetaResultSetTest.java | 1 -
docker/src/main/dockerhub-hypersql/Dockerfile | 4 +++-
site/.gitignore | 2 +-
site/README.md | 2 +-
site/_docs/security.md | 15 +++++++++------
site/develop/index.md | 2 +-
site/doap_calcite-avatica.rdf | 10 +++++-----
site/docker-compose.yml | 4 +++-
site/downloads/avatica-go.md | 2 +-
site/downloads/index.md | 2 +-
12 files changed, 25 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/core/src/main/java/org/apache/calcite/avatica/remote/RemoteProtobufService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/avatica/remote/RemoteProtobufService.java b/core/src/main/java/org/apache/calcite/avatica/remote/RemoteProtobufService.java
index 0f4cbfb..f62e994 100644
--- a/core/src/main/java/org/apache/calcite/avatica/remote/RemoteProtobufService.java
+++ b/core/src/main/java/org/apache/calcite/avatica/remote/RemoteProtobufService.java
@@ -22,7 +22,6 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-
/**
* ProtobufService implementation that queries against a remote implementation, using
* protocol buffers as the serialized form.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/core/src/main/java/org/apache/calcite/avatica/util/ArrayImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/avatica/util/ArrayImpl.java b/core/src/main/java/org/apache/calcite/avatica/util/ArrayImpl.java
index e57fde8..6864859 100644
--- a/core/src/main/java/org/apache/calcite/avatica/util/ArrayImpl.java
+++ b/core/src/main/java/org/apache/calcite/avatica/util/ArrayImpl.java
@@ -27,7 +27,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-
/** Implementation of JDBC {@link Array}. */
public class ArrayImpl implements Array {
private final List<Object> list;
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/core/src/test/java/org/apache/calcite/avatica/MetaResultSetTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/avatica/MetaResultSetTest.java b/core/src/test/java/org/apache/calcite/avatica/MetaResultSetTest.java
index 3d5eb80..50ddab5 100644
--- a/core/src/test/java/org/apache/calcite/avatica/MetaResultSetTest.java
+++ b/core/src/test/java/org/apache/calcite/avatica/MetaResultSetTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.calcite.avatica;
-
import org.apache.calcite.avatica.remote.TypedValue;
import org.junit.After;
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/docker/src/main/dockerhub-hypersql/Dockerfile
----------------------------------------------------------------------
diff --git a/docker/src/main/dockerhub-hypersql/Dockerfile b/docker/src/main/dockerhub-hypersql/Dockerfile
index f0b4d85..9ced71b 100644
--- a/docker/src/main/dockerhub-hypersql/Dockerfile
+++ b/docker/src/main/dockerhub-hypersql/Dockerfile
@@ -24,4 +24,6 @@ ADD https://repo1.maven.org/maven2/net/hydromatic/scott-data-hsqldb/0.1/scott-da
ADD https://repo1.maven.org/maven2/org/hsqldb/hsqldb/${HSQLDB_VERSION}/hsqldb-${HSQLDB_VERSION}.jar /home/avatica/classpath/
# Add on to avatica-server's entrypoint
-CMD ["-u", "jdbc:hsqldb:res:scott"]
\ No newline at end of file
+CMD ["-u", "jdbc:hsqldb:res:scott"]
+
+# End Dockerfile
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/site/.gitignore
----------------------------------------------------------------------
diff --git a/site/.gitignore b/site/.gitignore
index aa7624f..74fb5fa 100644
--- a/site/.gitignore
+++ b/site/.gitignore
@@ -1,3 +1,3 @@
.sass-cache
Gemfile.lock
-.jekyll-metadata
\ No newline at end of file
+.jekyll-metadata
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/site/README.md
----------------------------------------------------------------------
diff --git a/site/README.md b/site/README.md
index b2558c9..38e5cc7 100644
--- a/site/README.md
+++ b/site/README.md
@@ -39,7 +39,7 @@ Site generation currently works best with ruby-2.5.1.
2. `svn co https://svn.apache.org/repos/asf/calcite/site/avatica target/avatica`
3. `sudo apt-get install rubygems ruby2.5-dev zlib1g-dev` (linux)
4. `sudo gem install bundler`
-5. Add avatica-go content: `./add-avatica-go-docs.sh`
+5. Add avatica-go content: `./add-avatica-go-docs.sh`
6. `bundle install`
### Add javadoc
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/site/_docs/security.md
----------------------------------------------------------------------
diff --git a/site/_docs/security.md b/site/_docs/security.md
index a6909dc..70f644b 100644
--- a/site/_docs/security.md
+++ b/site/_docs/security.md
@@ -259,12 +259,16 @@ config = new AvaticaServerConfiguration() {
## Custom Authentication
-Avatica server now offers users to plugin their Custom Authentication mechanism through the HTTPServer Builder.
-This is useful if users want to combine features of various authentication types. Examples include combining
-basic authentication with impersonation or adding mutual authentication with impersonation. More Examples
-are available in `CustomAuthHttpServerTest` class.
+Avatica server allows users to plugin their Custom Authentication
+mechanism through the HTTPServer Builder. This is useful if users
+want to combine features of various authentication types. Examples
+include combining basic authentication with impersonation or adding
+mutual authentication with impersonation. More Examples are available
+in `CustomAuthHttpServerTest` class.
+
+Note: Users need to configure their own `ServerConnectors` and
+`Handlers` with the help of `ServerCustomizers`.
-Note: Users need to configure their own `ServerConnectors` and `Handlers` with the help of `ServerCustomizers`.
{% highlight java %}
AvaticaServerConfiguration configuration = new ExampleAvaticaServerConfiguration();
HttpServer server = new HttpServer.Builder()
@@ -273,7 +277,6 @@ HttpServer server = new HttpServer.Builder()
.build();
{% endhighlight %}
-
## Client implementation
Many HTTP client libraries, such as [Apache Commons HttpComponents](https://hc.apache.org/), already have
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/site/develop/index.md
----------------------------------------------------------------------
diff --git a/site/develop/index.md b/site/develop/index.md
index 165c1ed..0c8604e 100644
--- a/site/develop/index.md
+++ b/site/develop/index.md
@@ -28,4 +28,4 @@ Please find the development guides for Avatica's components here:
Component | Guide
:---------------- | :-----------------------------------
Avatica | [Development Guide]({{ site.baseurl }}/develop/avatica.html)
-Avatica Go Client | [Development Guide]({{ site.baseurl }}/develop/avatica-go.html)
\ No newline at end of file
+Avatica Go Client | [Development Guide]({{ site.baseurl }}/develop/avatica-go.html)
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/site/doap_calcite-avatica.rdf
----------------------------------------------------------------------
diff --git a/site/doap_calcite-avatica.rdf b/site/doap_calcite-avatica.rdf
index 271a56d..f2a17b6 100644
--- a/site/doap_calcite-avatica.rdf
+++ b/site/doap_calcite-avatica.rdf
@@ -28,11 +28,11 @@ limitations under the License.
<homepage rdf:resource="https://calcite.apache.org/avatica" />
<asfext:pmc rdf:resource="https://calcite.apache.org/avatica" />
<shortdesc>Avatica is a JDBC driver framework which is a part of Apache Calcite.</shortdesc>
- <description>Avatica is defined by a wire API between a client
- and a server. The Avatica server is an HTTP server, the
- Avatica client is a JDBC driver, and the wire API is defined
- by JSON or Protobuf Buffers. The flexibility of the wire API
- and HTTP transport allows other Avatica clients to be built
+ <description>Avatica is defined by a wire API between a client
+ and a server. The Avatica server is an HTTP server, the
+ Avatica client is a JDBC driver, and the wire API is defined
+ by JSON or Protobuf Buffers. The flexibility of the wire API
+ and HTTP transport allows other Avatica clients to be built
in any language, implementing any client specification.</description>
<bug-database rdf:resource="https://issues.apache.org/jira/browse/CALCITE" />
<mailing-list rdf:resource="https://calcite.apache.org/avatica/develop" />
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/site/docker-compose.yml
----------------------------------------------------------------------
diff --git a/site/docker-compose.yml b/site/docker-compose.yml
index 5aa355c..47b3a2d 100644
--- a/site/docker-compose.yml
+++ b/site/docker-compose.yml
@@ -35,4 +35,6 @@ services:
- ../:/usr/src/calcite-avatica
- maven-repo:/root/.m2
volumes:
- maven-repo:
\ No newline at end of file
+ maven-repo:
+
+# End docker-compose.yml
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/site/downloads/avatica-go.md
----------------------------------------------------------------------
diff --git a/site/downloads/avatica-go.md b/site/downloads/avatica-go.md
index ba3ecc4..a9846f8 100644
--- a/site/downloads/avatica-go.md
+++ b/site/downloads/avatica-go.md
@@ -85,4 +85,4 @@ If a download from a mirror fails, retry, and the second download will likely
succeed.
For security, hash and signature files are always hosted at
-[Apache](https://www.apache.org/dist).
\ No newline at end of file
+[Apache](https://www.apache.org/dist).
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/05c59afe/site/downloads/index.md
----------------------------------------------------------------------
diff --git a/site/downloads/index.md b/site/downloads/index.md
index 02d3816..1b9464d 100644
--- a/site/downloads/index.md
+++ b/site/downloads/index.md
@@ -27,4 +27,4 @@ The following downloads are available from the Avatica project:
Component | Download
:---------------- | :-----------------------------------
Avatica | [Source and binaries]({{ site.baseurl }}/downloads/avatica.html)
-Avatica Go Client | [Source]({{ site.baseurl }}/downloads/avatica-go.html)
\ No newline at end of file
+Avatica Go Client | [Source]({{ site.baseurl }}/downloads/avatica-go.html)