You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2016/01/23 01:30:46 UTC

[28/50] [abbrv] calcite git commit: [CALCITE-1020] Add MILLISECOND in TimeUnit (Pengcheng Xiong)

[CALCITE-1020] Add MILLISECOND in TimeUnit (Pengcheng Xiong)


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

Branch: refs/remotes/julianhyde/master
Commit: ebcba3b5ca98d8f894000494a3858ba5a4a269a9
Parents: cabdcf4
Author: Pengcheng Xiong <px...@hortonworks.com>
Authored: Sat Jan 9 23:05:17 2016 -0800
Committer: Julian Hyde <jh...@apache.org>
Committed: Sun Jan 10 00:52:18 2016 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/calcite/avatica/util/TimeUnit.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/ebcba3b5/avatica/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java b/avatica/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java
index c9a6d42..b249232 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java
@@ -27,7 +27,12 @@ public enum TimeUnit {
   DAY(false, '-', DateTimeUtils.MILLIS_PER_DAY, null),
   HOUR(false, ' ', DateTimeUtils.MILLIS_PER_HOUR, BigDecimal.valueOf(24)),
   MINUTE(false, ':', DateTimeUtils.MILLIS_PER_MINUTE, BigDecimal.valueOf(60)),
-  SECOND(false, ':', DateTimeUtils.MILLIS_PER_SECOND, BigDecimal.valueOf(60));
+  SECOND(false, ':', DateTimeUtils.MILLIS_PER_SECOND, BigDecimal.valueOf(60)),
+
+  /** Unlike the other units, MILLISECOND may not be the unit of a SQL interval.
+   * Still, it is convenient to use it internally, when converting to and from
+   * UNIX timestamps. */
+  MILLISECOND(false, '.', 1, BigDecimal.valueOf(1));
 
   public final boolean yearMonth;
   public final char separator;