Skip to content

Commit d1f593c

Browse files
authored
Merge pull request running-elephant#174 from scottsut/master
chore: alpha.2 release
2 parents c2cb7f6 + ee748fd commit d1f593c

File tree

212 files changed

+2422
-2765
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+2422
-2765
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.idea
2+
3+
/static
4+
5+
*.iml
6+
*.zip

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ RUN mkdir /datart
44
COPY ./bin/* /datart/bin/
55
COPY ./config/* /datart/config/
66
COPY ./lib/* /datart/lib/
7+
COPY static /datart/static
8+
ENV TZ=Asia/Shanghai
79
EXPOSE 58080
810
WORKDIR /datart
911
ENTRYPOINT java -cp "lib/*" datart.DatartServerApplication
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE `source`
2+
DROP INDEX `prj_name`;

config/jdbc-driver-ext.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
IMPALA:
1010
db-type: "impala"
1111
name: "impala"
12-
driver-class: "com.mysql.cj.jdbc.Driver"
12+
driver-class: "com.cloudera.impala.jdbc41.Driver"
1313
literal-quote: "'"
1414
identifier-quote: "`"
1515
adapter-class: "datart.data.provider.jdbc.adapters.ImpalaDataProviderAdapter"

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>datart-parent</artifactId>
77
<groupId>datart</groupId>
8-
<version>1.0.0-alpha.1</version>
8+
<version>1.0.0-alpha.2</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

core/src/main/java/datart/core/base/PageInfo.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public class PageInfo implements Serializable {
3232

3333
private long total;
3434

35+
private boolean countTotal;
36+
3537
@Override
3638
public String toString() {
3739
return "PageInfo{" +

core/src/main/java/datart/core/base/consts/ValueType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ public enum ValueType {
1616

1717
SNIPPET, //will be parse to sql node
1818

19+
KEYWORD,
1920
}

core/src/main/java/datart/core/common/CSVParser.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import datart.core.base.consts.ValueType;
2222
import datart.core.base.exception.BaseException;
2323
import lombok.Data;
24+
import org.apache.commons.lang.math.NumberUtils;
2425
import org.apache.commons.lang3.StringUtils;
2526
import org.springframework.util.CollectionUtils;
2627

@@ -95,11 +96,9 @@ private ValueType[] inferDataType(String line) {
9596
String[] split = line.split(CSV_SPLIT);
9697
ValueType[] valueTypes = new ValueType[split.length];
9798
for (int i = 0; i < split.length; i++) {
98-
try {
99-
Double.parseDouble(split[i]);
99+
if (NumberUtils.isNumber(split[i])) {
100100
valueTypes[i] = ValueType.NUMERIC;
101101
continue;
102-
} catch (Exception ignore) {
103102
}
104103
try {
105104
simpleDateFormat.parse(split[i]);
@@ -115,7 +114,7 @@ private ValueType[] inferDataType(String line) {
115114
private List<Object> extractValues(String line) {
116115
try {
117116
if (StringUtils.isEmpty(line)) {
118-
return Collections.EMPTY_LIST;
117+
return Collections.emptyList();
119118
}
120119
LinkedList<Object> values = new LinkedList<>();
121120
String[] split = line.split(CSV_SPLIT);
@@ -142,7 +141,11 @@ private Object parseValue(String val, ValueType valueType) throws ParseException
142141
case DATE:
143142
return simpleDateFormat.parse(val);
144143
case NUMERIC:
145-
return Double.parseDouble(val);
144+
if (NumberUtils.isDigits(val)) {
145+
return Long.parseLong(val);
146+
} else {
147+
return Double.parseDouble(val);
148+
}
146149
default:
147150
return val;
148151
}

core/src/main/java/datart/core/common/FileUtils.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121
import org.apache.commons.lang3.StringUtils;
2222

2323
import java.io.File;
24-
import java.io.FileFilter;
2524
import java.util.Collections;
2625
import java.util.LinkedHashSet;
27-
import java.util.LinkedList;
2826
import java.util.Set;
2927

3028
public class FileUtils {
@@ -92,6 +90,4 @@ public static Set<String> walkDir(File file, String extension, boolean recursion
9290
return names;
9391
}
9492
}
95-
96-
9793
}

core/src/main/java/datart/core/common/POIUtils.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,26 @@ public static List<List<Object>> loadExcel(String path) throws IOException {
108108
// 只处理第一个sheet
109109
Sheet sheet = workbook.getSheetAt(0);
110110
Iterator<Row> rowIterator = sheet.rowIterator();
111+
Row row0 = sheet.getRow(0);
112+
if (row0 == null) {
113+
throw new RuntimeException("excel is empty");
114+
}
115+
int columns = row0.getPhysicalNumberOfCells();
111116
while (rowIterator.hasNext()) {
112117
Row row = rowIterator.next();
113-
Iterator<Cell> iterator = row.iterator();
114118
LinkedList<Object> cellValues = new LinkedList<>();
119+
for (int i = 0; i < columns; i++)
120+
cellValues.add(readCellValue(row.getCell(i)));
115121
rows.add(cellValues);
116-
while (iterator.hasNext()) {
117-
cellValues.add(readCellValue(iterator.next()));
118-
}
119122
}
120123
}
121124
return rows;
122125
}
123126

124127
private static Object readCellValue(Cell cell) {
128+
if (cell == null) {
129+
return null;
130+
}
125131
switch (cell.getCellType()) {
126132
case NUMERIC:
127133
return cell.getNumericCellValue();
@@ -132,5 +138,4 @@ private static Object readCellValue(Cell cell) {
132138
}
133139
}
134140

135-
136141
}

0 commit comments

Comments
 (0)