yunqingmoswu commented on code in PR #5879: URL: https://github.com/apache/inlong/pull/5879#discussion_r973833526
########## inlong-sort/sort-connectors/jdbc/src/main/java/org/apache/inlong/sort/jdbc/dialect/InfluxDBDialect.java: ########## @@ -0,0 +1,117 @@ +/* + * 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 org.apache.inlong.sort.jdbc.dialect; + +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import org.apache.flink.connector.jdbc.internal.converter.JdbcRowConverter; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.logical.RowType; +import org.apache.inlong.sort.jdbc.converter.influxdb.InfluxdbRowConverter; +import org.apache.inlong.sort.jdbc.table.AbstractJdbcDialect; + +public class InfluxDBDialect extends AbstractJdbcDialect { + + private static final long serialVersionUID = 1L; + + // Define MAX/MIN precision of TIMESTAMP type according to influx docs: + // https://awesome.influxdata.com/docs/part-2/input-format-vs-output-format/#note-on-timestamp-precision + private static final int MAX_TIMESTAMP_PRECISION = 9; + private static final int MIN_TIMESTAMP_PRECISION = 1; + + // Define MAX/MIN precision of DECIMAL type according to influx docs: + // https://docs.influxdata.com/influxdb/v2.4/reference/syntax/annotated-csv/ + private static final int MAX_DECIMAL_PRECISION = 64; + private static final int MIN_DECIMAL_PRECISION = 1; + + @Override + public int maxDecimalPrecision() { + return MAX_DECIMAL_PRECISION; + } + + @Override + public int minDecimalPrecision() { + return MIN_DECIMAL_PRECISION; + } + + @Override + public int maxTimestampPrecision() { + return MAX_TIMESTAMP_PRECISION; + } + + @Override + public int minTimestampPrecision() { + return MIN_TIMESTAMP_PRECISION; + } + + @Override + public List<LogicalTypeRoot> unsupportedTypes() { + //https://docs.influxdata.com/flux/v0.x/data-types/ + return Arrays.asList( + LogicalTypeRoot.BINARY, + LogicalTypeRoot.TIMESTAMP_WITH_LOCAL_TIME_ZONE, + LogicalTypeRoot.TIMESTAMP_WITH_TIME_ZONE, + LogicalTypeRoot.INTERVAL_YEAR_MONTH, + LogicalTypeRoot.INTERVAL_DAY_TIME, + LogicalTypeRoot.ARRAY, + LogicalTypeRoot.MULTISET, + LogicalTypeRoot.MAP, + LogicalTypeRoot.ROW, + LogicalTypeRoot.DISTINCT_TYPE, + LogicalTypeRoot.STRUCTURED_TYPE, + LogicalTypeRoot.RAW, + LogicalTypeRoot.SYMBOL, + LogicalTypeRoot.UNRESOLVED); + } + + @Override + public String dialectName() { + return "InfluxDB"; + } + + @Override + public boolean canHandle(String url) { + return url.startsWith("http"); Review Comment: Make sure it is http protocol here? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org