Skip to content

Commit

Permalink
[Merge][Server] Merge fix pr to dev (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
zixi0825 authored Feb 9, 2025
1 parent ee2e82d commit 46c31e9
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 2 deletions.
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

0 comments on commit 46c31e9

Please sign in to comment.