You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by ti...@apache.org on 2016/05/26 19:19:15 UTC
[5/8] incubator-asterixdb git commit: ASTERIXDB-1220: print nested
values using visitors
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUnionPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUnionPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUnionPrinterFactory.java
index 6fc691d..aa225be 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUnionPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUnionPrinterFactory.java
@@ -41,7 +41,6 @@ public class AUnionPrinterFactory implements IPrinterFactory {
@Override
public IPrinter createPrinter() {
-
return new IPrinter() {
private IPrinter[] printers;
@@ -73,5 +72,4 @@ public class AUnionPrinterFactory implements IPrinterFactory {
}
};
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinter.java
deleted file mode 100644
index 497bf3d..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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 java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class AYearMonthDurationPrinter implements IPrinter {
-
- public static final AYearMonthDurationPrinter INSTANCE = new AYearMonthDurationPrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
-
- int months = AInt32SerializerDeserializer.getInt(b, s + 1);
-
- ps.print("{ \"year-month-duration\": ");
- ps.print(months);
- ps.print("}");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinterFactory.java
index fc92b09..e650162 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AYearMonthDurationPrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.csv;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,12 +29,14 @@ public class AYearMonthDurationPrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final AYearMonthDurationPrinterFactory INSTANCE = new AYearMonthDurationPrinterFactory();
- /* (non-Javadoc)
- * @see org.apache.hyracks.algebricks.data.IPrinterFactory#createPrinter()
- */
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+ ps.print("{ \"year-month-duration\": ");
+ ps.print(AInt32SerializerDeserializer.getInt(b, s + 1));
+ ps.print("}");
+ };
+
@Override
public IPrinter createPrinter() {
- return AYearMonthDurationPrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinter.java
deleted file mode 100644
index 1bbf0f0..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.IOException;
-import java.io.PrintStream;
-
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
-import org.apache.hyracks.util.bytes.HexPrinter;
-
-public class ABinaryHexPrinter implements IPrinter {
- private ABinaryHexPrinter() {
- }
-
- public static final ABinaryHexPrinter INSTANCE = new ABinaryHexPrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
-
- int validLength = ByteArrayPointable.getContentLength(b, s + 1);
- int start = s + 1 + ByteArrayPointable.getNumberBytesToStoreMeta(validLength);
- try {
- ps.print("\"");
- HexPrinter.printHexString(b, start, validLength, ps);
- ps.print("\"");
- } catch (IOException e) {
- throw new HyracksDataException(e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinterFactory.java
new file mode 100644
index 0000000..072f52f
--- /dev/null
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinterFactory.java
@@ -0,0 +1,55 @@
+/*
+ * 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.json.clean;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.IPrinterFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
+import org.apache.hyracks.util.bytes.HexPrinter;
+
+public class ABinaryHexPrinterFactory implements IPrinterFactory {
+ private static final long serialVersionUID = 1L;
+
+ private ABinaryHexPrinterFactory() {
+ }
+
+ public static final ABinaryHexPrinterFactory INSTANCE = new ABinaryHexPrinterFactory();
+
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+ int validLength = ByteArrayPointable.getContentLength(b, s + 1);
+ int start = s + 1 + ByteArrayPointable.getNumberBytesToStoreMeta(validLength);
+ try {
+ ps.print("\"");
+ HexPrinter.printHexString(b, start, validLength, ps);
+ ps.print("\"");
+ } catch (IOException e) {
+ throw new HyracksDataException(e);
+ }
+ };
+
+ @Override
+ public IPrinter createPrinter() {
+ return PRINTER;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryPrinterFactory.java
deleted file mode 100644
index aeee4cb..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryPrinterFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.json.clean;
-
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.algebricks.data.IPrinterFactory;
-
-public class ABinaryPrinterFactory implements IPrinterFactory {
- private static final long serialVersionUID = 1L;
-
- 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/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABooleanPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABooleanPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABooleanPrinter.java
deleted file mode 100644
index 7f5327c..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABooleanPrinter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ABooleanPrinter implements IPrinter {
-
- public static final ABooleanPrinter INSTANCE = new ABooleanPrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- ps.print(ABooleanSerializerDeserializer.getBoolean(b, s + 1));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABooleanPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABooleanPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABooleanPrinterFactory.java
index 108c9a8..ebc09a0 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABooleanPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABooleanPrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,11 @@ public class ABooleanPrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final ABooleanPrinterFactory INSTANCE = new ABooleanPrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+ .print(ABooleanSerializerDeserializer.getBoolean(b, s + 1));
+
@Override
public IPrinter createPrinter() {
- return ABooleanPrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ACirclePrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ACirclePrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ACirclePrinter.java
deleted file mode 100644
index 70b0ff8..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ACirclePrinter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ACirclePrinter implements IPrinter {
-
- public static final ACirclePrinter INSTANCE = new ACirclePrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- 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/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ACirclePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ACirclePrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ACirclePrinterFactory.java
index 926003b..5381d2b 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ACirclePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ACirclePrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,18 @@ public class ACirclePrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final ACirclePrinterFactory INSTANCE = new ACirclePrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+ 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(" ]");
+ };
+
@Override
public IPrinter createPrinter() {
- return ACirclePrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADatePrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADatePrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADatePrinter.java
deleted file mode 100644
index 43ee994..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADatePrinter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ADatePrinter implements IPrinter {
-
- public static final ADatePrinter INSTANCE = new ADatePrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- ps.print("\"");
- PrintTools.printDateString(b, s, l, ps);
- ps.print("\"");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADatePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADatePrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADatePrinterFactory.java
index 4a025cc..386240f 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADatePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADatePrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,14 @@ public class ADatePrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final ADatePrinterFactory INSTANCE = new ADatePrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+ ps.print("\"");
+ PrintTools.printDateString(b, s, l, ps);
+ ps.print("\"");
+ };
+
@Override
public IPrinter createPrinter() {
- return ADatePrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADateTimePrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADateTimePrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADateTimePrinter.java
deleted file mode 100644
index 7c1a746..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADateTimePrinter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ADateTimePrinter implements IPrinter {
-
- public static final ADateTimePrinter INSTANCE = new ADateTimePrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- ps.print("\"");
- PrintTools.printDateTimeString(b, s, l, ps);
- ps.print("\"");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADateTimePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADateTimePrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADateTimePrinterFactory.java
index a856adc..0d43543 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADateTimePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADateTimePrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,14 @@ public class ADateTimePrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final ADateTimePrinterFactory INSTANCE = new ADateTimePrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+ ps.print("\"");
+ PrintTools.printDateTimeString(b, s, l, ps);
+ ps.print("\"");
+ };
+
@Override
public IPrinter createPrinter() {
- return ADateTimePrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADayTimeDurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADayTimeDurationPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADayTimeDurationPrinter.java
deleted file mode 100644
index d7ce053..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADayTimeDurationPrinter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ADayTimeDurationPrinter implements IPrinter {
-
- public static final ADayTimeDurationPrinter INSTANCE = new ADayTimeDurationPrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- ps.print("\"");
- PrintTools.printDayTimeDurationString(b, s, l, ps);
- ps.print("\")");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADayTimeDurationPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADayTimeDurationPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADayTimeDurationPrinterFactory.java
index f00124b..1c39039 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADayTimeDurationPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADayTimeDurationPrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,14 @@ public class ADayTimeDurationPrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final ADayTimeDurationPrinterFactory INSTANCE = new ADayTimeDurationPrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+ ps.print("\"");
+ PrintTools.printDayTimeDurationString(b, s, l, ps);
+ ps.print("\")");
+ };
+
@Override
public IPrinter createPrinter() {
- return ADayTimeDurationPrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinter.java
deleted file mode 100644
index 07bf4fb..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ADoublePrinter implements IPrinter {
-
- public static final ADoublePrinter INSTANCE = new ADoublePrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinterFactory.java
index fdea963..03088fb 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,11 @@ public class ADoublePrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final ADoublePrinterFactory INSTANCE = new ADoublePrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+ .print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+
@Override
public IPrinter createPrinter() {
- return ADoublePrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADurationPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADurationPrinter.java
deleted file mode 100644
index 163fd26..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADurationPrinter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ADurationPrinter implements IPrinter {
-
- public static final ADurationPrinter INSTANCE = new ADurationPrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- ps.print("\"");
- PrintTools.printDurationString(b, s, l, ps);
- ps.print("\"");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADurationPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADurationPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADurationPrinterFactory.java
index da0ece3..e355fec 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADurationPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADurationPrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,14 @@ public class ADurationPrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final ADurationPrinterFactory INSTANCE = new ADurationPrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+ ps.print("\"");
+ PrintTools.printDurationString(b, s, l, ps);
+ ps.print("\"");
+ };
+
@Override
public IPrinter createPrinter() {
- return ADurationPrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinter.java
deleted file mode 100644
index 38937a4..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class AFloatPrinter implements IPrinter {
-
- public static final AFloatPrinter INSTANCE = new AFloatPrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- ps.print(AFloatSerializerDeserializer.getFloat(b, s + 1));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinterFactory.java
index 0067524..827ebec 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,11 @@ public class AFloatPrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final AFloatPrinterFactory INSTANCE = new AFloatPrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+ .print(AFloatSerializerDeserializer.getFloat(b, s + 1));
+
@Override
public IPrinter createPrinter() {
- return AFloatPrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt16Printer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt16Printer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt16Printer.java
deleted file mode 100644
index 57aff95..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt16Printer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class AInt16Printer implements IPrinter {
- public static final AInt16Printer INSTANCE = new AInt16Printer();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- short i = AInt16SerializerDeserializer.getShort(b, s + 1);
- ps.print(i);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt16PrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt16PrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt16PrinterFactory.java
index d87ac6c..4454aa6 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt16PrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt16PrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,11 @@ public class AInt16PrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final AInt16PrinterFactory INSTANCE = new AInt16PrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+ .print(AInt16SerializerDeserializer.getShort(b, s + 1));
+
@Override
public IPrinter createPrinter() {
- return AInt16Printer.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt32Printer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt32Printer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt32Printer.java
deleted file mode 100644
index 996be35..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt32Printer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class AInt32Printer implements IPrinter {
-
- public static final AInt32Printer INSTANCE = new AInt32Printer();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- int d = AInt32SerializerDeserializer.getInt(b, s + 1);
- ps.print(d);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt32PrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt32PrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt32PrinterFactory.java
index 87eaa8e..40bf33d 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt32PrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt32PrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,11 @@ public class AInt32PrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final AInt32PrinterFactory INSTANCE = new AInt32PrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+ .print(AInt32SerializerDeserializer.getInt(b, s + 1));
+
@Override
public IPrinter createPrinter() {
- return AInt32Printer.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt64Printer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt64Printer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt64Printer.java
deleted file mode 100644
index 564e920..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt64Printer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class AInt64Printer implements IPrinter {
- public static final AInt64Printer INSTANCE = new AInt64Printer();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- long d = AInt64SerializerDeserializer.getLong(b, s + 1);
- ps.print(d);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt64PrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt64PrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt64PrinterFactory.java
index e7c4f8f..5fe8e3a 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt64PrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt64PrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,11 @@ public class AInt64PrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final AInt64PrinterFactory INSTANCE = new AInt64PrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+ .print(AInt64SerializerDeserializer.getLong(b, s + 1));
+
@Override
public IPrinter createPrinter() {
- return AInt64Printer.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt8Printer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt8Printer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt8Printer.java
deleted file mode 100644
index 2ed1341..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt8Printer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class AInt8Printer implements IPrinter {
-
- public static final AInt8Printer INSTANCE = new AInt8Printer();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- byte o = AInt8SerializerDeserializer.getByte(b, s + 1);
- ps.print(o);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt8PrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt8PrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt8PrinterFactory.java
index c4acdff..a6c3c97 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt8PrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AInt8PrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,11 @@ public class AInt8PrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final AInt8PrinterFactory INSTANCE = new AInt8PrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+ .print(AInt8SerializerDeserializer.getByte(b, s + 1));
+
@Override
public IPrinter createPrinter() {
- return AInt8Printer.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AIntervalPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AIntervalPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AIntervalPrinter.java
deleted file mode 100644
index 4eb1766..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AIntervalPrinter.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADatePrinter;
-import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADateTimePrinter;
-import org.apache.asterix.dataflow.data.nontagged.printers.adm.ATimePrinter;
-import org.apache.asterix.dataflow.data.nontagged.serde.AIntervalSerializerDeserializer;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.EnumDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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() {
- }
-
- /* (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 HyracksDataException {
- ps.print("{ \"interval\": { \"start\": ");
-
- byte typetag = AIntervalSerializerDeserializer.getIntervalTimeType(b, s + 1);
- int startOffset = AIntervalSerializerDeserializer.getIntervalStartOffset(b, s + 1) - 1;
- int startSize = AIntervalSerializerDeserializer.getStartSize(b, s + 1);
- int endOffset = AIntervalSerializerDeserializer.getIntervalEndOffset(b, s + 1) - 1;
- int endSize = AIntervalSerializerDeserializer.getEndSize(b, s + 1);
-
- IPrinter timeInstancePrinter;
- ATypeTag intervalType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(typetag);
- switch (intervalType) {
- case DATE:
- timeInstancePrinter = ADatePrinter.INSTANCE;
- break;
- case TIME:
- timeInstancePrinter = ATimePrinter.INSTANCE;
- break;
- case DATETIME:
- timeInstancePrinter = ADateTimePrinter.INSTANCE;
- break;
- default:
- throw new HyracksDataException("Unsupported internal time types in interval: " + typetag);
- }
-
- timeInstancePrinter.print(b, startOffset, startSize, ps);
- ps.print(", \"end\": ");
- timeInstancePrinter.print(b, endOffset, endSize, ps);
-
- ps.print("}}");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AIntervalPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AIntervalPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AIntervalPrinterFactory.java
index a0fdfe7..67208e3 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AIntervalPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AIntervalPrinterFactory.java
@@ -18,17 +18,48 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AIntervalSerializerDeserializer;
+import org.apache.asterix.om.types.EnumDeserializer;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
public class AIntervalPrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final AIntervalPrinterFactory INSTANCE = new AIntervalPrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+ ps.print("{ \"interval\": { \"start\": ");
+ byte typetag = AIntervalSerializerDeserializer.getIntervalTimeType(b, s + 1);
+ int startOffset = AIntervalSerializerDeserializer.getIntervalStartOffset(b, s + 1) - 1;
+ int startSize = AIntervalSerializerDeserializer.getStartSize(b, s + 1);
+ int endOffset = AIntervalSerializerDeserializer.getIntervalEndOffset(b, s + 1) - 1;
+ int endSize = AIntervalSerializerDeserializer.getEndSize(b, s + 1);
+ IPrinter timeInstancePrinter = getIPrinter(typetag);
+ timeInstancePrinter.print(b, startOffset, startSize, ps);
+ ps.print(", \"end\": ");
+ timeInstancePrinter.print(b, endOffset, endSize, ps);
+ ps.print("}}");
+ };
+
+ private static IPrinter getIPrinter(byte typetag) throws HyracksDataException {
+ switch (EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(typetag)) {
+ case DATE:
+ return ADatePrinterFactory.PRINTER;
+ case TIME:
+ return ATimePrinterFactory.PRINTER;
+ case DATETIME:
+ return ADateTimePrinterFactory.PRINTER;
+ default:
+ throw new HyracksDataException("Unsupported internal time types in interval: " + typetag);
+ }
+ }
+
@Override
public IPrinter createPrinter() {
- return AIntervalPrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ALinePrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ALinePrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ALinePrinter.java
deleted file mode 100644
index 6b3ea36..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ALinePrinter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ALinePrinter implements IPrinter {
-
- public static final ALinePrinter INSTANCE = new ALinePrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- 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/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ALinePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ALinePrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ALinePrinterFactory.java
index 9624cf5..237be83 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ALinePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ALinePrinterFactory.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +29,20 @@ public class ALinePrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final ALinePrinterFactory INSTANCE = new ALinePrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+ 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("] ]");
+ };
+
@Override
public IPrinter createPrinter() {
- return ALinePrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullPrinter.java
deleted file mode 100644
index 7f0c362..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullPrinter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ANullPrinter implements IPrinter {
-
- public static final ANullPrinter INSTANCE = new ANullPrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- ps.print("null");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullPrinterFactory.java
index 828ae70..d1949b9 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullPrinterFactory.java
@@ -18,6 +18,8 @@
*/
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
+import java.io.PrintStream;
+
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.algebricks.data.IPrinterFactory;
@@ -26,9 +28,10 @@ public class ANullPrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
public static final ANullPrinterFactory INSTANCE = new ANullPrinterFactory();
+ public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps.print("null");
+
@Override
public IPrinter createPrinter() {
- return ANullPrinter.INSTANCE;
+ return PRINTER;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
index 24c8903..b2c13af 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
@@ -31,7 +31,6 @@ import org.apache.hyracks.api.exceptions.HyracksDataException;
public class ANullableFieldPrinterFactory implements IPrinterFactory {
private static final long serialVersionUID = 1L;
-
private AUnionType unionType;
public ANullableFieldPrinterFactory(AUnionType unionType) {
@@ -61,8 +60,6 @@ public class ANullableFieldPrinterFactory implements IPrinterFactory {
fieldPrinter.print(b, s, l, ps);
}
}
-
};
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AObjectPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AObjectPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AObjectPrinter.java
deleted file mode 100644
index ee94187..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AObjectPrinter.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.EnumDeserializer;
-import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class AObjectPrinter implements IPrinter {
-
- public static final AObjectPrinter INSTANCE = new AObjectPrinter();
-
- private IPrinter recordPrinter = new ARecordPrinterFactory(null).createPrinter();
- private IPrinter orderedlistPrinter = new AOrderedlistPrinterFactory(null).createPrinter();
- private IPrinter unorderedListPrinter = new AUnorderedlistPrinterFactory(null).createPrinter();
-
- @Override
- public void init() {
- }
-
- @Override
- public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
- ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[s]);
- switch (typeTag) {
- case INT8: {
- AInt8Printer.INSTANCE.print(b, s, l, ps);
- break;
- }
- case INT16: {
- AInt16Printer.INSTANCE.print(b, s, l, ps);
- break;
- }
- case INT32: {
- AInt32Printer.INSTANCE.print(b, s, l, ps);
- break;
- }
- case INT64: {
- AInt64Printer.INSTANCE.print(b, s, l, ps);
- break;
- }
- case MISSING:
- case NULL: {
- ANullPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case BOOLEAN: {
- ABooleanPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case FLOAT: {
- AFloatPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case DOUBLE: {
- ADoublePrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case DATE: {
- ADatePrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case TIME: {
- ATimePrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case DATETIME: {
- ADateTimePrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case DURATION: {
- ADurationPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case YEARMONTHDURATION: {
- AYearMonthDurationPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case DAYTIMEDURATION: {
- ADayTimeDurationPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case INTERVAL: {
- AIntervalPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case POINT: {
- APointPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case POINT3D: {
- APoint3DPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case LINE: {
- ALinePrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case POLYGON: {
- APolygonPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case CIRCLE: {
- ACirclePrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case RECTANGLE: {
- ARectanglePrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case STRING: {
- AStringPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case BINARY: {
- ABinaryHexPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case RECORD: {
- this.recordPrinter.init();
- recordPrinter.print(b, s, l, ps);
- break;
- }
- case ORDEREDLIST: {
- this.orderedlistPrinter.init();
- orderedlistPrinter.print(b, s, l, ps);
- break;
- }
- case UNORDEREDLIST: {
- this.unorderedListPrinter.init();
- unorderedListPrinter.print(b, s, l, ps);
- break;
- }
- case UUID: {
- AUUIDPrinter.INSTANCE.print(b, s, l, ps);
- break;
- }
- case ANY:
- case BITARRAY:
- case ENUM:
- case SHORTWITHOUTTYPEINFO:
- case SPARSERECORD:
- case SYSTEM_NULL:
- case TYPE:
- case UINT16:
- case UINT32:
- case UINT64:
- case UINT8:
- case UNION:
- throw new NotImplementedException("No printer for type " + typeTag);
- }
- }
-}