asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject incubator-asterixdb git commit: ASTERIXDB-976: CSV support for all basic types
Date Fri, 23 Oct 2015 00:31:58 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master e1dad1984 -> 5a465a014


ASTERIXDB-976: CSV support for all basic types

Implements date/time, spatial, UUID, and hexbinary types for CSV output.
Spatial output is "best we can do" - a double-quoted string containing the
"clean JSON" representation of the value. Interval remains unsupported.

Also fixes a few import errors in the clean JSON implementation.

Change-Id: I7a515efd2bbf25895537413b45eb0992484c7412
Reviewed-on: https://asterix-gerrit.ics.uci.edu/444
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
Reviewed-by: Ian Maxon <imaxon@apache.org>


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

Branch: refs/heads/master
Commit: 5a465a014512f4a053b8c4c936fe2775b43f135f
Parents: e1dad19
Author: Chris Hillery <chillery@lambda.nu>
Authored: Mon Oct 12 23:30:55 2015 -0700
Committer: Chris Hillery <ceej@lambda.nu>
Committed: Thu Oct 22 16:13:32 2015 -0700

----------------------------------------------------------------------
 .../csv/basic-types/basic-types.1.ddl.aql       | 29 ++++++++++--
 .../csv/basic-types/basic-types.2.query.aql     | 26 +++++++++-
 .../csv/basic-types-header/basic-types.1.csv    |  3 +-
 .../results/csv/basic-types/basic-types.1.csv   |  2 +-
 .../printers/csv/ABinaryHexPrinter.java         | 50 ++++++++++++++++++++
 .../printers/csv/ABinaryPrinterFactory.java     | 36 ++++++++++++++
 .../nontagged/printers/csv/ACirclePrinter.java  |  8 +++-
 .../nontagged/printers/csv/ADatePrinter.java    |  6 ++-
 .../printers/csv/ADateTimePrinter.java          |  6 ++-
 .../printers/csv/ADayTimeDurationPrinter.java   |  8 ++--
 .../printers/csv/ADurationPrinter.java          |  6 ++-
 .../printers/csv/AIntervalPrinter.java          |  7 +--
 .../nontagged/printers/csv/ALinePrinter.java    | 10 +++-
 .../nontagged/printers/csv/APoint3DPrinter.java |  8 +++-
 .../nontagged/printers/csv/APointPrinter.java   |  6 ++-
 .../nontagged/printers/csv/APolygonPrinter.java | 20 +++++++-
 .../printers/csv/ARectanglePrinter.java         | 11 ++++-
 .../nontagged/printers/csv/ATimePrinter.java    |  7 +--
 .../nontagged/printers/csv/AUUIDPrinter.java    | 48 +++++++++++++++++++
 .../printers/csv/AUUIDPrinterFactory.java       | 36 ++++++++++++++
 .../printers/csv/AYearMonthDurationPrinter.java | 11 ++---
 .../printers/json/clean/APolygonPrinter.java    |  1 -
 .../json/clean/AUUIDPrinterFactory.java         |  1 -
 .../pointables/printer/csv/APrintVisitor.java   | 15 ++++--
 .../printer/json/clean/APrintVisitor.java       |  4 +-
 25 files changed, 314 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-app/src/test/resources/runtimets/queries/csv/basic-types/basic-types.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/csv/basic-types/basic-types.1.ddl.aql
b/asterix-app/src/test/resources/runtimets/queries/csv/basic-types/basic-types.1.ddl.aql
index 570cb7c..6af0413 100644
--- a/asterix-app/src/test/resources/runtimets/queries/csv/basic-types/basic-types.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/csv/basic-types/basic-types.1.ddl.aql
@@ -21,8 +21,27 @@ create dataverse test;
 
 use dataverse test;
 
-create type "foo" as {
-  "id": int64,
-  "name": string,
-  "money": float
-};
+create type AllType as open {
+  id: int64,
+  string: string,
+  float: float,
+  double: double,
+  boolean: boolean,
+  int8: int8,
+  int16: int16,
+  int32: int32,
+  int64: int64,
+  date: date,
+  time: time,
+  datetime: datetime,
+  duration: duration,
+  point: point,
+  point3d: point3d,
+  line: line,
+  rectangle: rectangle,
+  polygon: polygon,
+  circle: circle,
+  binary: binary,
+  uuid: uuid
+  // union
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-app/src/test/resources/runtimets/queries/csv/basic-types/basic-types.2.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/csv/basic-types/basic-types.2.query.aql
b/asterix-app/src/test/resources/runtimets/queries/csv/basic-types/basic-types.2.query.aql
index 6fea86e..f3c44ea 100644
--- a/asterix-app/src/test/resources/runtimets/queries/csv/basic-types/basic-types.2.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/csv/basic-types/basic-types.2.query.aql
@@ -17,5 +17,27 @@
  * under the License.
  */
 use dataverse "test";
-set output-record-type "foo";
-{ "money": float("18.25"), "id": 12345, "name": "Chris"}
+set output-record-type "AllType";
+
+{ "id": 10,
+"string": string("Nancy"),
+"float": 32.5f,
+"double" : double("-2013.5938237483274"),
+"boolean" : true,
+"int8": int8("125"),
+"int16": int16("32765"),
+"int32": int32("294967295"),
+"int64": int64("1700000000000000000"),
+"date": date("-2011-01-27"),
+"time": time("12:20:30Z"),
+"datetime": datetime("-1951-12-27T12:20:30"),
+"duration": duration("P10Y11M12DT10H50M30S"),
+"point": point("41.00,44.00"),
+"point3d": point3d("44.00,13.00,41.00"),
+"line" : line("10.1,11.1 10.2,11.2"),
+"rectangle" : rectangle("5.1,11.8 87.6,15.6548"),
+"polygon" : polygon("1.2,1.3 2.1,2.5 3.5,3.6 4.6,4.8"),
+"circle" : circle("10.1,11.1 10.2"),
+"binary" : hex("ABCDEF0123456789"),
+"uuid" : uuid("5c848e5c-6b6a-498f-8452-8847a2957421")
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-app/src/test/resources/runtimets/results/csv/basic-types-header/basic-types.1.csv
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/csv/basic-types-header/basic-types.1.csv
b/asterix-app/src/test/resources/runtimets/results/csv/basic-types-header/basic-types.1.csv
index 941639e..e41b3bf 100644
--- a/asterix-app/src/test/resources/runtimets/results/csv/basic-types-header/basic-types.1.csv
+++ b/asterix-app/src/test/resources/runtimets/results/csv/basic-types-header/basic-types.1.csv
@@ -1,2 +1 @@
-"id","name","money"
-12345,Chris,18.25
+"id","string","float","double","boolean","int8","int16","int32","int64","date","time","datetime","duration","point","point3d","line","rectangle","polygon","circle","binary","uuid"10,"Nancy",32.5,-2013.5938237483274,true,125,32765,294967295,1700000000000000000,"-2011-01-27","12:20:30.000Z","-1951-12-27T12:20:30.000Z","P10Y11M12DT10H50M30S","[41.0,
44.0]","[44.0, 13.0, 41.0]","[ [10.1, 11.1], [10.2, 11.2] ]","[ [5.1, 11.8], [87.6, 15.6548]
]","[ [1.2, 1.3], [2.1, 2.5], [3.5, 3.6], [4.6, 4.8] ]","[ [10.1, 11.1], 10.2 ]",ABCDEF0123456789,"5c848e5c-6b6a-498f-8452-8847a2957421"

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-app/src/test/resources/runtimets/results/csv/basic-types/basic-types.1.csv
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/csv/basic-types/basic-types.1.csv
b/asterix-app/src/test/resources/runtimets/results/csv/basic-types/basic-types.1.csv
index c7fe1a0..4af8707 100644
--- a/asterix-app/src/test/resources/runtimets/results/csv/basic-types/basic-types.1.csv
+++ b/asterix-app/src/test/resources/runtimets/results/csv/basic-types/basic-types.1.csv
@@ -1 +1 @@
-12345,Chris,18.25
+10,"Nancy",32.5,-2013.5938237483274,true,125,32765,294967295,1700000000000000000,"-2011-01-27","12:20:30.000Z","-1951-12-27T12:20:30.000Z","P10Y11M12DT10H50M30S","[41.0,
44.0]","[44.0, 13.0, 41.0]","[ [10.1, 11.1], [10.2, 11.2] ]","[ [5.1, 11.8], [87.6, 15.6548]
]","[ [1.2, 1.3], [2.1, 2.5], [3.5, 3.6], [4.6, 4.8] ]","[ [10.1, 11.1], 10.2 ]",ABCDEF0123456789,"5c848e5c-6b6a-498f-8452-8847a2957421"

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryHexPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryHexPrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryHexPrinter.java
new file mode 100644
index 0000000..8cf5e3e
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryHexPrinter.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.dataflow.data.nontagged.printers.csv;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
+import org.apache.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.data.IPrinter;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+public class ABinaryHexPrinter implements IPrinter {
+    private ABinaryHexPrinter() {
+    }
+
+    public static final ABinaryHexPrinter INSTANCE = new ABinaryHexPrinter();
+
+    @Override public void init() throws AlgebricksException {
+
+    }
+
+    @Override public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
+        int validLength = ABinarySerializerDeserializer.getLength(b, s + 1);
+        int start = s + 1 + ABinarySerializerDeserializer.SIZE_OF_LENGTH;
+        try {
+            PrintTools.printHexString(b, start, validLength, ps);
+        } catch (IOException e) {
+            throw new AlgebricksException(e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryPrinterFactory.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryPrinterFactory.java
new file mode 100644
index 0000000..4c65895
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryPrinterFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.dataflow.data.nontagged.printers.csv;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ABinaryHexPrinter;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.IPrinterFactory;
+
+public class ABinaryPrinterFactory implements IPrinterFactory {
+
+    private ABinaryPrinterFactory() {
+    }
+
+    public static final ABinaryPrinterFactory INSTANCE = new ABinaryPrinterFactory();
+
+    @Override public IPrinter createPrinter() {
+        return ABinaryHexPrinter.INSTANCE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ACirclePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ACirclePrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ACirclePrinter.java
index 31ce91f..d14a53b 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ACirclePrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ACirclePrinter.java
@@ -35,6 +35,12 @@ public class ACirclePrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
-        throw new AlgebricksException("'Circle' type unsupported for CSV output");
+        ps.print("\"[ [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
+        ps.print("], ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 17));
+        ps.print(" ]\"");
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADatePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADatePrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADatePrinter.java
index b6c4504..dd06dbc 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADatePrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADatePrinter.java
@@ -20,6 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
 import java.io.PrintStream;
 
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.data.IPrinter;
 
@@ -34,7 +35,8 @@ public class ADatePrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
-        // QQQ should be supported - issue 833
-        throw new AlgebricksException("'Date' type unsupported for CSV output");
+        ps.print("\"");
+        PrintTools.printDateString(b, s, l, ps);
+        ps.print("\"");
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinter.java
index c6f88b9..e39e813 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinter.java
@@ -20,6 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
 import java.io.PrintStream;
 
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.data.IPrinter;
 
@@ -34,7 +35,8 @@ public class ADateTimePrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
-        // QQQ should be supported - issue 833
-        throw new AlgebricksException("'DateTime' type unsupported for CSV output");
+        ps.print("\"");
+        PrintTools.printDateTimeString(b, s, l, ps);
+        ps.print("\"");
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinter.java
index 74751a4..05b1d79 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinter.java
@@ -20,6 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
 import java.io.PrintStream;
 
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.data.IPrinter;
@@ -35,9 +36,8 @@ public class ADayTimeDurationPrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
-        long milliseconds = AInt64SerializerDeserializer.getLong(b, s + 1);
-        // QQQ acceptable output for CSV?
-        ps.print(milliseconds);
+        ps.print("\"");
+        PrintTools.printDayTimeDurationString(b, s, l, ps);
+        ps.print("\")");
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinter.java
index 34768d0..d37027b 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinter.java
@@ -20,6 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
 import java.io.PrintStream;
 
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -36,7 +37,8 @@ public class ADurationPrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
-        // QQQ Should possibly be supported? - issue 833
-        throw new AlgebricksException("'Duration' type unsupported for CSV output");
+        ps.print("\"");
+        PrintTools.printDurationString(b, s, l, ps);
+        ps.print("\"");
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
index 3a95a32..b9a42ac 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
@@ -27,16 +27,11 @@ public class AIntervalPrinter implements IPrinter {
 
     public static final AIntervalPrinter INSTANCE = new AIntervalPrinter();
 
-    /* (non-Javadoc)
-     * @see org.apache.hyracks.algebricks.data.IPrinter#init()
-     */
+
     @Override
     public void init() throws AlgebricksException {
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.hyracks.algebricks.data.IPrinter#print(byte[], int, int, java.io.PrintStream)
-     */
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
         throw new AlgebricksException("'Interval' type unsupported for CSV output");

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinter.java
index a1b63f1..5241797 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinter.java
@@ -35,6 +35,14 @@ public class ALinePrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
-        throw new AlgebricksException("'Line' type unsupported for CSV output");
+        ps.print("\"[ [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
+        ps.print("], [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 17));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 25));
+        ps.print("] ]\"");
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinter.java
index 2431f28..4ad8da9 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinter.java
@@ -35,6 +35,12 @@ public class APoint3DPrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
-        throw new AlgebricksException("'Point3D' type unsupported for CSV output");
+        ps.print("\"[");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 17));
+        ps.print("]\"");
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinter.java
index dfb2024..e3af0f2 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinter.java
@@ -35,6 +35,10 @@ public class APointPrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
-        throw new AlgebricksException("'Point' type unsupported for CSV output");
+        ps.print("\"[");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
+        ps.print("]\"");
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinter.java
index 284c9ec..d61d427 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinter.java
@@ -36,6 +36,24 @@ public class APolygonPrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
-        throw new AlgebricksException("'Polygon' type unsupported for CSV output");
+        short numberOfPoints = AInt16SerializerDeserializer.getShort(b, s + 1);
+        s += 3;
+
+        ps.print("\"[ ");
+
+        for (int i = 0; i < numberOfPoints; i++) {
+            if (i > 0)
+                ps.print(", ");
+
+            ps.print("[");
+            ps.print(ADoubleSerializerDeserializer.getDouble(b, s));
+            ps.print(", ");
+            ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 8));
+            ps.print("]");
+
+            s += 16;
+        }
+
+        ps.print(" ]\"");
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinter.java
index f05d45c..ab0dd99 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinter.java
@@ -21,6 +21,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 import java.io.PrintStream;
 
 import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.data.IPrinter;
 
@@ -35,6 +36,14 @@ public class ARectanglePrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
-        throw new AlgebricksException("'Rectangle' type unsupported for CSV output");
+        ps.print("\"[ [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
+        ps.print("], [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 17));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 25));
+        ps.print("] ]\"");
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinter.java
index 8fa3c99..e26eafa 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinter.java
@@ -20,6 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
 import java.io.PrintStream;
 
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.data.IPrinter;
@@ -35,8 +36,8 @@ public class ATimePrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
-        // QQQ probably should be supported - issue 833
-        throw new AlgebricksException("'Time' type unsupported for CSV output");
+        ps.print("\"");
+        PrintTools.printTimeString(b, s, l, ps);
+        ps.print("\"");
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java
new file mode 100644
index 0000000..34dd3a2
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.dataflow.data.nontagged.printers.csv;
+
+import org.apache.asterix.om.base.AMutableUUID;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+
+import java.io.PrintStream;
+
+public class AUUIDPrinter implements IPrinter {
+
+    public static final AUUIDPrinter INSTANCE = new AUUIDPrinter();
+    // We use mutable UUID not to create a UUID object multiple times.
+    AMutableUUID uuid = new AMutableUUID(0, 0);
+
+    @Override
+    public void init() throws AlgebricksException {
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
+        long msb = LongPointable.getLong(b, s + 1);
+        long lsb = LongPointable.getLong(b, s + 9);
+        uuid.setValue(msb, lsb);
+
+        ps.print("\"" + uuid.toStringLiteralOnly() + "\"");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinterFactory.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinterFactory.java
new file mode 100644
index 0000000..e15e297
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinterFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.dataflow.data.nontagged.printers.csv;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinter;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.IPrinterFactory;
+
+public class AUUIDPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final AUUIDPrinterFactory INSTANCE = new AUUIDPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AUUIDPrinter.INSTANCE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinter.java
index e76986a..567e5ce 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinter.java
@@ -28,21 +28,18 @@ public class AYearMonthDurationPrinter implements IPrinter {
 
     public static final AYearMonthDurationPrinter INSTANCE = new AYearMonthDurationPrinter();
 
-    /* (non-Javadoc)
-     * @see org.apache.hyracks.algebricks.data.IPrinter#init()
-     */
     @Override
     public void init() throws AlgebricksException {
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.hyracks.algebricks.data.IPrinter#print(byte[], int, int, java.io.PrintStream)
-     */
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException
{
+
         int months = AInt32SerializerDeserializer.getInt(b, s + 1);
-        // QQQ reasonable CSV representation?
+
+        ps.print("{ \"year-month-duration\": ");
         ps.print(months);
+        ps.print("}");
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/APolygonPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/APolygonPrinter.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/APolygonPrinter.java
index c4fa103..350f214 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/APolygonPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/APolygonPrinter.java
@@ -55,6 +55,5 @@ public class APolygonPrinter implements IPrinter {
         }
 
         ps.print(" ]");
-
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUUIDPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUUIDPrinterFactory.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUUIDPrinterFactory.java
index f84b5b8..eeda0e2 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUUIDPrinterFactory.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUUIDPrinterFactory.java
@@ -33,5 +33,4 @@ public class AUUIDPrinterFactory implements IPrinterFactory {
     public IPrinter createPrinter() {
         return AUUIDPrinter.INSTANCE;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/om/pointables/printer/csv/APrintVisitor.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/pointables/printer/csv/APrintVisitor.java
b/asterix-om/src/main/java/org/apache/asterix/om/pointables/printer/csv/APrintVisitor.java
index 378be33..04e3e27 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/pointables/printer/csv/APrintVisitor.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/pointables/printer/csv/APrintVisitor.java
@@ -19,13 +19,9 @@
 
 package org.apache.asterix.om.pointables.printer.csv;
 
-import java.io.PrintStream;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinter;
+import org.apache.asterix.dataflow.data.nontagged.printers.csv.ABinaryHexPrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.ABooleanPrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.ACirclePrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.ADatePrinter;
@@ -46,6 +42,7 @@ import org.apache.asterix.dataflow.data.nontagged.printers.csv.APolygonPrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.ARectanglePrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.AStringPrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.ATimePrinter;
+import org.apache.asterix.dataflow.data.nontagged.printers.csv.AUUIDPrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.AYearMonthDurationPrinter;
 import org.apache.asterix.om.pointables.AFlatValuePointable;
 import org.apache.asterix.om.pointables.AListVisitablePointable;
@@ -56,6 +53,10 @@ import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.common.utils.Pair;
 
+import java.io.PrintStream;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * This class is a IVisitablePointableVisitor implementation which recursively
  * visit a given record, list or flat value of a given type, and print it to a
@@ -178,6 +179,10 @@ public class APrintVisitor implements IVisitablePointableVisitor<Void,
Pair<Prin
                     AStringPrinter.INSTANCE.print(b, s, l, ps);
                     break;
                 }
+                case BINARY: {
+                    ABinaryHexPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
                 case YEARMONTHDURATION: {
                     AYearMonthDurationPrinter.INSTANCE.print(b, s, l, ps);
                     break;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/5a465a01/asterix-om/src/main/java/org/apache/asterix/om/pointables/printer/json/clean/APrintVisitor.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/pointables/printer/json/clean/APrintVisitor.java
b/asterix-om/src/main/java/org/apache/asterix/om/pointables/printer/json/clean/APrintVisitor.java
index bf9c9b6..734319a 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/pointables/printer/json/clean/APrintVisitor.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/pointables/printer/json/clean/APrintVisitor.java
@@ -21,6 +21,7 @@ package org.apache.asterix.om.pointables.printer.json.clean;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinter;
+import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ABinaryHexPrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ABooleanPrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ACirclePrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ADatePrinter;
@@ -41,9 +42,8 @@ import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.APolygonPr
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ARectanglePrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AStringPrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ATimePrinter;
+import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AUUIDPrinter;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AYearMonthDurationPrinter;
-import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ABinaryHexPrinter;
-import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AUUIDPrinter;
 import org.apache.asterix.om.pointables.AFlatValuePointable;
 import org.apache.asterix.om.pointables.AListVisitablePointable;
 import org.apache.asterix.om.pointables.ARecordVisitablePointable;



Mime
View raw message