mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 05:30:35 +08:00
fix an npe
This commit is contained in:
parent
d722f302eb
commit
676af18f6f
@ -5,5 +5,5 @@ This is a repo forked from [DataX](https://github.com/alibaba/DataX), and mainta
|
||||
## How to use
|
||||
|
||||
1. Run `./build.sh` to gennerate the `starrockswriter.tar.gz`, then untar it into your own [DataX release](https://github.com/alibaba/DataX) directory(which will be `datax/plugin/writer/`).
|
||||
2. Create a `job.json` to define the reader and writer. More details about the configurations, please refer to the [Documentations](https://docs.starrocks.com).
|
||||
2. Create a `job.json` to define the reader and writer. More details about the configurations, please refer to the [Documentations](https://docs.starrocks.com/en-us/main/loading/DataX-starrocks-writer).
|
||||
3. Run `python datax/bin/datax.py --jvm="-Xms6G -Xmx6G" --loglevel=debug job.json` to start a job.
|
||||
|
@ -25,6 +25,7 @@ import org.apache.http.util.EntityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -107,7 +108,7 @@ public class StarRocksStreamLoadVisitor {
|
||||
|
||||
private byte[] joinRows(List<byte[]> rows, int totalBytes) {
|
||||
if (StarRocksWriterOptions.StreamLoadFormat.CSV.equals(writerOptions.getStreamLoadFormat())) {
|
||||
Map<String, Object> props = writerOptions.getLoadProps();
|
||||
Map<String, Object> props = (writerOptions.getLoadProps() == null ? new HashMap<>() : writerOptions.getLoadProps());
|
||||
byte[] lineDelimiter = StarRocksDelimiterParser.parse((String)props.get("row_delimiter"), "\n").getBytes(StandardCharsets.UTF_8);
|
||||
ByteBuffer bos = ByteBuffer.allocate(totalBytes + rows.size() * lineDelimiter.length);
|
||||
for (byte[] row : rows) {
|
||||
@ -216,7 +217,7 @@ public class StarRocksStreamLoadVisitor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String getBasicAuthHeader(String username, String password) {
|
||||
String auth = username + ":" + password;
|
||||
byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8));
|
||||
|
Loading…
Reference in New Issue
Block a user