Skip to content

Commit

Permalink
Merge branch 'dev' of dolphindb.net:dolphindb/datax-writer
Browse files Browse the repository at this point in the history
  • Loading branch information
chengyitian committed May 14, 2024
2 parents e12bce5 + e5f5797 commit 5e0f2f7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
Binary file modified dist/dolphindbwriter/dolphindbwriter.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,28 @@ private void initTable(JSONArray fieldArr) {
}
} else {
for (int i = 0; i < fieldArr.size(); i++) {
JSONObject field = fieldArr.getJSONObject(i);
String colName = field.getString("name");
Entity.DATA_TYPE type = Entity.DATA_TYPE.valueOf(field.getString("type"));
List colData = getListFromColumn(type);
this.colNames_.add(colName);
this.colDatas_.add(colData);
this.colTypes_.add(type);
try {
JSONObject field = fieldArr.getJSONObject(i);
String colName = field.getString("name");
Entity.DATA_TYPE type = Entity.DATA_TYPE.valueOf(field.getString("type"));

BasicDictionary schema;
if (this.dbName == null || dbName.isEmpty()){
schema = (BasicDictionary) dbConnection.run(tbName + ".schema()");
}else {
schema = (BasicDictionary) dbConnection.run("loadTable(\"" + dbName + "\"" + ",`" + tbName + ").schema()");
}
BasicTable colDefs = (BasicTable)schema.get(new BasicString("colDefs"));
BasicIntVector extraInt = (BasicIntVector) colDefs.getColumn("extra");

List colData = getListFromColumn(type);
this.colNames_.add(colName);
this.colDatas_.add(colData);
this.colTypes_.add(type);
this.extras_.add(extraInt.getInt(i));
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
}
}
}
Expand Down

0 comments on commit 5e0f2f7

Please sign in to comment.