Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
0210db82
提交
0210db82
authored
4月 09, 2021
作者:
junjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(数据集):数据集字段类型扩展,数值区分 整型与浮点型
上级
5b60ea57
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
25 行增加
和
10 行删除
+25
-10
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+3
-2
SparkCalc.java
...nd/src/main/java/io/dataease/service/spark/SparkCalc.java
+20
-6
V9__dataset_tables.sql
...nd/src/main/resources/db/migration/V9__dataset_tables.sql
+1
-1
ViewTable.vue
frontend/src/views/dataset/data/ViewTable.vue
+1
-1
没有找到文件。
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
浏览文件 @
0210db82
...
...
@@ -113,7 +113,7 @@ public class DataSetTableService {
List
<
DatasetTableField
>
quota
=
new
ArrayList
<>();
fields
.
forEach
(
field
->
{
if
(
field
.
getDeType
()
==
2
)
{
if
(
field
.
getDeType
()
==
2
||
field
.
getDeType
()
==
3
)
{
quota
.
add
(
field
);
}
else
{
dimension
.
add
(
field
);
...
...
@@ -360,10 +360,11 @@ public class DataSetTableService {
case
"MEDIUMINT"
:
case
"INTEGER"
:
case
"BIGINT"
:
return
2
;
// 整型
case
"FLOAT"
:
case
"DOUBLE"
:
case
"DECIMAL"
:
return
2
;
// 数值
return
3
;
// 浮点
default
:
return
0
;
}
...
...
backend/src/main/java/io/dataease/service/spark/SparkCalc.java
浏览文件 @
0210db82
...
...
@@ -74,25 +74,35 @@ public class SparkCalc {
Result
result
=
tuple2Iterator
.
next
().
_2
;
List
<
Object
>
list
=
new
ArrayList
<>();
xAxis
.
forEach
(
x
->
{
String
l
=
Bytes
.
toString
(
result
.
getValue
(
column_family
.
getBytes
(),
x
.
getOriginName
().
getBytes
()));
if
(
x
.
getDeType
()
==
0
||
x
.
getDeType
()
==
1
)
{
list
.
add
(
Bytes
.
toString
(
result
.
getValue
(
column_family
.
getBytes
(),
x
.
getOriginName
().
getBytes
()))
);
list
.
add
(
l
);
}
else
if
(
x
.
getDeType
()
==
2
)
{
String
l
=
Bytes
.
toString
(
result
.
getValue
(
column_family
.
getBytes
(),
x
.
getOriginName
().
getBytes
()));
if
(
StringUtils
.
isEmpty
(
l
))
{
l
=
"0"
;
}
list
.
add
(
l
.
contains
(
"."
)
?
Double
.
parseDouble
(
l
)
:
Long
.
parseLong
(
l
));
list
.
add
(
Long
.
valueOf
(
l
));
}
else
if
(
x
.
getDeType
()
==
3
)
{
if
(
StringUtils
.
isEmpty
(
l
))
{
l
=
"0.0"
;
}
list
.
add
(
Double
.
valueOf
(
l
));
}
});
yAxis
.
forEach
(
y
->
{
String
l
=
Bytes
.
toString
(
result
.
getValue
(
column_family
.
getBytes
(),
y
.
getOriginName
().
getBytes
()));
if
(
y
.
getDeType
()
==
0
||
y
.
getDeType
()
==
1
)
{
list
.
add
(
Bytes
.
toString
(
result
.
getValue
(
column_family
.
getBytes
(),
y
.
getOriginName
().
getBytes
()))
);
list
.
add
(
l
);
}
else
if
(
y
.
getDeType
()
==
2
)
{
String
l
=
Bytes
.
toString
(
result
.
getValue
(
column_family
.
getBytes
(),
y
.
getOriginName
().
getBytes
()));
if
(
StringUtils
.
isEmpty
(
l
))
{
l
=
"0"
;
}
list
.
add
(
l
.
contains
(
"."
)
?
Double
.
parseDouble
(
l
)
:
Long
.
parseLong
(
l
));
list
.
add
(
Long
.
valueOf
(
l
));
}
else
if
(
y
.
getDeType
()
==
3
)
{
if
(
StringUtils
.
isEmpty
(
l
))
{
l
=
"0.0"
;
}
list
.
add
(
Double
.
valueOf
(
l
));
}
});
iterator
.
add
(
RowFactory
.
create
(
list
.
toArray
()));
...
...
@@ -107,6 +117,8 @@ public class SparkCalc {
structFields
.
add
(
DataTypes
.
createStructField
(
x
.
getOriginName
(),
DataTypes
.
StringType
,
true
));
}
else
if
(
x
.
getDeType
()
==
2
)
{
structFields
.
add
(
DataTypes
.
createStructField
(
x
.
getOriginName
(),
DataTypes
.
LongType
,
true
));
}
else
if
(
x
.
getDeType
()
==
3
)
{
structFields
.
add
(
DataTypes
.
createStructField
(
x
.
getOriginName
(),
DataTypes
.
DoubleType
,
true
));
}
});
yAxis
.
forEach
(
y
->
{
...
...
@@ -114,6 +126,8 @@ public class SparkCalc {
structFields
.
add
(
DataTypes
.
createStructField
(
y
.
getOriginName
(),
DataTypes
.
StringType
,
true
));
}
else
if
(
y
.
getDeType
()
==
2
)
{
structFields
.
add
(
DataTypes
.
createStructField
(
y
.
getOriginName
(),
DataTypes
.
LongType
,
true
));
}
else
if
(
y
.
getDeType
()
==
3
)
{
structFields
.
add
(
DataTypes
.
createStructField
(
y
.
getOriginName
(),
DataTypes
.
DoubleType
,
true
));
}
});
StructType
structType
=
DataTypes
.
createStructType
(
structFields
);
...
...
backend/src/main/resources/db/migration/V9__dataset_tables.sql
浏览文件 @
0210db82
...
...
@@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS `dataset_table_field`
`origin_name`
varchar
(
255
)
NOT
NULL
COMMENT
'原始名'
,
`name`
varchar
(
255
)
NOT
NULL
COMMENT
'字段名'
,
`type`
varchar
(
50
)
NOT
NULL
COMMENT
'原始字段类型'
,
`de_type`
int
(
10
)
NOT
NULL
COMMENT
'dataease字段类型:0-文本,1-时间,2-数值...'
,
`de_type`
int
(
10
)
NOT
NULL
COMMENT
'dataease字段类型:0-文本,1-时间,2-
整型数值,3-浮点
数值...'
,
`checked`
tinyint
(
1
)
NOT
NULL
DEFAULT
true
COMMENT
'是否选中'
,
`column_index`
int
(
10
)
NOT
NULL
COMMENT
'列位置'
,
`last_sync_time`
bigint
(
13
)
COMMENT
'同步时间'
,
...
...
frontend/src/views/dataset/data/ViewTable.vue
浏览文件 @
0210db82
...
...
@@ -38,7 +38,7 @@
<template
slot-scope=
"scope"
>
<span
v-if=
"scope.row.deType === 0"
>
{{
$t
(
'dataset.text'
)
}}
</span>
<span
v-if=
"scope.row.deType === 1"
>
{{
$t
(
'dataset.time'
)
}}
</span>
<span
v-if=
"scope.row.deType === 2"
>
{{
$t
(
'dataset.value'
)
}}
</span>
<span
v-if=
"scope.row.deType === 2
|| scope.row.deType === 3
"
>
{{
$t
(
'dataset.value'
)
}}
</span>
</
template
>
</el-table-column>
<el-table-column
property=
"name"
:label=
"$t('dataset.field_name')"
width=
"180"
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论