6 package com.vesoft.nebula.client.storage.scan;
8 import com.vesoft.nebula.DataSet;
9 import com.vesoft.nebula.client.storage.data.EdgeRow;
10 import com.vesoft.nebula.client.storage.data.EdgeTableRow;
11 import com.vesoft.nebula.client.storage.data.ScanStatus;
12 import com.vesoft.nebula.client.storage.processor.EdgeProcessor;
13 import java.io.Serializable;
14 import java.util.ArrayList;
15 import java.util.List;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 private static final Logger LOGGER = LoggerFactory.getLogger(
ScanEdgeResult.class);
21 private static final long serialVersionUID = 519190254786197550L;
23 private final List<DataSet> dataSets;
32 private List<EdgeTableRow> edgeTableRows =
new ArrayList<>();
37 private List<String> propNames =
new ArrayList<>();
42 private List<EdgeRow> edgeRows =
new ArrayList<>();
45 private String decodeType =
"utf-8";
47 private boolean isEmpty;
51 this.dataSets = dataSets;
52 this.scanStatus = status;
53 this.isEmpty = isDatasetEmpty();
62 if (!isEmpty && edgeTableRows.isEmpty()) {
63 constructEdgeTableRow();
74 if (!isEmpty && propNames.isEmpty()) {
87 if (!isEmpty && edgeRows.isEmpty()) {
111 private boolean isDatasetEmpty() {
112 if (dataSets ==
null || dataSets.isEmpty()) {
115 for (DataSet dataSet : dataSets) {
116 if (dataSet.getRows().size() > 0) {
126 private void constructEdgeTableRow() {
130 synchronized (
this) {
131 if (edgeTableRows.isEmpty()) {
132 edgeTableRows = EdgeProcessor.constructEdgeTableRow(dataSets, decodeType);
140 private void constructEdgeRow() {
144 synchronized (
this) {
145 if (edgeRows.isEmpty()) {
146 edgeRows = EdgeProcessor.constructEdgeRow(dataSets, decodeType);
154 private void constructPropNames() {
158 synchronized (
this) {
159 if (propNames.isEmpty()) {
160 List<byte[]> colNames = dataSets.get(0).getColumn_names();
161 for (
byte[] colName : colNames) {
162 String propName =
new String(colName);
163 if (!propName.contains(
".")) {
166 propNames.add(propName.split(
"\\.")[1]);
List< String > getPropNames()
get the result's property names
List< EdgeTableRow > getEdgeTableRows()
get edge table rows
List< EdgeRow > getEdges()
get edge rows
boolean isAllSuccess()
get the result status
boolean isEmpty()
whether result data is empty
ALL_SUCCESS
all parts succeed