-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support nebula-spark reader v1.0 (#155)
* Support nebula-spark reader v1.0
- Loading branch information
Showing
20 changed files
with
471 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,4 @@ target/ | |
spark-importer.ipr | ||
spark-importer.iws | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
tools/nebula-spark/src/main/java/com/vesoft/nebula/bean/ConnectInfo.java
This file was deleted.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
tools/nebula-spark/src/main/java/com/vesoft/nebula/bean/DataSourceConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* Copyright (c) 2020 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
package com.vesoft.nebula.bean; | ||
|
||
import com.google.common.net.HostAndPort; | ||
import org.apache.commons.lang.StringUtils; | ||
|
||
import java.io.Serializable; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.HashMap; | ||
import java.util.ArrayList; | ||
|
||
public class DataSourceConfig implements Serializable { | ||
|
||
private final String nameSpace; | ||
|
||
private final String type; | ||
|
||
private final String label; | ||
|
||
private final String returnColString; | ||
|
||
private boolean allCols = false; | ||
|
||
private final int partitionNumber; | ||
|
||
private final String hostAndPorts; | ||
|
||
/** | ||
* @param nameSpace nameSpace | ||
* @param type scan element type | ||
* @param label vertex or edge label | ||
* @param partitionNumber partition number | ||
* @param returnColString scan col string example: name,age | ||
* @param hostAndPorts host and port | ||
*/ | ||
public DataSourceConfig(String nameSpace, String type, String label, String returnColString, int partitionNumber, String hostAndPorts) { | ||
this.nameSpace = nameSpace; | ||
this.type = type; | ||
this.label = label; | ||
this.returnColString = returnColString; | ||
this.partitionNumber = partitionNumber; | ||
this.hostAndPorts = hostAndPorts; | ||
} | ||
|
||
public String getNameSpace() { | ||
return nameSpace; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public String getLabel() { | ||
return label; | ||
} | ||
|
||
public int getPartitionNumber() { | ||
return partitionNumber; | ||
} | ||
|
||
public boolean getAllCols() { | ||
return allCols; | ||
} | ||
|
||
public Map<String, List<String>> getReturnColMap() { | ||
Map<String, List<String>> result = new HashMap<>(1); | ||
if (StringUtils.isBlank(returnColString)) { | ||
allCols = true; | ||
result.put(label, new ArrayList<>()); | ||
} else { | ||
List<String> properties = Arrays.asList(returnColString.split(",")); | ||
result.put(label, properties); | ||
} | ||
return result; | ||
} | ||
|
||
public List<HostAndPort> getHostAndPorts() { | ||
List<HostAndPort> hostAndPortList = new ArrayList<>(); | ||
String[] hostAndPortArray = hostAndPorts.split(","); | ||
for (String hostAndPort : hostAndPortArray) { | ||
hostAndPortList.add(HostAndPort.fromString(hostAndPort)); | ||
} | ||
return hostAndPortList; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tools/nebula-spark/src/main/java/com/vesoft/nebula/bean/Parameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* Copyright (c) 2020 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
package com.vesoft.nebula.bean; | ||
|
||
public class Parameters { | ||
|
||
public static final String SPACE_NAME = "spaceName"; | ||
public static final String LABEL = "label"; | ||
public static final String TYPE = "type"; | ||
public static final String HOST_AND_PORTS = "hostAndPorts"; | ||
public static final String RETURN_COLS = "returnCols"; | ||
public static final String PARTITION_NUMBER = "partitionNumber"; | ||
} |
74 changes: 0 additions & 74 deletions
74
tools/nebula-spark/src/main/java/com/vesoft/nebula/bean/ScanInfo.java
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
tools/nebula-spark/src/main/java/com/vesoft/nebula/common/Checkable.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.