Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into 3.0.x
  • Loading branch information
lvca committed Sep 11, 2018
2 parents 5e66529 + 4f30bf3 commit dff8cbe
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ public String toJSON() {
if (element != null) {
return element.toJSON();
} else {
return "{'out':'" + vOut.getIdentity() + "', 'in':'" + vIn.getIdentity() + "', '@class':'" + OStringSerializerHelper
.encode(lightweightEdgeType.getName()) + "'}";
return "{\"out\":\"" + vOut.getIdentity() + "\", \"in\":\"" + vIn.getIdentity() + "\", \"@class\":\"" + OStringSerializerHelper
.encode(lightweightEdgeType.getName()) + "\"}";
}
}

Expand All @@ -513,8 +513,8 @@ public String toJSON(String iFormat) {
if (element != null) {
return element.toJSON(iFormat);
} else {
return "{'out':'" + vOut.getIdentity() + "', 'in':'" + vIn.getIdentity() + "', '@class':'" + OStringSerializerHelper
.encode(lightweightEdgeType.getName()) + "'}";
return "{\"out\":\"" + vOut.getIdentity() + "\", \"in\":\"" + vIn.getIdentity() + "\", \"@class\":\"" + OStringSerializerHelper
.encode(lightweightEdgeType.getName()) + "\"}";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,9 @@
import com.orientechnologies.orient.core.metadata.schema.OProperty;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.sql.OCommandExecutorSQLAbstract;
import com.orientechnologies.orient.core.sql.parser.AggregateProjectionSplit;
import com.orientechnologies.orient.core.sql.parser.OAndBlock;
import com.orientechnologies.orient.core.sql.parser.OBaseExpression;
import com.orientechnologies.orient.core.sql.parser.OBinaryCompareOperator;
import com.orientechnologies.orient.core.sql.parser.OBinaryCondition;
import com.orientechnologies.orient.core.sql.parser.OBooleanExpression;
import com.orientechnologies.orient.core.sql.parser.OCluster;
import com.orientechnologies.orient.core.sql.parser.OContainsAnyCondition;
import com.orientechnologies.orient.core.sql.parser.OContainsKeyOperator;
import com.orientechnologies.orient.core.sql.parser.OContainsValueCondition;
import com.orientechnologies.orient.core.sql.parser.OContainsValueOperator;
import com.orientechnologies.orient.core.sql.parser.OEqualsCompareOperator;
import com.orientechnologies.orient.core.sql.parser.OExecutionPlanCache;
import com.orientechnologies.orient.core.sql.parser.OExpression;
import com.orientechnologies.orient.core.sql.parser.OFromClause;
import com.orientechnologies.orient.core.sql.parser.OFromItem;
import com.orientechnologies.orient.core.sql.parser.OFunctionCall;
import com.orientechnologies.orient.core.sql.parser.OGeOperator;
import com.orientechnologies.orient.core.sql.parser.OGroupBy;
import com.orientechnologies.orient.core.sql.parser.OGtOperator;
import com.orientechnologies.orient.core.sql.parser.OIdentifier;
import com.orientechnologies.orient.core.sql.parser.OInCondition;
import com.orientechnologies.orient.core.sql.parser.OIndexIdentifier;
import com.orientechnologies.orient.core.sql.parser.OInputParameter;
import com.orientechnologies.orient.core.sql.parser.OInteger;
import com.orientechnologies.orient.core.sql.parser.OLeOperator;
import com.orientechnologies.orient.core.sql.parser.OLetClause;
import com.orientechnologies.orient.core.sql.parser.OLetItem;
import com.orientechnologies.orient.core.sql.parser.OLtOperator;
import com.orientechnologies.orient.core.sql.parser.OMetadataIdentifier;
import com.orientechnologies.orient.core.sql.parser.OOrBlock;
import com.orientechnologies.orient.core.sql.parser.OOrderBy;
import com.orientechnologies.orient.core.sql.parser.OOrderByItem;
import com.orientechnologies.orient.core.sql.parser.OProjection;
import com.orientechnologies.orient.core.sql.parser.OProjectionItem;
import com.orientechnologies.orient.core.sql.parser.ORecordAttribute;
import com.orientechnologies.orient.core.sql.parser.ORid;
import com.orientechnologies.orient.core.sql.parser.OSelectStatement;
import com.orientechnologies.orient.core.sql.parser.OStatement;
import com.orientechnologies.orient.core.sql.parser.OWhereClause;
import com.orientechnologies.orient.core.sql.parser.SubQueryCollector;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import com.orientechnologies.orient.core.sql.parser.*;

import java.util.*;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -811,6 +759,7 @@ private static List<OProjectionItem> calculateAdditionalOrderByProjections(Set<S
OIdentifier newAlias = new OIdentifier("_$$$ORDER_BY_ALIAS$$$_" + (nextAliasCount++));
newProj.setAlias(newAlias);
item.setAlias(newAlias.getStringValue());
item.setModifier(null);
result.add(newProj);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public int compare(OResult a, OResult b, OCommandContext ctx) {
for (OOrderByItem item : items) {
int result = item.compare(a, b, ctx);
if (result != 0) {
return result;
return result > 0 ? 1 : -1;
}
}
return 0;
Expand All @@ -69,7 +69,8 @@ public OOrderBy copy() {
return result;
}

@Override public boolean equals(Object o) {
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
Expand All @@ -83,22 +84,23 @@ public OOrderBy copy() {
return true;
}

@Override public int hashCode() {
@Override
public int hashCode() {
return items != null ? items.hashCode() : 0;
}

public void extractSubQueries(SubQueryCollector collector) {
if(items!=null){
for(OOrderByItem item:items){
if (items != null) {
for (OOrderByItem item : items) {
item.extractSubQueries(collector);
}
}
}

public boolean refersToParent() {
if(items!=null){
for(OOrderByItem item:items){
if(item.refersToParent()){
if (items != null) {
for (OOrderByItem item : items) {
if (item.refersToParent()) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,9 @@ public int compare(OResult a, OResult b, OCommandContext ctx) {
} else {
result = -1;
}
}
if (bVal == null) {
} else if (bVal == null) {
result = 1;
}
if (aVal instanceof Comparable && bVal instanceof Comparable) {
} else if (aVal instanceof Comparable && bVal instanceof Comparable) {
try {
result = ((Comparable) aVal).compareTo(bVal);
} catch (Exception e) {
Expand Down Expand Up @@ -141,6 +139,10 @@ public OModifier getModifier() {
return modifier;
}

public void setModifier(OModifier modifier) {
this.modifier = modifier;
}

public OResult serialize() {
OResultInternal result = new OResultInternal();
result.setProperty("alias", alias);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ public void writeRecords(final Object iRecords, final String iFetchPlan, String
json.beginCollection("edges");
Set<ORID> edgeRids = new HashSet<ORID>();
for (OVertex vertex : vertices) {
for (OEdge e : vertex.getEdges(ODirection.BOTH)) {
for (OEdge e : vertex.getEdges(ODirection.OUT)) {
OEdge edge = (OEdge) e;
if (edgeRids.contains(e.getIdentity())) {
if (edgeRids.contains(e.getIdentity()) && e.getIdentity() != null /* only for non-lighweight */) {
continue;
}
if (!vertices.contains(edge.getVertex(ODirection.OUT)) || !vertices.contains(edge.getVertex(ODirection.IN)))
Expand Down

0 comments on commit dff8cbe

Please sign in to comment.