Added partial changes from Aqua/Asterix
git-svn-id: https://hyracks.googlecode.com/svn/trunk@402 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/application/ApplicationContext.java b/hyracks/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/application/ApplicationContext.java
index e95c4bc..c02c7ad 100644
--- a/hyracks/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/application/ApplicationContext.java
+++ b/hyracks/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/application/ApplicationContext.java
@@ -80,10 +80,10 @@
}
});
classLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]));
- deploymentDescriptor = parseDeploymentDescriptor();
} else {
classLoader = getClass().getClassLoader();
}
+ deploymentDescriptor = parseDeploymentDescriptor();
}
public void initialize() throws Exception {
@@ -203,4 +203,4 @@
public ClassLoader getClassLoader() {
return classLoader;
}
-}
\ No newline at end of file
+}
diff --git a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTupleAppender.java b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTupleAppender.java
index d50b702..4ec1b6f 100644
--- a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTupleAppender.java
+++ b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTupleAppender.java
@@ -117,6 +117,38 @@
}
return false;
}
+
+ public boolean appendConcat(IFrameTupleAccessor accessor0, int tIndex0, int[] fieldSlots, byte[] bytes, int offset,
+ int length) {
+ int startOffset0 = accessor0.getTupleStartOffset(tIndex0);
+ int endOffset0 = accessor0.getTupleEndOffset(tIndex0);
+ int length0 = endOffset0 - startOffset0;
+
+ if (tupleDataEndOffset + length0 + fieldSlots.length * 4 + length + 4 + (tupleCount + 1) * 4 <= frameSize) {
+ ByteBuffer src0 = accessor0.getBuffer();
+ int slotsLen0 = accessor0.getFieldSlotsLength();
+ int dataLen0 = length0 - slotsLen0;
+ // Copy slots from accessor0 verbatim
+ System.arraycopy(src0.array(), startOffset0, buffer.array(), tupleDataEndOffset, slotsLen0);
+ // Copy slots from fieldSlots with the following transformation:
+ // newSlotIdx = oldSlotIdx + dataLen0
+ for (int i = 0; i < fieldSlots.length; ++i) {
+ buffer.putInt(tupleDataEndOffset + slotsLen0 + i * 4, (fieldSlots[i] + dataLen0));
+ }
+ // Copy data0
+ System.arraycopy(src0.array(), startOffset0 + slotsLen0, buffer.array(), tupleDataEndOffset + slotsLen0
+ + fieldSlots.length * 4, dataLen0);
+ // Copy bytes
+ System.arraycopy(bytes, offset, buffer.array(), tupleDataEndOffset + slotsLen0 + fieldSlots.length * 4
+ + dataLen0, length);
+ tupleDataEndOffset += (length0 + fieldSlots.length * 4 + length);
+ buffer.putInt(FrameHelper.getTupleCountOffset(frameSize) - 4 * (tupleCount + 1), tupleDataEndOffset);
+ ++tupleCount;
+ buffer.putInt(FrameHelper.getTupleCountOffset(frameSize), tupleCount);
+ return true;
+ }
+ return false;
+ }
public boolean appendProjection(IFrameTupleAccessor accessor, int tIndex, int[] fields) {
int fTargetSlotsLength = fields.length * 4;
diff --git a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/marshalling/BooleanSerializerDeserializer.java b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/marshalling/BooleanSerializerDeserializer.java
new file mode 100644
index 0000000..7667d2e
--- /dev/null
+++ b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/marshalling/BooleanSerializerDeserializer.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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 edu.uci.ics.hyracks.dataflow.common.data.marshalling;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
+public class BooleanSerializerDeserializer implements ISerializerDeserializer<Boolean> {
+ private static final long serialVersionUID = 1L;
+
+ public static final BooleanSerializerDeserializer INSTANCE = new BooleanSerializerDeserializer();
+
+ private BooleanSerializerDeserializer() {
+ }
+
+ @Override
+ public Boolean deserialize(DataInput in) throws HyracksDataException {
+ try {
+ return in.readBoolean();
+ } catch (IOException e) {
+ throw new HyracksDataException(e);
+ }
+ }
+
+ @Override
+ public void serialize(Boolean instance, DataOutput out) throws HyracksDataException {
+ try {
+ out.writeBoolean(instance.booleanValue());
+ } catch (IOException e) {
+ throw new HyracksDataException(e);
+ }
+ }
+
+ public static boolean getBoolean(byte[] bytes, int offset) {
+ return (bytes[offset] != (byte)0) ? true : false;
+ }
+}
\ No newline at end of file