asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From il...@apache.org
Subject [4/4] incubator-asterixdb git commit: Added more type providers for statistics
Date Sat, 05 Dec 2015 00:50:07 GMT
Added more type providers for statistics


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

Branch: refs/heads/statistics
Commit: eac7cf5091ecba56c34c3d0d656173e2821c0f8b
Parents: fd5d424
Author: Ildar Absalyamov <ildar.absalyamov@gmail.com>
Authored: Fri Dec 4 16:49:40 2015 -0800
Committer: Ildar Absalyamov <ildar.absalyamov@gmail.com>
Committed: Fri Dec 4 16:49:40 2015 -0800

----------------------------------------------------------------------
 ...AqlOrdinalPrimitiveValueProviderFactory.java | 25 +++++++++++++++++++
 .../DatePrimitiveValueProviderFactory.java      | 26 ++++++++++++++++++++
 .../DateTimePrimitiveValueProviderFactory.java  | 26 ++++++++++++++++++++
 ...meDurationPrimitiveValueProviderFactory.java | 26 ++++++++++++++++++++
 .../TimePrimitiveValueProviderFactory.java      | 26 ++++++++++++++++++++
 ...thDurationPrimitiveValueProviderFactory.java | 26 ++++++++++++++++++++
 .../formats/nontagged/AqlTypeTraitProvider.java |  4 ++-
 7 files changed, 158 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/eac7cf50/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/AqlOrdinalPrimitiveValueProviderFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/AqlOrdinalPrimitiveValueProviderFactory.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/AqlOrdinalPrimitiveValueProviderFactory.java
index 5e85722..88f40f0 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/AqlOrdinalPrimitiveValueProviderFactory.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/AqlOrdinalPrimitiveValueProviderFactory.java
@@ -48,6 +48,16 @@ public class AqlOrdinalPrimitiveValueProviderFactory implements IOrdinalPrimitiv
                     .createOrdinalPrimitiveValueProvider();
             final IOrdinalPrimitiveValueProvider longProvider = LongPrimitiveValueProviderFactory.INSTANCE
                     .createOrdinalPrimitiveValueProvider();
+            final IOrdinalPrimitiveValueProvider dateTimeProvider = DateTimePrimitiveValueProviderFactory.INSTANCE
+                    .createOrdinalPrimitiveValueProvider();
+            final IOrdinalPrimitiveValueProvider dateProvider = DatePrimitiveValueProviderFactory.INSTANCE
+                    .createOrdinalPrimitiveValueProvider();
+            final IOrdinalPrimitiveValueProvider timeProvider = TimePrimitiveValueProviderFactory.INSTANCE
+                    .createOrdinalPrimitiveValueProvider();
+            final IOrdinalPrimitiveValueProvider dayTimeDurationProvider = DayTimeDurationPrimitiveValueProviderFactory.INSTANCE
+                    .createOrdinalPrimitiveValueProvider();
+            final IOrdinalPrimitiveValueProvider yearMonthDurationProvider = YearMonthDurationPrimitiveValueProviderFactory.INSTANCE
+                    .createOrdinalPrimitiveValueProvider();
 
             @Override
             public long getOrdinalValue(byte[] bytes, int offset) {
@@ -66,6 +76,21 @@ public class AqlOrdinalPrimitiveValueProviderFactory implements IOrdinalPrimitiv
                     case INT64: {
                         return longProvider.getOrdinalValue(bytes, offset + 1);
                     }
+                    case DATETIME: {
+                        return dateTimeProvider.getOrdinalValue(bytes, offset + 1);
+                    }
+                    case DATE: {
+                        return dateProvider.getOrdinalValue(bytes, offset + 1);
+                    }
+                    case TIME: {
+                        return timeProvider.getOrdinalValue(bytes, offset + 1);
+                    }
+                    case DAYTIMEDURATION: {
+                        return dayTimeDurationProvider.getOrdinalValue(bytes, offset + 1);
+                    }
+                    case YEARMONTHDURATION: {
+                        return yearMonthDurationProvider.getOrdinalValue(bytes, offset +
1);
+                    }
                     default: {
                         throw new NotImplementedException("Value provider for type " + tag
+ " is not implemented");
                     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/eac7cf50/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DatePrimitiveValueProviderFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DatePrimitiveValueProviderFactory.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DatePrimitiveValueProviderFactory.java
new file mode 100644
index 0000000..5fd43b1
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DatePrimitiveValueProviderFactory.java
@@ -0,0 +1,26 @@
+package org.apache.asterix.dataflow.data.nontagged.valueproviders;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADateSerializerDeserializer;
+import org.apache.hyracks.storage.am.common.api.IOrdinalPrimitiveValueProvider;
+import org.apache.hyracks.storage.am.common.api.IOrdinalPrimitiveValueProviderFactory;
+
+public class DatePrimitiveValueProviderFactory implements IOrdinalPrimitiveValueProviderFactory
{
+
+    private static final long serialVersionUID = 1L;
+
+    public static final DatePrimitiveValueProviderFactory INSTANCE = new DatePrimitiveValueProviderFactory();
+
+    private DatePrimitiveValueProviderFactory() {
+    }
+
+    @Override
+    public IOrdinalPrimitiveValueProvider createOrdinalPrimitiveValueProvider() {
+        return new IOrdinalPrimitiveValueProvider() {
+            @Override
+            public long getOrdinalValue(byte[] bytes, int offset) {
+                return ADateSerializerDeserializer.getChronon(bytes, offset);
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/eac7cf50/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DateTimePrimitiveValueProviderFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DateTimePrimitiveValueProviderFactory.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DateTimePrimitiveValueProviderFactory.java
new file mode 100644
index 0000000..b546320
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DateTimePrimitiveValueProviderFactory.java
@@ -0,0 +1,26 @@
+package org.apache.asterix.dataflow.data.nontagged.valueproviders;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
+import org.apache.hyracks.storage.am.common.api.IOrdinalPrimitiveValueProvider;
+import org.apache.hyracks.storage.am.common.api.IOrdinalPrimitiveValueProviderFactory;
+
+public class DateTimePrimitiveValueProviderFactory implements IOrdinalPrimitiveValueProviderFactory
{
+
+    private static final long serialVersionUID = 1L;
+
+    public static final DateTimePrimitiveValueProviderFactory INSTANCE = new DateTimePrimitiveValueProviderFactory();
+
+    private DateTimePrimitiveValueProviderFactory() {
+    }
+
+    @Override
+    public IOrdinalPrimitiveValueProvider createOrdinalPrimitiveValueProvider() {
+        return new IOrdinalPrimitiveValueProvider() {
+            @Override
+            public long getOrdinalValue(byte[] bytes, int offset) {
+                return ADateTimeSerializerDeserializer.getChronon(bytes, offset);
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/eac7cf50/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DayTimeDurationPrimitiveValueProviderFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DayTimeDurationPrimitiveValueProviderFactory.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DayTimeDurationPrimitiveValueProviderFactory.java
new file mode 100644
index 0000000..8bab8b7
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/DayTimeDurationPrimitiveValueProviderFactory.java
@@ -0,0 +1,26 @@
+package org.apache.asterix.dataflow.data.nontagged.valueproviders;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADayTimeDurationSerializerDeserializer;
+import org.apache.hyracks.storage.am.common.api.IOrdinalPrimitiveValueProvider;
+import org.apache.hyracks.storage.am.common.api.IOrdinalPrimitiveValueProviderFactory;
+
+public class DayTimeDurationPrimitiveValueProviderFactory implements IOrdinalPrimitiveValueProviderFactory
{
+
+    private static final long serialVersionUID = 1L;
+
+    public static final DayTimeDurationPrimitiveValueProviderFactory INSTANCE = new DayTimeDurationPrimitiveValueProviderFactory();
+
+    private DayTimeDurationPrimitiveValueProviderFactory() {
+    }
+
+    @Override
+    public IOrdinalPrimitiveValueProvider createOrdinalPrimitiveValueProvider() {
+        return new IOrdinalPrimitiveValueProvider() {
+            @Override
+            public long getOrdinalValue(byte[] bytes, int offset) {
+                return ADayTimeDurationSerializerDeserializer.getDayTime(bytes, offset);
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/eac7cf50/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/TimePrimitiveValueProviderFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/TimePrimitiveValueProviderFactory.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/TimePrimitiveValueProviderFactory.java
new file mode 100644
index 0000000..3684e8d
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/TimePrimitiveValueProviderFactory.java
@@ -0,0 +1,26 @@
+package org.apache.asterix.dataflow.data.nontagged.valueproviders;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
+import org.apache.hyracks.storage.am.common.api.IOrdinalPrimitiveValueProvider;
+import org.apache.hyracks.storage.am.common.api.IOrdinalPrimitiveValueProviderFactory;
+
+public class TimePrimitiveValueProviderFactory implements IOrdinalPrimitiveValueProviderFactory
{
+
+    private static final long serialVersionUID = 1L;
+
+    public static final TimePrimitiveValueProviderFactory INSTANCE = new TimePrimitiveValueProviderFactory();
+
+    private TimePrimitiveValueProviderFactory() {
+    }
+
+    @Override
+    public IOrdinalPrimitiveValueProvider createOrdinalPrimitiveValueProvider() {
+        return new IOrdinalPrimitiveValueProvider() {
+            @Override
+            public long getOrdinalValue(byte[] bytes, int offset) {
+                return ATimeSerializerDeserializer.getChronon(bytes, offset);
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/eac7cf50/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/YearMonthDurationPrimitiveValueProviderFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/YearMonthDurationPrimitiveValueProviderFactory.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/YearMonthDurationPrimitiveValueProviderFactory.java
new file mode 100644
index 0000000..ced7c97
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/valueproviders/YearMonthDurationPrimitiveValueProviderFactory.java
@@ -0,0 +1,26 @@
+package org.apache.asterix.dataflow.data.nontagged.valueproviders;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
+import org.apache.hyracks.storage.am.common.api.IOrdinalPrimitiveValueProvider;
+import org.apache.hyracks.storage.am.common.api.IOrdinalPrimitiveValueProviderFactory;
+
+public class YearMonthDurationPrimitiveValueProviderFactory implements IOrdinalPrimitiveValueProviderFactory
{
+
+    private static final long serialVersionUID = 1L;
+
+    public static final YearMonthDurationPrimitiveValueProviderFactory INSTANCE = new YearMonthDurationPrimitiveValueProviderFactory();
+
+    private YearMonthDurationPrimitiveValueProviderFactory() {
+    }
+
+    @Override
+    public IOrdinalPrimitiveValueProvider createOrdinalPrimitiveValueProvider() {
+        return new IOrdinalPrimitiveValueProvider() {
+            @Override
+            public long getOrdinalValue(byte[] bytes, int offset) {
+                return AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, offset);
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/eac7cf50/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlTypeTraitProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlTypeTraitProvider.java
b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlTypeTraitProvider.java
index e2e67c4..c6e819f 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlTypeTraitProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlTypeTraitProvider.java
@@ -31,6 +31,7 @@ public class AqlTypeTraitProvider implements ITypeTraitProvider {
     private static final ITypeTraits TWOBYTETYPETRAIT = new TypeTrait(2 + 1);
     private static final ITypeTraits FOURBYTETYPETRAIT = new TypeTrait(4 + 1);
     private static final ITypeTraits EIGHTBYTETYPETRAIT = new TypeTrait(8 + 1);
+    private static final ITypeTraits TWELVEBYTETYPETRAIT = new TypeTrait(12 + 1);
     private static final ITypeTraits SIXTEENBYTETYPETRAIT = new TypeTrait(16 + 1);
     private static final ITypeTraits SEVENTEENBYTETYPETRAIT = new TypeTrait(17 + 1);
     private static final ITypeTraits THIRTYTWOBYTETYPETRAIT = new TypeTrait(32 + 1);
@@ -60,8 +61,9 @@ public class AqlTypeTraitProvider implements ITypeTraitProvider {
             case INT64:
             case DOUBLE:
             case DATETIME:
-            case DURATION:
                 return EIGHTBYTETYPETRAIT;
+            case DURATION:
+                return TWELVEBYTETYPETRAIT;
             case POINT:
             case UUID:
                 return SIXTEENBYTETYPETRAIT;


Mime
View raw message