asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "abdullah alamoudi (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb-bad[master]: Update Tuple Translator signatures for BAD entities
Date Sat, 15 Apr 2017 21:45:19 GMT
abdullah alamoudi has submitted this change and it was merged.

Change subject: Update Tuple Translator signatures for BAD entities
......................................................................


Update Tuple Translator signatures for BAD entities

Change-Id: I7ea03321200cde532b6c1687072340197945b56b
---
M asterix-bad/src/main/java/org/apache/asterix/bad/metadata/BrokerTupleTranslator.java
M asterix-bad/src/main/java/org/apache/asterix/bad/metadata/ChannelTupleTranslator.java
M asterix-bad/src/main/java/org/apache/asterix/bad/metadata/ProcedureTupleTranslator.java
3 files changed, 33 insertions(+), 32 deletions(-)

Approvals:
  Xikui Wang: Looks good to me, approved
  Jenkins: Verified



diff --git a/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/BrokerTupleTranslator.java
b/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/BrokerTupleTranslator.java
index 34397f4..d3d2e66 100644
--- a/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/BrokerTupleTranslator.java
+++ b/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/BrokerTupleTranslator.java
@@ -18,7 +18,6 @@
 import java.io.ByteArrayInputStream;
 import java.io.DataInput;
 import java.io.DataInputStream;
-import java.io.IOException;
 
 import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
@@ -26,6 +25,7 @@
 import org.apache.asterix.om.base.ARecord;
 import org.apache.asterix.om.base.AString;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 
 /**
@@ -43,8 +43,7 @@
 
     @SuppressWarnings("unchecked")
     private ISerializerDeserializer<ARecord> recordSerDes =
-            SerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BADMetadataRecordTypes.BROKER_RECORDTYPE);
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BADMetadataRecordTypes.BROKER_RECORDTYPE);
 
     @SuppressWarnings("unchecked")
     public BrokerTupleTranslator(boolean getTuple) {
@@ -52,7 +51,7 @@
     }
 
     @Override
-    public Broker getMetadataEntityFromTuple(ITupleReference frameTuple) throws IOException
{
+    public Broker getMetadataEntityFromTuple(ITupleReference frameTuple) throws HyracksDataException
{
         byte[] serRecord = frameTuple.getFieldData(BROKER_PAYLOAD_TUPLE_FIELD_INDEX);
         int recordStartOffset = frameTuple.getFieldStart(BROKER_PAYLOAD_TUPLE_FIELD_INDEX);
         int recordLength = frameTuple.getFieldLength(BROKER_PAYLOAD_TUPLE_FIELD_INDEX);
@@ -64,10 +63,11 @@
 
     private Broker createBrokerFromARecord(ARecord brokerRecord) {
         Broker broker = null;
-        String dataverseName = ((AString) brokerRecord
-                .getValueByPos(BADMetadataRecordTypes.BROKER_DATAVERSE_NAME_FIELD_INDEX)).getStringValue();
-        String brokerName = ((AString) brokerRecord.getValueByPos(BADMetadataRecordTypes.BROKER_NAME_FIELD_INDEX))
-                .getStringValue();
+        String dataverseName =
+                ((AString) brokerRecord.getValueByPos(BADMetadataRecordTypes.BROKER_DATAVERSE_NAME_FIELD_INDEX))
+                        .getStringValue();
+        String brokerName =
+                ((AString) brokerRecord.getValueByPos(BADMetadataRecordTypes.BROKER_NAME_FIELD_INDEX)).getStringValue();
         String endPointName = ((AString) brokerRecord.getValueByPos(BADMetadataRecordTypes.BROKER_ENDPOINT_FIELD_INDEX))
                 .getStringValue();
 
@@ -76,7 +76,7 @@
     }
 
     @Override
-    public ITupleReference getTupleFromMetadataEntity(Broker broker) throws IOException,
MetadataException {
+    public ITupleReference getTupleFromMetadataEntity(Broker broker) throws HyracksDataException,
MetadataException {
         // write the key in the first fields of the tuple
 
         tupleBuilder.reset();
diff --git a/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/ChannelTupleTranslator.java
b/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/ChannelTupleTranslator.java
index b9ae250..e6d0249 100644
--- a/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/ChannelTupleTranslator.java
+++ b/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/ChannelTupleTranslator.java
@@ -18,7 +18,6 @@
 import java.io.ByteArrayInputStream;
 import java.io.DataInput;
 import java.io.DataInputStream;
-import java.io.IOException;
 
 import org.apache.asterix.common.functions.FunctionSignature;
 import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
@@ -27,6 +26,7 @@
 import org.apache.asterix.om.base.ARecord;
 import org.apache.asterix.om.base.AString;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 
 /**
@@ -52,7 +52,7 @@
     }
 
     @Override
-    public Channel getMetadataEntityFromTuple(ITupleReference frameTuple) throws IOException
{
+    public Channel getMetadataEntityFromTuple(ITupleReference frameTuple) throws HyracksDataException
{
         byte[] serRecord = frameTuple.getFieldData(CHANNEL_PAYLOAD_TUPLE_FIELD_INDEX);
         int recordStartOffset = frameTuple.getFieldStart(CHANNEL_PAYLOAD_TUPLE_FIELD_INDEX);
         int recordLength = frameTuple.getFieldLength(CHANNEL_PAYLOAD_TUPLE_FIELD_INDEX);
@@ -66,16 +66,20 @@
         Channel channel = null;
         String dataverseName = ((AString) channelRecord
                 .getValueByPos(BADMetadataRecordTypes.CHANNEL_ARECORD_DATAVERSE_NAME_FIELD_INDEX)).getStringValue();
-        String channelName = ((AString) channelRecord
-                .getValueByPos(BADMetadataRecordTypes.CHANNEL_ARECORD_CHANNEL_NAME_FIELD_INDEX)).getStringValue();
+        String channelName =
+                ((AString) channelRecord.getValueByPos(BADMetadataRecordTypes.CHANNEL_ARECORD_CHANNEL_NAME_FIELD_INDEX))
+                        .getStringValue();
         String subscriptionsName = ((AString) channelRecord
                 .getValueByPos(BADMetadataRecordTypes.CHANNEL_ARECORD_SUBSCRIPTIONS_NAME_FIELD_INDEX)).getStringValue();
-        String resultsName = ((AString) channelRecord
-                .getValueByPos(BADMetadataRecordTypes.CHANNEL_ARECORD_RESULTS_NAME_FIELD_INDEX)).getStringValue();
-        String fName = ((AString) channelRecord
-                .getValueByPos(BADMetadataRecordTypes.CHANNEL_ARECORD_FUNCTION_FIELD_INDEX)).getStringValue();
-        String duration = ((AString) channelRecord
-                .getValueByPos(BADMetadataRecordTypes.CHANNEL_ARECORD_DURATION_FIELD_INDEX)).getStringValue();
+        String resultsName =
+                ((AString) channelRecord.getValueByPos(BADMetadataRecordTypes.CHANNEL_ARECORD_RESULTS_NAME_FIELD_INDEX))
+                        .getStringValue();
+        String fName =
+                ((AString) channelRecord.getValueByPos(BADMetadataRecordTypes.CHANNEL_ARECORD_FUNCTION_FIELD_INDEX))
+                        .getStringValue();
+        String duration =
+                ((AString) channelRecord.getValueByPos(BADMetadataRecordTypes.CHANNEL_ARECORD_DURATION_FIELD_INDEX))
+                        .getStringValue();
 
         FunctionSignature signature = null;
 
@@ -98,7 +102,7 @@
     }
 
     @Override
-    public ITupleReference getTupleFromMetadataEntity(Channel channel) throws IOException,
MetadataException {
+    public ITupleReference getTupleFromMetadataEntity(Channel channel) throws HyracksDataException,
MetadataException {
         // write the key in the first fields of the tuple
 
         tupleBuilder.reset();
diff --git a/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/ProcedureTupleTranslator.java
b/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/ProcedureTupleTranslator.java
index e151aea..f324a46 100644
--- a/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/ProcedureTupleTranslator.java
+++ b/asterix-bad/src/main/java/org/apache/asterix/bad/metadata/ProcedureTupleTranslator.java
@@ -22,7 +22,6 @@
 import java.io.ByteArrayInputStream;
 import java.io.DataInput;
 import java.io.DataInputStream;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -36,6 +35,7 @@
 import org.apache.asterix.om.base.IACursor;
 import org.apache.asterix.om.types.AOrderedListType;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 
@@ -63,7 +63,7 @@
     }
 
     @Override
-    public Procedure getMetadataEntityFromTuple(ITupleReference frameTuple) throws IOException
{
+    public Procedure getMetadataEntityFromTuple(ITupleReference frameTuple) throws HyracksDataException
{
         byte[] serRecord = frameTuple.getFieldData(PROCEDURE_PAYLOAD_TUPLE_FIELD_INDEX);
         int recordStartOffset = frameTuple.getFieldStart(PROCEDURE_PAYLOAD_TUPLE_FIELD_INDEX);
         int recordLength = frameTuple.getFieldLength(PROCEDURE_PAYLOAD_TUPLE_FIELD_INDEX);
@@ -74,20 +74,16 @@
     }
 
     private Procedure createProcedureFromARecord(ARecord procedureRecord) {
-        String dataverseName =
- ((AString) procedureRecord
-                .getValueByPos(BADMetadataRecordTypes.PROCEDURE_ARECORD_DATAVERSENAME_FIELD_INDEX))
-                        .getStringValue();
-        String procedureName =
- ((AString) procedureRecord
-                .getValueByPos(BADMetadataRecordTypes.PROCEDURE_ARECORD_PROCEDURE_NAME_FIELD_INDEX))
-                        .getStringValue();
+        String dataverseName = ((AString) procedureRecord
+                .getValueByPos(BADMetadataRecordTypes.PROCEDURE_ARECORD_DATAVERSENAME_FIELD_INDEX)).getStringValue();
+        String procedureName = ((AString) procedureRecord
+                .getValueByPos(BADMetadataRecordTypes.PROCEDURE_ARECORD_PROCEDURE_NAME_FIELD_INDEX)).getStringValue();
         String arity = ((AString) procedureRecord
                 .getValueByPos(BADMetadataRecordTypes.PROCEDURE_ARECORD_PROCEDURE_ARITY_FIELD_INDEX)).getStringValue();
 
         IACursor cursor = ((AOrderedList) procedureRecord
                 .getValueByPos(BADMetadataRecordTypes.PROCEDURE_ARECORD_PROCEDURE_PARAM_LIST_FIELD_INDEX)).getCursor();
-        List<String> params = new ArrayList<String>();
+        List<String> params = new ArrayList<>();
         while (cursor.next()) {
             params.add(((AString) cursor.get()).getStringValue());
         }
@@ -114,7 +110,8 @@
     }
 
     @Override
-    public ITupleReference getTupleFromMetadataEntity(Procedure procedure) throws IOException,
MetadataException {
+    public ITupleReference getTupleFromMetadataEntity(Procedure procedure)
+            throws HyracksDataException, MetadataException {
         // write the key in the first 2 fields of the tuple
         tupleBuilder.reset();
         aString.setValue(procedure.getEntityId().getDataverse());

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1684
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7ea03321200cde532b6c1687072340197945b56b
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb-bad
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <bamousaa@gmail.com>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Steven Jacobs <sjaco002@ucr.edu>
Gerrit-Reviewer: Xikui Wang <xkkwww@gmail.com>
Gerrit-Reviewer: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message