Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.datavines.connector.plugin;


import io.datavines.common.param.form.type.InputParam;

public class ClickHouseConfigBuilder extends JdbcConfigBuilder {

@Override
protected InputParam getPasswordInput(boolean isEn) {
return getInputParam("password",
isEn ? "password" : "密码",
isEn ? "please enter password" : "请填入密码", 1, null,
null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,14 @@ public Executor getExecutor() {
public MetricScript getMetricScript() {
return new ClickHouseMetricScript();
}

@Override
public ConfigBuilder getConfigBuilder() {
return new ClickHouseConfigBuilder();
}

@Override
public TypeConverter getTypeConverter() {
return new ClickHouseTypeConverter();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.datavines.connector.plugin;


import io.datavines.common.enums.DataType;
import io.datavines.common.utils.StringUtils;

public class ClickHouseTypeConverter extends JdbcTypeConverter {
@Override
public DataType convert(String originType) {
if (StringUtils.isEmpty(originType)) {
throw new UnsupportedOperationException("sql type id null error");
}

switch (originType.toUpperCase()) {
case "DECIMAL32":
case "DECIMAL64":
return DataType.BIG_DECIMAL_TYPE;
default:
return super.convert(originType);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public abstract class JdbcConnector implements Connector, IJdbcDataSourceInfo {

protected static final String TABLE = "TABLE";

protected static final String DATABASE = "DATABASE";

protected static final String VIEW = "VIEW";

protected static final String[] TABLE_TYPES = new String[]{TABLE, VIEW};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ public static String getTableAliasColumns(List<MappingColumn> mappingColumnList,
for (int i = 0; i < mappingColumnList.size(); i++) {
MappingColumn column = mappingColumnList.get(i);
if (index == 1) {
columnList[i] = tableAlias + "." + QuoteIdentifier.quote(column.getColumn(), needQuote) + " AS " + QuoteIdentifier.quote(column.getColumn() + "_" + index, needQuote);;
columnList[i] = tableAlias + "." + QuoteIdentifier.quote(column.getColumn(), needQuote) + " AS " + QuoteIdentifier.quote(column.getColumn() + "_" + index, needQuote);
} else if (index == 2){
columnList[i] = tableAlias + "." + QuoteIdentifier.quote(column.getColumn2(), needQuote) + " AS " + QuoteIdentifier.quote(column.getColumn2() + "_" + index, needQuote);;
columnList[i] = tableAlias + "." + QuoteIdentifier.quote(column.getColumn2(), needQuote) + " AS " + QuoteIdentifier.quote(column.getColumn2() + "_" + index, needQuote);
}
}

Expand All @@ -191,7 +191,7 @@ public static String getWhereClause(List<MappingColumn> mappingColumnList,Map<St
}

public static String getCoalesceString(String table, String column, boolean needQuote) {
return "coalesce(" + table + "." + QuoteIdentifier.quote(column, needQuote) + ", '')";
return String.format("COALESCE(CAST(%s.%s AS STRING), '')", table, QuoteIdentifier.quote(column, needQuote));
}

public static String getColumnIsNullStr(String table, List<String> columns, boolean needQuote) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.datavines.server.config;

import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;

import java.math.BigDecimal;
import java.math.BigInteger;

@Configuration
public class JacksonConfig {

/**
* Configure Jackson to serialize long, Long, BigInteger, BigDecimal as JSON strings
* to preserve precision for large numeric values in JavaScript frontends.
*/
@Bean
public Jackson2ObjectMapperBuilderCustomizer jacksonLongToString() {
return builder -> {
// Serialize primitive long and Long wrapper as String
builder.serializerByType(Long.class, ToStringSerializer.instance);
builder.serializerByType(long.class, ToStringSerializer.instance);
// Also handle BigInteger and BigDecimal as String
builder.serializerByType(BigInteger.class, ToStringSerializer.instance);
builder.serializerByType(BigDecimal.class, ToStringSerializer.instance);
};
}
}
2 changes: 1 addition & 1 deletion datavines-server/src/main/resources/mapper/JobMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<select id="getJobPageSelect" resultType="io.datavines.server.api.dto.vo.JobVO">
select p.id, p.name, p.schema_name ,p.table_name,p.column_name, p.type, u.username as updater, p.update_time, s.cron_expression
from (<include refid="basic_sql"/>) p left join `dv_user` u on u.id = p.create_by
from (<include refid="basic_sql"/>) p left join `dv_user` u on u.id = p.update_by
left join `dv_job_schedule` s on p.id = s.job_id and s.status = 1
<where>
<if test="searchVal != null and searchVal != ''">
Expand Down
2 changes: 1 addition & 1 deletion datavines-ui/Editor/components/Database/option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ export const colCol:Col[][] = [[{
dataIndex: 'changeBefore',
key: 'changeBefore',
}, {
title: <FormattedMessage id="jobs_nminute_before" />,
title: <FormattedMessage id="job_after" />,
dataIndex: 'changeAfter',
key: 'changeAfter',
}, {
Expand Down
Loading
Loading