[NO ISSUE][TYPE] Fix offset handling in serializers-deserializers
Details:
- The non-tagged serializers should not contain any type tag
- Remove the assumption of the input to be tagged in a non-tagged
serializer for Point, Line, Rectangle, Circle, Polygon types
- Fix the offset considering that the serializers return the offset
passing the type tag
Change-Id: I4bb2c4d3c142cd0cb6722fe1972da7346af2cc78
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/5847
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
index a2b2ec1..a52c47c 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
@@ -117,11 +117,11 @@
throws HyracksDataException { // ray casting
double pX = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+ offset0 + 1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
double pY = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+ offset0 + 1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
int numOfPoints1 = AInt16SerializerDeserializer.getShort(bytes1,
- offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
+ offset1 + 1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
if (numOfPoints1 < 3) {
throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
@@ -132,21 +132,21 @@
double xInters;
double x1, x2, y1, y2;
x1 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
+ offset1 + 1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
y1 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
+ offset1 + 1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
for (int i = 1; i <= numOfPoints1; i++) {
if (i == numOfPoints1) {
- x2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
- y2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
+ x2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
+ y2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
} else {
- x2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
- y2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
+ x2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
+ y2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
}
if (!pointOnLine(pX, pY, x1, y1, x2, y2)) {
@@ -176,16 +176,16 @@
private boolean pointInCircle(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
throws HyracksDataException {
double x = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+ offset0 + 1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
double y = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+ offset0 + 1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
- double cX = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
- double cY = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
+ double cX = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
+ double cY = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
double radius = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ACircleSerializerDeserializer.getRadiusOffset());
+ offset1 + 1 + ACircleSerializerDeserializer.getRadiusOffset());
if ((x - cX) * (x - cX) + (y - cY) * (y - cY) <= (radius * radius)) {
return true;
@@ -222,16 +222,16 @@
private boolean linePolygonIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
throws HyracksDataException {
double startX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
+ offset0 + 1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
double startY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
+ offset0 + 1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
double endX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
+ offset0 + 1 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
double endY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
+ offset0 + 1 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
int numOfPoints1 = AInt16SerializerDeserializer.getShort(bytes1,
- offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
+ offset1 + 1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
if (numOfPoints1 < 3) {
throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
@@ -239,21 +239,21 @@
}
for (int i = 0; i < numOfPoints1; i++) {
double startX2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
+ offset1 + 1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
double startY2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
+ offset1 + 1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
double endX2;
double endY2;
if (i + 1 == numOfPoints1) {
- endX2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
- endY2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
+ endX2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
+ endY2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
} else {
- endX2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1
+ endX2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.X));
- endY2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1
+ endY2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.Y));
}
@@ -269,23 +269,23 @@
private boolean lineRectangleIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
throws HyracksDataException {
double startX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
+ offset0 + 1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
double startY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
+ offset0 + 1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
double endX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
+ offset0 + 1 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
double endY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
+ offset0 + 1 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
- double x1 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
- double y1 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
+ double x1 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
+ double y1 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
- double x2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
- double y2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
+ double x2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
+ double y2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
if (lineLineIntersection(startX1, startY1, endX1, endY1, x1, y1, x1, y2)
|| lineLineIntersection(startX1, startY1, endX1, endY1, x1, y2, x2, y2)
@@ -300,20 +300,20 @@
private boolean lineCircleIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
throws HyracksDataException {
double startX = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
+ offset0 + 1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
double startY = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
+ offset0 + 1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
double endX = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
+ offset0 + 1 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
double endY = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
+ offset0 + 1 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
- double cX = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
- double cY = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
+ double cX = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
+ double cY = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
double radius = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ACircleSerializerDeserializer.getRadiusOffset());
+ offset1 + 1 + ACircleSerializerDeserializer.getRadiusOffset());
double dx = endX - startX;
double dy = endY - startY;
@@ -339,19 +339,19 @@
int p;
double Ax, Ay, Bx, By, Cx, Cy, Px, Py;
- Ax = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+ Ax = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(u), Coordinate.X));
- Ay = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+ Ay = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(u), Coordinate.Y));
- Bx = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+ Bx = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(v), Coordinate.X));
- By = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+ By = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(v), Coordinate.Y));
- Cx = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+ Cx = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(w), Coordinate.X));
- Cy = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+ Cy = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(w), Coordinate.Y));
if (SpatialUtils.doubleEpsilon() > (((Bx - Ax) * (Cy - Ay)) - ((By - Ay) * (Cx - Ax)))) {
@@ -363,10 +363,12 @@
if ((p == u) || (p == v) || (p == w)) {
continue;
}
- Px = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
- .getCoordinateOffset(pointsOffsets.get(p), Coordinate.X));
- Py = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
- .getCoordinateOffset(pointsOffsets.get(p), Coordinate.Y));
+ Px = ADoubleSerializerDeserializer.getDouble(bytes,
+ offset + 1 + APolygonSerializerDeserializer
+ .getCoordinateOffset(pointsOffsets.get(p), Coordinate.X));
+ Py = ADoubleSerializerDeserializer.getDouble(bytes,
+ offset + 1 + APolygonSerializerDeserializer
+ .getCoordinateOffset(pointsOffsets.get(p), Coordinate.Y));
if (pointInsideTriangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py)) {
return false;
}
@@ -410,32 +412,32 @@
SpatialUtils.setTriangleXCoordinate(trianglesX, triangleId, 0,
ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer
+ offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(u), Coordinate.X)));
SpatialUtils.setTriangleYCoordinate(trianglesY, triangleId, 0,
ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer
+ offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(u), Coordinate.Y)));
SpatialUtils.setTriangleXCoordinate(trianglesX, triangleId, 1,
ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer
+ offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(v), Coordinate.X)));
SpatialUtils.setTriangleYCoordinate(trianglesY, triangleId, 1,
ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer
+ offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(v), Coordinate.Y)));
SpatialUtils.setTriangleXCoordinate(trianglesX, triangleId, 2,
ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer
+ offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(w), Coordinate.X)));
SpatialUtils.setTriangleYCoordinate(trianglesY, triangleId, 2,
ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer
+ offset + 1 + APolygonSerializerDeserializer
.getCoordinateOffset(pointsOffsets.get(w), Coordinate.Y)));
// remove v from polygon
@@ -488,12 +490,12 @@
private boolean circleTriangleIntersection(byte[] bytes0, int offset0, DoubleArray trianglesX,
DoubleArray trianglesY, int triangleId) throws HyracksDataException { // separating axis theorem
- double cX = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
- double cY = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
+ double cX = ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1
+ + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
+ double cY = ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1
+ + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
double radius = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ACircleSerializerDeserializer.getRadiusOffset());
+ offset0 + 1 + ACircleSerializerDeserializer.getRadiusOffset());
double distance = Double.MAX_VALUE;
double distanceSquared;
@@ -554,19 +556,19 @@
private boolean circleCircleIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
throws HyracksDataException {
- double cX0 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
- double cY0 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
+ double cX0 = ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1
+ + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
+ double cY0 = ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1
+ + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
double radius0 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ACircleSerializerDeserializer.getRadiusOffset());
+ offset0 + 1 + ACircleSerializerDeserializer.getRadiusOffset());
- double cX1 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
- double cY1 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
+ double cX1 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
+ double cY1 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
double radius1 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ACircleSerializerDeserializer.getRadiusOffset());
+ offset1 + 1 + ACircleSerializerDeserializer.getRadiusOffset());
double distanceSquared = SpatialUtils.dotProduct(cX0 - cX1, cY0 - cY1, cX0 - cX1, cY0 - cY1);
double radiusDistanceSquared = (radius0 + radius1) * (radius0 + radius1);
@@ -594,19 +596,19 @@
throws HyracksDataException {
double pX = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+ offset0 + 1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
double pY = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+ offset0 + 1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
- double x1 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
- double y1 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
+ double x1 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
+ double y1 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
- double x2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
- double y2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
+ double x2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
+ double y2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
if (pointInsideTriangle(x1, y1, x1, y2, x2, y2, pX, pY)
|| pointInsideTriangle(x1, y1, x2, y1, x2, y2, pX, pY)) {
@@ -640,15 +642,15 @@
private void triangulateRectangle(byte[] bytes, int offset, DoubleArray trianglesX,
DoubleArray trianglesY) throws HyracksDataException {
- double x1 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
- double y1 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
+ double x1 = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1
+ + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
+ double y1 = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1
+ + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
- double x2 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
- double y2 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
+ double x2 = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1
+ + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
+ double y2 = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1
+ + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
trianglesX.reset();
trianglesY.reset();
@@ -677,7 +679,7 @@
private boolean rectanglePolygonIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
throws HyracksDataException {
int numOfPoints1 = AInt16SerializerDeserializer.getShort(bytes1,
- offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
+ offset1 + 1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
if (numOfPoints1 < 3) {
throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
@@ -730,7 +732,7 @@
private boolean polygonCircleIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
throws HyracksDataException {
int numOfPoints = AInt16SerializerDeserializer.getShort(bytes0,
- offset0 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
+ offset0 + 1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
if (numOfPoints < 3) {
throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
@@ -789,38 +791,43 @@
switch (tag1) {
case POINT:
if (ascDoubleComp.compare(bytes0,
- offset0 + APointSerializerDeserializer
- .getCoordinateOffset(Coordinate.X),
- 8, bytes1, offset1 + APointSerializerDeserializer
+ offset0 + 1
+ + APointSerializerDeserializer
+ .getCoordinateOffset(Coordinate.X),
+ 8, bytes1, offset1 + 1 + APointSerializerDeserializer
.getCoordinateOffset(Coordinate.X),
8) == 0) {
- if (ascDoubleComp.compare(bytes0,
- offset0 + APointSerializerDeserializer
- .getCoordinateOffset(Coordinate.Y),
- 8, bytes1, offset1 + APointSerializerDeserializer
- .getCoordinateOffset(Coordinate.Y),
- 8) == 0) {
+ if (ascDoubleComp
+ .compare(bytes0,
+ offset0 + 1
+ + APointSerializerDeserializer
+ .getCoordinateOffset(Coordinate.Y),
+ 8, bytes1,
+ offset1 + 1
+ + APointSerializerDeserializer
+ .getCoordinateOffset(Coordinate.Y),
+ 8) == 0) {
res = true;
}
}
break;
case LINE:
- double pX = ADoubleSerializerDeserializer.getDouble(bytes0, offset0
+ double pX = ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1
+ APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
- double pY = ADoubleSerializerDeserializer.getDouble(bytes0, offset0
+ double pY = ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1
+ APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
double startX = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ALineSerializerDeserializer
+ offset1 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.X));
double startY = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ALineSerializerDeserializer
+ offset1 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.Y));
double endX = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ALineSerializerDeserializer
+ offset1 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.X));
double endY = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ALineSerializerDeserializer
+ offset1 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.Y));
res = pointOnLine(pX, pY, startX, startY, endX, endY);
@@ -845,51 +852,51 @@
case LINE:
switch (tag1) {
case POINT:
- double pX = ADoubleSerializerDeserializer.getDouble(bytes1, offset1
+ double pX = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
- double pY = ADoubleSerializerDeserializer.getDouble(bytes1, offset1
+ double pY = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
double startX = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer
+ offset0 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.X));
double startY = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer
+ offset0 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.Y));
double endX = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer
+ offset0 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.X));
double endY = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer
+ offset0 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.Y));
res = pointOnLine(pX, pY, startX, startY, endX, endY);
break;
case LINE:
double startX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer
+ offset0 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.X));
double startY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer
+ offset0 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.Y));
double endX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer
+ offset0 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.X));
double endY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + ALineSerializerDeserializer
+ offset0 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.Y));
double startX2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ALineSerializerDeserializer
+ offset1 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.X));
double startY2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ALineSerializerDeserializer
+ offset1 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.Y));
double endX2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ALineSerializerDeserializer
+ offset1 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.X));
double endY2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + ALineSerializerDeserializer
+ offset1 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.Y));
res = lineLineIntersection(startX1, startY1, endX1, endY1, startX2, startY2,
endX2, endY2);
@@ -921,9 +928,9 @@
break;
case POLYGON:
int numOfPoints0 = AInt16SerializerDeserializer.getShort(bytes0,
- offset0 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
+ offset0 + 1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
int numOfPoints1 = AInt16SerializerDeserializer.getShort(bytes1,
- offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
+ offset1 + 1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
if (numOfPoints0 < 3 || numOfPoints1 < 3) {
throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ACirclePartialBinaryComparatorFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ACirclePartialBinaryComparatorFactory.java
index dcc531d..af806b4 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ACirclePartialBinaryComparatorFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ACirclePartialBinaryComparatorFactory.java
@@ -47,25 +47,23 @@
// center.x
int c = Double.compare(
ADoubleSerializerDeserializer.getDouble(b1,
- s1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X) - 1),
+ s1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X)),
ADoubleSerializerDeserializer.getDouble(b2,
- s2 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X) - 1));
+ s2 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X)));
if (c == 0) {
// center.y
- c = Double
- .compare(
- ADoubleSerializerDeserializer.getDouble(
- b1, s1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y)
- - 1),
- ADoubleSerializerDeserializer.getDouble(b2, s2
- + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y) - 1));
+ c = Double.compare(
+ ADoubleSerializerDeserializer.getDouble(b1,
+ s1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y)),
+ ADoubleSerializerDeserializer.getDouble(b2,
+ s2 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y)));
if (c == 0) {
// radius
return Double.compare(
ADoubleSerializerDeserializer.getDouble(b1,
- s1 + ACircleSerializerDeserializer.getRadiusOffset() - 1),
+ s1 + ACircleSerializerDeserializer.getRadiusOffset()),
ADoubleSerializerDeserializer.getDouble(b2,
- s2 + ACircleSerializerDeserializer.getRadiusOffset() - 1));
+ s2 + ACircleSerializerDeserializer.getRadiusOffset()));
}
}
return c;
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ALinePartialBinaryComparatorFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ALinePartialBinaryComparatorFactory.java
index a5f80a6..2d07cf1 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ALinePartialBinaryComparatorFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ALinePartialBinaryComparatorFactory.java
@@ -46,32 +46,29 @@
public static int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) throws HyracksDataException {
int c = Double.compare(
ADoubleSerializerDeserializer.getDouble(b1,
- s1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X) - 1),
+ s1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X)),
ADoubleSerializerDeserializer.getDouble(b2,
- s2 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X) - 1));
+ s2 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X)));
if (c == 0) {
c = Double.compare(
ADoubleSerializerDeserializer.getDouble(b1,
- s1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y) - 1),
+ s1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y)),
ADoubleSerializerDeserializer.getDouble(b2,
- s2 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y) - 1));
+ s2 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y)));
if (c == 0) {
- c = Double
- .compare(
- ADoubleSerializerDeserializer.getDouble(
- b1, s1 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X)
- - 1),
- ADoubleSerializerDeserializer.getDouble(b2, s2
- + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X) - 1));
+ c = Double.compare(
+ ADoubleSerializerDeserializer.getDouble(b1,
+ s1 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X)),
+ ADoubleSerializerDeserializer.getDouble(b2,
+ s2 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X)));
if (c == 0) {
return Double
.compare(
ADoubleSerializerDeserializer.getDouble(
b1, s1 + ALineSerializerDeserializer
- .getEndPointCoordinateOffset(Coordinate.Y) - 1),
- ADoubleSerializerDeserializer.getDouble(b2,
- s2 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y)
- - 1));
+ .getEndPointCoordinateOffset(Coordinate.Y)),
+ ADoubleSerializerDeserializer.getDouble(b2, s2
+ + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y)));
}
}
}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APoint3DPartialBinaryComparatorFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APoint3DPartialBinaryComparatorFactory.java
index 7f04c40..16611ea 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APoint3DPartialBinaryComparatorFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APoint3DPartialBinaryComparatorFactory.java
@@ -46,21 +46,21 @@
public static int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) throws HyracksDataException {
int c = Double.compare(
ADoubleSerializerDeserializer.getDouble(b1,
- s1 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.X) - 1),
+ s1 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
ADoubleSerializerDeserializer.getDouble(b2,
- s2 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.X) - 1));
+ s2 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.X)));
if (c == 0) {
c = Double.compare(
ADoubleSerializerDeserializer.getDouble(b1,
- s1 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Y) - 1),
+ s1 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Y)),
ADoubleSerializerDeserializer.getDouble(b2,
- s2 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Y) - 1));
+ s2 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
if (c == 0) {
return Double.compare(
ADoubleSerializerDeserializer.getDouble(b1,
- s1 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Z) - 1),
+ s1 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Z)),
ADoubleSerializerDeserializer.getDouble(b2,
- s2 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Z) - 1));
+ s2 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Z)));
}
}
return c;
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APointPartialBinaryComparatorFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APointPartialBinaryComparatorFactory.java
index 0e209cf..45fd1ca 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APointPartialBinaryComparatorFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APointPartialBinaryComparatorFactory.java
@@ -46,15 +46,15 @@
public static int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) throws HyracksDataException {
int c = Double.compare(
ADoubleSerializerDeserializer.getDouble(b1,
- s1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X) - 1),
+ s1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
ADoubleSerializerDeserializer.getDouble(b2,
- s2 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X) - 1));
+ s2 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)));
if (c == 0) {
return Double.compare(
ADoubleSerializerDeserializer.getDouble(b1,
- s1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y) - 1),
+ s1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)),
ADoubleSerializerDeserializer.getDouble(b2,
- s2 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y) - 1));
+ s2 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
}
return c;
}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APolygonPartialBinaryComparatorFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APolygonPartialBinaryComparatorFactory.java
index 9bc15f5..5ef0e02 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APolygonPartialBinaryComparatorFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/APolygonPartialBinaryComparatorFactory.java
@@ -46,25 +46,23 @@
@SuppressWarnings("squid:S1172") // unused parameter
public static int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) throws HyracksDataException {
short pointCount1 = AInt16SerializerDeserializer.getShort(b1,
- s1 + APolygonSerializerDeserializer.getNumberOfPointsOffset() - 1);
+ s1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
int c = Short.compare(pointCount1, AInt16SerializerDeserializer.getShort(b2,
- s2 + APolygonSerializerDeserializer.getNumberOfPointsOffset() - 1));
+ s2 + APolygonSerializerDeserializer.getNumberOfPointsOffset()));
if (c == 0) {
int ci;
for (int i = 0; i < pointCount1; i++) {
ci = Double.compare(
DoublePointable.getDouble(b1,
- s1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X) - 1),
+ s1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X)),
DoublePointable.getDouble(b2,
- s1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X) - 1));
+ s1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X)));
if (ci == 0) {
- ci = Double
- .compare(
- DoublePointable.getDouble(
- b1, s1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y)
- - 1),
- DoublePointable.getDouble(b2, s1
- + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y) - 1));
+ ci = Double.compare(
+ DoublePointable.getDouble(b1,
+ s1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y)),
+ DoublePointable.getDouble(b2,
+ s1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y)));
if (ci == 0) {
continue;
}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
index cf2199b..506f8d2 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
@@ -53,15 +53,15 @@
public final static int getCenterPointCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
switch (coordinate) {
case X:
- return 1;
+ return 0;
case Y:
- return 9;
+ return 8;
default:
throw new HyracksDataException("Wrong coordinate");
}
}
public final static int getRadiusOffset() throws HyracksDataException {
- return 17;
+ return 16;
}
}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
index c87475d..c31042d 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
@@ -52,9 +52,9 @@
public final static int getStartPointCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
switch (coordinate) {
case X:
- return 1;
+ return 0;
case Y:
- return 9;
+ return 8;
default:
throw new HyracksDataException("Wrong coordinate");
}
@@ -63,9 +63,9 @@
public final static int getEndPointCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
switch (coordinate) {
case X:
- return 17;
+ return 16;
case Y:
- return 25;
+ return 24;
default:
throw new HyracksDataException("Wrong coordinate");
}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APoint3DSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APoint3DSerializerDeserializer.java
index b44aa5b..6a375fb 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APoint3DSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APoint3DSerializerDeserializer.java
@@ -54,11 +54,11 @@
public final static int getCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
switch (coordinate) {
case X:
- return 1;
+ return 0;
case Y:
- return 9;
+ return 8;
case Z:
- return 17;
+ return 16;
default:
throw new HyracksDataException("Wrong coordinate");
}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APointSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APointSerializerDeserializer.java
index 3abc585..9f64261 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APointSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APointSerializerDeserializer.java
@@ -62,9 +62,9 @@
public final static int getCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
switch (coordinate) {
case X:
- return 1;
+ return 0;
case Y:
- return 9;
+ return 8;
default:
throw new HyracksDataException("Wrong coordinate");
}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APolygonSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APolygonSerializerDeserializer.java
index 83810e3..cfbeb64 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APolygonSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APolygonSerializerDeserializer.java
@@ -60,15 +60,15 @@
}
public static int getNumberOfPointsOffset() throws HyracksDataException {
- return 1;
+ return 0;
}
public static int getCoordinateOffset(int pointId, Coordinate coordinate) throws HyracksDataException {
switch (coordinate) {
case X:
- return 3 + (pointId * 16);
+ return 2 + (pointId * 16);
case Y:
- return 11 + (pointId * 16);
+ return 10 + (pointId * 16);
default:
throw HyracksDataException.create(ErrorCode.POLYGON_INVALID_COORDINATE);
}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java
index 1a8cc5e..068e509 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java
@@ -49,9 +49,9 @@
public final static int getBottomLeftCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
switch (coordinate) {
case X:
- return 1;
+ return 0;
case Y:
- return 9;
+ return 8;
default:
throw new HyracksDataException("Wrong coordinate");
}
@@ -60,9 +60,9 @@
public final static int getUpperRightCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
switch (coordinate) {
case X:
- return 17;
+ return 16;
case Y:
- return 25;
+ return 24;
default:
throw new HyracksDataException("Wrong coordinate");
}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java
index c076568..23795dc 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java
@@ -94,9 +94,9 @@
double cX;
double cY;
if (bytes[startOffset] == ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG) {
- cX = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ cX = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
- cY = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ cY = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
aPoint.setValue(cX, cY);
pointSerde.serialize(aPoint, out);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleRadiusAccessor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleRadiusAccessor.java
index de9d47b..39484ae 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleRadiusAccessor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleRadiusAccessor.java
@@ -92,7 +92,7 @@
double radius;
if (bytes[startOffset] == ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG) {
radius = ADoubleSerializerDeserializer.getDouble(bytes,
- startOffset + ACircleSerializerDeserializer.getRadiusOffset());
+ startOffset + 1 + ACircleSerializerDeserializer.getRadiusOffset());
aDouble.setValue(radius);
doubleSerde.serialize(aDouble, out);
} else {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java
index 9d74dfa..a7f8500 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java
@@ -103,18 +103,18 @@
listBuilder.reset(pointListType);
inputVal.reset();
- double startX = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ double startX = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
- double startY = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ double startY = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
aPoint.setValue(startX, startY);
pointSerde.serialize(aPoint, inputVal.getDataOutput());
listBuilder.addItem(inputVal);
inputVal.reset();
- double endX = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ double endX = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
- double endY = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ double endY = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
aPoint.setValue(endX, endY);
pointSerde.serialize(aPoint, inputVal.getDataOutput());
@@ -123,18 +123,18 @@
} else if (bytes[startOffset] == ATypeTag.SERIALIZED_RECTANGLE_TYPE_TAG) {
listBuilder.reset(pointListType);
inputVal.reset();
- double x1 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ double x1 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
- double y1 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ double y1 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
aPoint.setValue(x1, y1);
pointSerde.serialize(aPoint, inputVal.getDataOutput());
listBuilder.addItem(inputVal);
inputVal.reset();
- double x2 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ double x2 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
- double y2 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ double y2 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
aPoint.setValue(x2, y2);
pointSerde.serialize(aPoint, inputVal.getDataOutput());
@@ -142,7 +142,7 @@
listBuilder.write(out, true);
} else if (bytes[startOffset] == ATypeTag.SERIALIZED_POLYGON_TYPE_TAG) {
int numOfPoints = AInt16SerializerDeserializer.getShort(bytes,
- startOffset + APolygonSerializerDeserializer.getNumberOfPointsOffset());
+ startOffset + APolygonSerializerDeserializer.getNumberOfPointsOffset() + 1);
if (numOfPoints < 3) {
throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
@@ -151,9 +151,9 @@
listBuilder.reset(pointListType);
for (int i = 0; i < numOfPoints; ++i) {
inputVal.reset();
- double x = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ double x = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
- double y = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+ double y = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
aPoint.setValue(x, y);
pointSerde.serialize(aPoint, inputVal.getDataOutput());
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointXCoordinateAccessor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointXCoordinateAccessor.java
index 85a9dc0..6bcb936 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointXCoordinateAccessor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointXCoordinateAccessor.java
@@ -91,8 +91,8 @@
try {
double x;
if (bytes[startOffset] == ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
- x = ADoubleSerializerDeserializer.getDouble(bytes,
- startOffset + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+ x = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
aDouble.setValue(x);
doubleSerde.serialize(aDouble, out);
} else {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointYCoordinateAccessor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointYCoordinateAccessor.java
index 1b19585..3c32e51 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointYCoordinateAccessor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointYCoordinateAccessor.java
@@ -95,8 +95,8 @@
try {
double y;
if (bytes[startOffset] == ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
- y = ADoubleSerializerDeserializer.getDouble(bytes,
- startOffset + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+ y = ADoubleSerializerDeserializer.getDouble(bytes, startOffset + 1
+ + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
aDouble.setValue(y);
doubleSerde.serialize(aDouble, out);
} else {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
index ace0a2e..4f67fba 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
@@ -130,14 +130,14 @@
// for
// max x, and 3 for max y
case 2: {
- double x = ADoubleSerializerDeserializer.getDouble(data0, startOffset0
+ double x = ADoubleSerializerDeserializer.getDouble(data0, startOffset0 + 1
+ APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
value = x;
}
break;
case 1:
case 3: {
- double y = ADoubleSerializerDeserializer.getDouble(data0, startOffset0
+ double y = ADoubleSerializerDeserializer.getDouble(data0, startOffset0 + 1
+ APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
value = y;
@@ -155,10 +155,10 @@
case 0: {
value = Double.MAX_VALUE;
double startX = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ALineSerializerDeserializer
+ startOffset0 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.X));
double endX = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ALineSerializerDeserializer
+ startOffset0 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.X));
value = Math.min(Math.min(startX, endX), value);
@@ -167,10 +167,10 @@
case 1: {
value = Double.MAX_VALUE;
double startY = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ALineSerializerDeserializer
+ startOffset0 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.Y));
double endY = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ALineSerializerDeserializer
+ startOffset0 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.Y));
value = Math.min(Math.min(startY, endY), value);
@@ -179,10 +179,10 @@
case 2: {
value = Double.MIN_VALUE;
double startX = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ALineSerializerDeserializer
+ startOffset0 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.X));
double endX = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ALineSerializerDeserializer
+ startOffset0 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.X));
value = Math.max(Math.min(startX, endX), value);
@@ -191,10 +191,10 @@
case 3: {
value = Double.MIN_VALUE;
double startY = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ALineSerializerDeserializer
+ startOffset0 + 1 + ALineSerializerDeserializer
.getStartPointCoordinateOffset(Coordinate.Y));
double endY = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ALineSerializerDeserializer
+ startOffset0 + 1 + ALineSerializerDeserializer
.getEndPointCoordinateOffset(Coordinate.Y));
value = Math.max(Math.min(startY, endY), value);
@@ -208,14 +208,14 @@
break;
case POLYGON:
int numOfPoints = AInt16SerializerDeserializer.getShort(data0,
- startOffset0 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
+ startOffset0 + 1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
switch (coordinate) {
case 0: {
value = Double.MAX_VALUE;
for (int i = 0; i < numOfPoints; i++) {
double x = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + APolygonSerializerDeserializer.getCoordinateOffset(i,
- Coordinate.X));
+ startOffset0 + 1 + APolygonSerializerDeserializer
+ .getCoordinateOffset(i, Coordinate.X));
value = Math.min(x, value);
}
}
@@ -224,8 +224,8 @@
value = Double.MAX_VALUE;
for (int i = 0; i < numOfPoints; i++) {
double y = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + APolygonSerializerDeserializer.getCoordinateOffset(i,
- Coordinate.Y));
+ startOffset0 + 1 + APolygonSerializerDeserializer
+ .getCoordinateOffset(i, Coordinate.Y));
value = Math.min(y, value);
}
}
@@ -234,8 +234,8 @@
value = Double.MIN_VALUE;
for (int i = 0; i < numOfPoints; i++) {
double x = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + APolygonSerializerDeserializer.getCoordinateOffset(i,
- Coordinate.X));
+ startOffset0 + 1 + APolygonSerializerDeserializer
+ .getCoordinateOffset(i, Coordinate.X));
value = Math.max(x, value);
}
}
@@ -244,8 +244,8 @@
value = Double.MIN_VALUE;
for (int i = 0; i < numOfPoints; i++) {
double y = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + APolygonSerializerDeserializer.getCoordinateOffset(i,
- Coordinate.Y));
+ startOffset0 + 1 + APolygonSerializerDeserializer
+ .getCoordinateOffset(i, Coordinate.Y));
value = Math.max(y, value);
}
}
@@ -282,39 +282,39 @@
switch (coordinate) {
case 0: {
double x = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ACircleSerializerDeserializer
+ startOffset0 + 1 + ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.X));
double radius = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ACircleSerializerDeserializer.getRadiusOffset());
+ startOffset0 + 1 + ACircleSerializerDeserializer.getRadiusOffset());
value = x - radius;
}
break;
case 1: {
double y = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ACircleSerializerDeserializer
+ startOffset0 + 1 + ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.Y));
double radius = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ACircleSerializerDeserializer.getRadiusOffset());
+ startOffset0 + 1 + ACircleSerializerDeserializer.getRadiusOffset());
value = y - radius;
}
break;
case 2: {
double x = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ACircleSerializerDeserializer
+ startOffset0 + 1 + ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.X));
double radius = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ACircleSerializerDeserializer.getRadiusOffset());
+ startOffset0 + 1 + ACircleSerializerDeserializer.getRadiusOffset());
value = x + radius;
}
break;
case 3: {
double y = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ACircleSerializerDeserializer
+ startOffset0 + 1 + ACircleSerializerDeserializer
.getCenterPointCoordinateOffset(Coordinate.Y));
double radius = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ACircleSerializerDeserializer.getRadiusOffset());
+ startOffset0 + 1 + ACircleSerializerDeserializer.getRadiusOffset());
value = y + radius;
}
@@ -329,25 +329,25 @@
switch (coordinate) {
case 0: {
value = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ARectangleSerializerDeserializer
+ startOffset0 + 1 + ARectangleSerializerDeserializer
.getBottomLeftCoordinateOffset(Coordinate.X));
}
break;
case 1: {
value = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ARectangleSerializerDeserializer
+ startOffset0 + 1 + ARectangleSerializerDeserializer
.getBottomLeftCoordinateOffset(Coordinate.Y));
}
break;
case 2: {
value = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ARectangleSerializerDeserializer
+ startOffset0 + 1 + ARectangleSerializerDeserializer
.getUpperRightCoordinateOffset(Coordinate.X));
}
break;
case 3: {
value = ADoubleSerializerDeserializer.getDouble(data0,
- startOffset0 + ARectangleSerializerDeserializer
+ startOffset0 + 1 + ARectangleSerializerDeserializer
.getUpperRightCoordinateOffset(Coordinate.Y));
}
break;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SpatialUtils.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SpatialUtils.java
index 1aa4341..7eb7358 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SpatialUtils.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SpatialUtils.java
@@ -97,21 +97,21 @@
for (int i = 0; i < numOfPoints; i++) {
double x1 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
+ offset + 1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
double y1 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
+ offset + 1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
double x2;
double y2;
if (i + 1 == numOfPoints) {
x2 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
+ offset + 1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
y2 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
+ offset + 1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
} else {
x2 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.X));
+ offset + 1 + APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.X));
y2 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.Y));
+ offset + 1 + APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.Y));
}
area += (x1 * y2) - (x2 * y1);
}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
index 0e51791..c45f90c 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
@@ -108,9 +108,10 @@
try {
aPoint.setValue(
ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
- ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
+ offset0 + 1
+ + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
+ ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1
+ + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
aCircle.setValue(aPoint, ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1));
circleSerde.serialize(aCircle, out);
} catch (IOException e1) {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
index 8e22a99..efcce7a 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
@@ -109,16 +109,18 @@
aPoint[0]
.setValue(
ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer
- .getCoordinateOffset(Coordinate.X)),
- ADoubleSerializerDeserializer.getDouble(bytes0, offset0
+ offset0 + 1
+ + APointSerializerDeserializer
+ .getCoordinateOffset(Coordinate.X)),
+ ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1
+ APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
aPoint[1]
.setValue(
ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APointSerializerDeserializer
- .getCoordinateOffset(Coordinate.X)),
- ADoubleSerializerDeserializer.getDouble(bytes1, offset1
+ offset1 + 1
+ + APointSerializerDeserializer
+ .getCoordinateOffset(Coordinate.X)),
+ ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
aLine.setValue(aPoint[0], aPoint[1]);
lineSerde.serialize(aLine, out);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
index 5d5a8fd..054d477 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
@@ -108,16 +108,18 @@
aPoint[0]
.setValue(
ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer
- .getCoordinateOffset(Coordinate.X)),
- ADoubleSerializerDeserializer.getDouble(bytes0, offset0
+ offset0 + 1
+ + APointSerializerDeserializer
+ .getCoordinateOffset(Coordinate.X)),
+ ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1
+ APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
aPoint[1]
.setValue(
ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APointSerializerDeserializer
- .getCoordinateOffset(Coordinate.X)),
- ADoubleSerializerDeserializer.getDouble(bytes1, offset1
+ offset1 + 1
+ + APointSerializerDeserializer
+ .getCoordinateOffset(Coordinate.X)),
+ ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
if (aPoint[0].getX() > aPoint[1].getX() && aPoint[0].getY() > aPoint[1].getY()) {
aRectangle.setValue(aPoint[1], aPoint[0]);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
index ddf9e44..10ecb1f 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
@@ -100,24 +100,24 @@
break;
case CIRCLE:
double radius = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + ACircleSerializerDeserializer.getRadiusOffset());
+ offset + 1 + ACircleSerializerDeserializer.getRadiusOffset());
area = SpatialUtils.pi() * radius * radius;
out.writeByte(ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
out.writeDouble(area);
break;
case RECTANGLE:
double x1 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + ARectangleSerializerDeserializer
+ offset + 1 + ARectangleSerializerDeserializer
.getBottomLeftCoordinateOffset(Coordinate.X));
double y1 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + ARectangleSerializerDeserializer
+ offset + 1 + ARectangleSerializerDeserializer
.getBottomLeftCoordinateOffset(Coordinate.Y));
double x2 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + ARectangleSerializerDeserializer
+ offset + 1 + ARectangleSerializerDeserializer
.getUpperRightCoordinateOffset(Coordinate.X));
double y2 = ADoubleSerializerDeserializer.getDouble(bytes,
- offset + ARectangleSerializerDeserializer
+ offset + 1 + ARectangleSerializerDeserializer
.getUpperRightCoordinateOffset(Coordinate.Y));
area = (x2 - x1) * (y2 - y1);
out.writeByte(ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
index bbad414..d0c40c9 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
@@ -115,14 +115,14 @@
&& tag2 == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG
&& tag3 == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
double xLoc = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+ offset0 + 1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
double yLoc = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+ offset0 + 1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
double xOrigin = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+ offset1 + 1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
double yOrigin = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+ offset1 + 1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
double xInc = ADoubleSerializerDeserializer.getDouble(bytes2, offset2 + 1);
double yInc = ADoubleSerializerDeserializer.getDouble(bytes3, offset3 + 1);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
index 4301bc5..3c428e8 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
@@ -89,14 +89,14 @@
double distance;
if (tag0 == ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
if (tag1 == ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
- double x1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
- double y1 = ADoubleSerializerDeserializer.getDouble(bytes0,
- offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
- double x2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
- double y2 = ADoubleSerializerDeserializer.getDouble(bytes1,
- offset1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+ double x1 = ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1
+ + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+ double y1 = ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1
+ + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+ double x2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+ double y2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1
+ + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
} else {
throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, bytes1[offset1],