Commit b0e974ed by zhaochengxiang

支持hive

parent 4ad47ed9
...@@ -97,6 +97,16 @@ const ImportActionHeader = (props) => { ...@@ -97,6 +97,16 @@ const ImportActionHeader = (props) => {
return ''; return '';
}, [modelerData]) }, [modelerData])
//分桶字段
const distributionBucketDescription = useMemo(() => {
if (modelerData && modelerData.distributionKey) {
const keyNamesString = (modelerData.distributionKey.keys??[]).map(item => item.name).toString()
return `${keyNamesString} 分桶数${modelerData.distributionKey.bucketCount}`
}
return '';
}, [modelerData])
//主键 //主键
const primaryDescription = useMemo(() => { const primaryDescription = useMemo(() => {
let newPrimaryDescription = '' let newPrimaryDescription = ''
...@@ -151,10 +161,12 @@ const ImportActionHeader = (props) => { ...@@ -151,10 +161,12 @@ const ImportActionHeader = (props) => {
const hiveTableConfigPropertiesDescription = useMemo(() => { const hiveTableConfigPropertiesDescription = useMemo(() => {
let tmp = [] let tmp = []
for (const item of modelerData?.hiveTableConfigProperties??[]) { for (const item of modelerData?.hiveTableConfigProperties??[]) {
tmp.push({[item.key]: [item.value]}) if (item && item.key && item.value) {
tmp.push(`${item.key}:${item.value}`)
}
} }
return tmp.join(';') return tmp.toString()
}, [modelerData]) }, [modelerData])
const marginBottom = useMemo(() => { const marginBottom = useMemo(() => {
...@@ -379,6 +391,17 @@ const ImportActionHeader = (props) => { ...@@ -379,6 +391,17 @@ const ImportActionHeader = (props) => {
</Col> </Col>
<Col xs={24} sm={24} lg={12} xl={8}> <Col xs={24} sm={24} lg={12} xl={8}>
<Form.Item <Form.Item
label="分桶字段"
name="distributionKey"
style={{ marginBottom }}
>
{
editable ? <DistributionBucketItem modelerData={modelerData} /> : <span className='word-wrap'>{highlightSearchContentByTerms(distributionBucketDescription, terms)}</span>
}
</Form.Item>
</Col>
<Col xs={24} sm={24} lg={12} xl={8}>
<Form.Item
label="生命周期" label="生命周期"
name="hiveLifeCycle" name="hiveLifeCycle"
style={{ marginBottom }} style={{ marginBottom }}
...@@ -404,11 +427,11 @@ const ImportActionHeader = (props) => { ...@@ -404,11 +427,11 @@ const ImportActionHeader = (props) => {
<Col xs={24} sm={24} lg={12} xl={8}> <Col xs={24} sm={24} lg={12} xl={8}>
<Form.Item <Form.Item
label="存储地址" label="存储地址"
name="hvieStoredLocation" name="hiveStoredLocation"
style={{ marginBottom }} style={{ marginBottom }}
> >
{ {
editable ? <Input placeholder='请填写存储地址' /> : <span className='word-wrap'>{highlightSearchContentByTerms(modelerData?.hvieStoredLocation, terms)}</span> editable ? <Input placeholder='请填写存储地址' /> : <span className='word-wrap'>{highlightSearchContentByTerms(modelerData?.hiveStoredLocation, terms)}</span>
} }
</Form.Item> </Form.Item>
</Col> </Col>
...@@ -856,6 +879,56 @@ const DistributionItem = ({ value, modelerData, onChange, ...restProps }) => { ...@@ -856,6 +879,56 @@ const DistributionItem = ({ value, modelerData, onChange, ...restProps }) => {
); );
} }
const DistributionBucketItem = ({ value, modelerData, onChange, ...restProps }) => {
const onAttributeChange = (value) => {
const newKeys = (modelerData?.easyDataModelerDataModelAttributes||[]).filter(attribute => (value||[]).indexOf(attribute.iid)!==-1);
triggerChange({ keys: newKeys });
}
const onBucketChange = (e) => {
const val = e.target.value;
//只允许输入数字
const reg = /^\d+$/;
if (reg.test(val) || val === '') {
triggerChange({ bucketCount: val });
}
}
const triggerChange = (changedValue) => {
onChange?.({...value, ...changedValue, type: 'Hive'});
}
return (
<Row>
<Col span={12}>
<Select
onChange={(val) => {
onAttributeChange(val)
}}
value={(value?.keys??[]).map(item => item.iid)}
placeholder='请选择字段名称'
mode='multiple'
allowClear={true}
>
{
modelerData?.easyDataModelerDataModelAttributes?.map((attribute, index) => <Option key={index} value={attribute.iid}>{attribute.name}</Option>
)
}
</Select>
</Col>
<Col span={12}>
<Input
onChange={onBucketChange}
value={value.bucketCount}
style={{ width: '100%' }}
placeholder='分桶数'
/>
</Col>
</Row>
);
}
const PartitionSelect = ({ value = {}, modelerData, partitionTypes = [], onChange, ...restProps }) => { const PartitionSelect = ({ value = {}, modelerData, partitionTypes = [], onChange, ...restProps }) => {
const onPartitionTypeChange = (value) => { const onPartitionTypeChange = (value) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment