CalvinKirs commented on code in PR #2431: URL: https://github.com/apache/incubator-seatunnel/pull/2431#discussion_r949713079
########## seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSource.java: ########## @@ -0,0 +1,101 @@ +/* + * 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.seatunnel.connectors.seatunnel.iotdb.source; + +import static org.apache.seatunnel.connectors.seatunnel.iotdb.config.SourceConfig.HOST; +import static org.apache.seatunnel.connectors.seatunnel.iotdb.config.SourceConfig.NODE_URLS; +import static org.apache.seatunnel.connectors.seatunnel.iotdb.config.SourceConfig.PORT; + +import org.apache.seatunnel.api.common.PrepareFailException; +import org.apache.seatunnel.api.common.SeaTunnelContext; +import org.apache.seatunnel.api.source.Boundedness; +import org.apache.seatunnel.api.source.SeaTunnelSource; +import org.apache.seatunnel.api.source.SourceReader; +import org.apache.seatunnel.api.source.SourceSplitEnumerator; +import org.apache.seatunnel.api.table.type.SeaTunnelDataType; +import org.apache.seatunnel.api.table.type.SeaTunnelRow; +import org.apache.seatunnel.api.table.type.SeaTunnelRowType; +import org.apache.seatunnel.common.config.CheckConfigUtil; +import org.apache.seatunnel.common.config.CheckResult; +import org.apache.seatunnel.common.constants.PluginType; +import org.apache.seatunnel.connectors.seatunnel.common.schema.SeatunnelSchema; +import org.apache.seatunnel.connectors.seatunnel.iotdb.state.IoTDBSourceState; + +import org.apache.seatunnel.shade.com.typesafe.config.Config; + +import com.google.auto.service.AutoService; + +import java.util.HashMap; +import java.util.Map; + +@AutoService(SeaTunnelSource.class) +public class IoTDBSource implements SeaTunnelSource<SeaTunnelRow, IoTDBSourceSplit, IoTDBSourceState> { + + private SeaTunnelContext seaTunnelContext; + + private SeaTunnelRowType typeInfo; + + private Map<String, Object> configParams = new HashMap(); + + @Override + public String getPluginName() { + return "IoTDB"; + } + + @Override + public void prepare(Config pluginConfig) throws PrepareFailException { + CheckResult result = CheckConfigUtil.checkAllExists(pluginConfig, HOST, PORT); + if (!result.isSuccess()) { + result = CheckConfigUtil.checkAllExists(pluginConfig, NODE_URLS); + + if (!result.isSuccess()) { + throw new PrepareFailException(getPluginName(), PluginType.SOURCE, "host and port and node urls are both empty"); + } + } + SeatunnelSchema seatunnelSchema = SeatunnelSchema.buildWithConfig(pluginConfig); Review Comment: hi, as it stands, it probably doesn't make much sense to use an extra level of nesting. What is the meaning of schema and field? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
