未验证 提交 6ff4d7e5 编写于 作者: I Itami Sho 提交者: GitHub

[IOTDB-6025] iotdb-api: fix bugs & smells reported by SonarCloud (#10318)

上级 e7a6433d
......@@ -16,17 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iotdb.external.api;
import java.util.Properties;
/**
* An interface to load properties from external properties file to override the default
* configurations
* configurations.
*/
public interface IPropertiesLoader {
/**
* Load Properties from specific file
* Load Properties from specific file.
*
* @return a property list with values in file.
*/
......
......@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iotdb.external.api.thrift;
import org.apache.thrift.server.ServerContext;
......@@ -29,7 +30,11 @@ public interface JudgableServerContext extends ServerContext {
*/
boolean whenConnect();
/** @return false if we do not allow this connection */
/**
* this method will be called when a client disconnects to the IoTDB server.
*
* @return false if we do not allow this connection
*/
boolean whenDisconnect();
@Override
......@@ -40,5 +45,5 @@ public interface JudgableServerContext extends ServerContext {
@Override
default boolean isWrapperFor(Class<?> iface) {
return false;
};
}
}
......@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iotdb.external.api.thrift;
import org.apache.thrift.protocol.TProtocol;
......
......@@ -24,7 +24,6 @@ import org.apache.iotdb.pipe.api.type.Binary;
import org.apache.iotdb.pipe.api.type.Type;
import org.apache.iotdb.tsfile.read.common.Path;
import java.io.IOException;
import java.util.List;
public interface Row {
......@@ -54,7 +53,7 @@ public interface Row {
* @param columnIndex index of the specified column
* @return the long value at the specified column in this row
*/
long getLong(int columnIndex) throws IOException;
long getLong(int columnIndex);
/**
* Returns the float value at the specified column in this row.
......@@ -131,7 +130,7 @@ public interface Row {
boolean isNull(int columnIndex);
/**
* Returns the number of columns (excluding the timestamp column)
* Returns the number of columns (excluding the timestamp column).
*
* @return the number of columns (excluding the timestamp column)
*/
......@@ -141,20 +140,20 @@ public interface Row {
* Returns the actual column index of the given column name.
*
* @param columnName the column name in Path form
* @throws PipeParameterNotValidException if the given column name is not existed in the Row
* @return the actual column index of the given column name
* @throws PipeParameterNotValidException if the given column name is not existed in the Row
*/
int getColumnIndex(Path columnName) throws PipeParameterNotValidException;
/**
* Returns the column data types in the Row
* Returns the column data types in the Row.
*
* @return the column data types in the Row
*/
List<Type> getColumnTypes();
/**
* Returns the device id of the Row
* Returns the device id of the Row.
*
* @return the device id of the Row
*/
......
......@@ -32,16 +32,16 @@ public interface TabletInsertionEvent extends Event {
/**
* The consumer processes the data row by row and collects the results by RowCollector.
*
* @return Iterable<TabletInsertionEvent> a list of new TabletInsertionEvent contains the results
* collected by the RowCollector
* @return {@code Iterable<TabletInsertionEvent>} a list of new TabletInsertionEvent contains the
* results collected by the RowCollector
*/
Iterable<TabletInsertionEvent> processRowByRow(BiConsumer<Row, RowCollector> consumer);
/**
* The consumer processes the Tablet directly and collects the results by RowCollector.
*
* @return Iterable<TabletInsertionEvent> a list of new TabletInsertionEvent contains the results
* collected by the RowCollector
* @return {@code Iterable<TabletInsertionEvent>} a list of new TabletInsertionEvent contains the
* results collected by the RowCollector
*/
Iterable<TabletInsertionEvent> processTablet(BiConsumer<Tablet, RowCollector> consumer);
}
......@@ -30,7 +30,7 @@ public interface TsFileInsertionEvent extends Event {
/**
* The method is used to convert the TsFileInsertionEvent into several TabletInsertionEvents.
*
* @return the list of TsFileInsertionEvent
* @return {@code Iterable<TabletInsertionEvent>} the list of TabletInsertionEvent
*/
Iterable<TabletInsertionEvent> toTabletInsertionEvents();
}
......@@ -21,6 +21,7 @@ package org.apache.iotdb.pipe.api.type;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
/**
......@@ -31,7 +32,7 @@ public class Binary implements Comparable<Binary>, Serializable {
private static final long serialVersionUID = 1250049718612917815L;
public static final String STRING_ENCODING = "UTF-8";
public static final Charset STRING_CHARSET = Charset.forName(STRING_ENCODING);
public static final Charset STRING_CHARSET = StandardCharsets.UTF_8;
private final byte[] values;
......
......@@ -20,31 +20,31 @@
package org.apache.iotdb.pipe.api.type;
public enum Type {
/** BOOLEAN */
/* BOOLEAN */
BOOLEAN((byte) 0),
/** INT32 */
/* INT32 */
INT32((byte) 1),
/** INT64 */
/* INT64 */
INT64((byte) 2),
/** FLOAT */
/* FLOAT */
FLOAT((byte) 3),
/** DOUBLE */
/* DOUBLE */
DOUBLE((byte) 4),
/** TEXT */
/* TEXT */
TEXT((byte) 5);
private final byte type;
private final byte dataType;
Type(byte type) {
this.type = type;
this.dataType = type;
}
public byte getType() {
return type;
return dataType;
}
}
......@@ -33,7 +33,9 @@ public class SubscriptionConfiguration {
private DisorderHandlingStrategy disorderHandlingStrategy;
private TopicsStrategy topicStrategy;
private SubscriptionConfiguration() {}
private SubscriptionConfiguration() {
// allowed to be constructed by builder
}
private void check() throws SubscriptionException {
if (host == null) {
......
......@@ -25,10 +25,18 @@ import java.util.List;
public interface Consumer extends AutoCloseable {
/** Open the subscription. */
/**
* Open the subscription.
*
* @throws SubscriptionException if the subscription cannot be opened
*/
void openSubscription() throws SubscriptionException;
/** Close the subscription. */
/**
* Close the subscription.
*
* @throws SubscriptionException if the subscription cannot be closed
*/
void closeSubscription() throws SubscriptionException;
/**
......
......@@ -24,6 +24,10 @@ import org.apache.iotdb.subscription.api.exception.SubscriptionStrategyNotValidE
/** Subscription strategy interface. */
public interface SubscriptionStrategy {
/** @throws SubscriptionStrategyNotValidException if invalid strategy is set */
/**
* Check if the strategy is valid.
*
* @throws SubscriptionStrategyNotValidException if invalid strategy is set
*/
void check() throws SubscriptionStrategyNotValidException;
}
......@@ -28,5 +28,7 @@ public class IntolerableStrategy extends DisorderHandlingStrategy {
}
@Override
public void check() throws SubscriptionStrategyNotValidException {}
public void check() throws SubscriptionStrategyNotValidException {
// do nothing
}
}
......@@ -67,6 +67,8 @@ public interface Trigger {
}
/**
* This method will be called when a trigger is fired.
*
* @param tablet see {@link Tablet} for detailed information of data structure. Data that is
* inserted will be constructed as a Tablet and you can define process logic with {@link
* Tablet}.
......
......@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iotdb.trigger.api.enums;
import org.apache.iotdb.trigger.api.Trigger;
......
......@@ -33,8 +33,12 @@ public interface UDF {
* @throws Exception if any parameter is not valid
*/
@SuppressWarnings("squid:S112")
default void validate(UDFParameterValidator validator) throws Exception {}
default void validate(UDFParameterValidator validator) throws Exception {
// do nothing
}
/** This method is mainly used to release the resources used in the UDF. */
default void beforeDestroy() {}
default void beforeDestroy() {
// do nothing
}
}
......@@ -46,7 +46,7 @@ import org.apache.iotdb.udf.api.customizer.strategy.SlidingTimeWindowAccessStrat
* PointCollector)}
* </ul>
*
* In the life cycle of a UDTF instance, the calling sequence of each method is as follows:
* <p>In the life cycle of a UDTF instance, the calling sequence of each method is as follows:
*
* <p>1. {@link UDTF#validate(UDFParameterValidator)} 2. {@link UDTF#beforeStart(UDFParameters,
* UDTFConfigurations)} 3. {@link UDTF#transform(RowWindow, PointCollector)} or {@link
......@@ -91,7 +91,9 @@ public interface UDTF extends UDF {
* @see RowByRowAccessStrategy
*/
@SuppressWarnings("squid:S112")
default void transform(Row row, PointCollector collector) throws Exception {}
default void transform(Row row, PointCollector collector) throws Exception {
// do nothing
}
/**
* When the user specifies {@link SlidingSizeWindowAccessStrategy} or {@link
......@@ -106,7 +108,9 @@ public interface UDTF extends UDF {
* @see SlidingTimeWindowAccessStrategy
*/
@SuppressWarnings("squid:S112")
default void transform(RowWindow rowWindow, PointCollector collector) throws Exception {}
default void transform(RowWindow rowWindow, PointCollector collector) throws Exception {
// do nothing
}
/**
* When the user specifies {@link MappableRowByRowAccessStrategy} to access the original data in
......@@ -115,6 +119,7 @@ public interface UDTF extends UDF {
*
* @param row original input data row (aligned by time)
* @throws Exception the user can throw errors if necessary
* @throws UnsupportedOperationException if the user does not override this method
* @see MappableRowByRowAccessStrategy
*/
default Object transform(Row row) throws Exception {
......@@ -122,13 +127,15 @@ public interface UDTF extends UDF {
}
/**
* This method will be called once after all {@link UDTF#transform(Row, PointCollector) calls or
* {@link UDTF#transform(RowWindow, PointCollector) calls have been executed. In a single UDF
* This method will be called once after all {@link UDTF#transform(Row, PointCollector)} calls or
* {@link UDTF#transform(RowWindow, PointCollector)} calls have been executed. In a single UDF
* query, this method will and will only be called once.
*
* @param collector used to collect output data points
* @throws Exception the user can throw errors if necessary
*/
@SuppressWarnings("squid:S112")
default void terminate(PointCollector collector) throws Exception {}
default void terminate(PointCollector collector) throws Exception {
// do nothing
}
}
......@@ -30,6 +30,7 @@ public interface Row {
* Returns the timestamp of this row.
*
* @return timestamp
* @throws IOException if an I/O error occurs
*/
long getTime() throws IOException;
......@@ -40,6 +41,7 @@ public interface Row {
*
* @param columnIndex index of the specified column
* @return the int value at the specified column in this row
* @throws IOException if an I/O error occurs
*/
int getInt(int columnIndex) throws IOException;
......@@ -50,6 +52,7 @@ public interface Row {
*
* @param columnIndex index of the specified column
* @return the long value at the specified column in this row
* @throws IOException if an I/O error occurs
*/
long getLong(int columnIndex) throws IOException;
......@@ -60,6 +63,7 @@ public interface Row {
*
* @param columnIndex index of the specified column
* @return the float value at the specified column in this row
* @throws IOException if an I/O error occurs
*/
float getFloat(int columnIndex) throws IOException;
......@@ -71,6 +75,7 @@ public interface Row {
*
* @param columnIndex index of the specified column
* @return the double value at the specified column in this row
* @throws IOException if an I/O error occurs
*/
double getDouble(int columnIndex) throws IOException;
......@@ -82,6 +87,7 @@ public interface Row {
*
* @param columnIndex index of the specified column
* @return the boolean value at the specified column in this row
* @throws IOException if an I/O error occurs
*/
boolean getBoolean(int columnIndex) throws IOException;
......@@ -92,6 +98,7 @@ public interface Row {
*
* @param columnIndex index of the specified column
* @return the Binary value at the specified column in this row
* @throws IOException if an I/O error occurs
*/
Binary getBinary(int columnIndex) throws IOException;
......@@ -102,6 +109,7 @@ public interface Row {
*
* @param columnIndex index of the specified column
* @return the String value at the specified column in this row
* @throws IOException if an I/O error occurs
*/
String getString(int columnIndex) throws IOException;
......@@ -122,7 +130,7 @@ public interface Row {
boolean isNull(int columnIndex);
/**
* Returns the number of columns
* Returns the number of columns.
*
* @return the number of columns
*/
......
......@@ -34,16 +34,18 @@ import java.time.ZoneId;
/**
* Used in {@link UDTF#beforeStart(UDFParameters, UDTFConfigurations)}.
* <p>
* Supports calling methods in a chain.
* <p>
* Sample code:
*
* <p>Supports calling methods in a chain.
*
* <p>Sample code:
*
* <pre>{@code
* @Override
* public void beforeStart(UDFParameters parameters, UDTFConfigurations configurations) {
* configurations
* .setOutputDataType(TSDataType.INT64)
* .setAccessStrategy(new RowByRowAccessStrategy());
* }
* }</pre>
*/
public class UDTFConfigurations extends UDFConfigurations {
......
......@@ -59,6 +59,8 @@ public class UDFParameterValidator {
*
* @param index index of the specified column
* @param expectedDataType the expected data type
* @throws UDFException there are two exceptions that may be thrown:
* UDFInputSeriesIndexNotValidException and UDFInputSeriesDataTypeNotValidException
* @throws UDFInputSeriesIndexNotValidException if the index of the specified column is out of
* bound
* @throws UDFInputSeriesDataTypeNotValidException if the data type of the input series at the
......@@ -82,6 +84,8 @@ public class UDFParameterValidator {
*
* @param index index of the specified column
* @param expectedDataTypes the expected data types
* @throws UDFException there are two exceptions that may be thrown:
* UDFInputSeriesIndexNotValidException and UDFInputSeriesDataTypeNotValidException
* @throws UDFInputSeriesIndexNotValidException if the index of the specified column is out of
* bound
* @throws UDFInputSeriesDataTypeNotValidException if the data type of the input series at the
......
......@@ -31,22 +31,46 @@ public interface AccessStrategy {
enum AccessStrategyType {
/** @see MappableRowByRowAccessStrategy */
/**
* Represents the access strategy type for mappable row-by-row access.
*
* @see MappableRowByRowAccessStrategy
*/
MAPPABLE_ROW_BY_ROW,
/** @see RowByRowAccessStrategy */
/**
* Represents the access strategy type for row-by-row access.
*
* @see RowByRowAccessStrategy
*/
ROW_BY_ROW,
/** @see SlidingTimeWindowAccessStrategy */
/**
* Represents the access strategy type for sliding time window access.
*
* @see SlidingTimeWindowAccessStrategy
*/
SLIDING_TIME_WINDOW,
/** @see SlidingSizeWindowAccessStrategy */
/**
* Represents the access strategy type for sliding size window access.
*
* @see SlidingSizeWindowAccessStrategy
*/
SLIDING_SIZE_WINDOW,
/** @see SessionTimeWindowAccessStrategy */
/**
* Represents the access strategy type for session time window access.
*
* @see SessionTimeWindowAccessStrategy
*/
SESSION_TIME_WINDOW,
/** @see StateWindowAccessStrategy */
/**
* Represents the access strategy type for state window access.
*
* @see StateWindowAccessStrategy
*/
STATE_WINDOW
}
......
......@@ -26,21 +26,23 @@ import org.apache.iotdb.udf.api.customizer.parameter.UDFParameters;
/**
* Used in {@link UDTF#beforeStart(UDFParameters, UDTFConfigurations)}.
* <p>
* When the access strategy of a UDTF is set to an instance of this class, the method {@link
* UDTF#transform(Row)} of the UDTF will be called to transform the original data.
* You need to override the method in your own UDTF class.
* <p>
* Each call of the method {@link UDTF#transform(Row)} processes only one row
* (aligned by time) of the original data and can generate any number of data points.
* <p>
* Sample code:
*
* <p>When the access strategy of a UDTF is set to an instance of this class, the method {@link
* UDTF#transform(Row)} of the UDTF will be called to transform the original data. You need to
* override the method in your own UDTF class.
*
* <p>Each call of the method {@link UDTF#transform(Row)} processes only one row (aligned by time)
* of the original data and can generate any number of data points.
*
* <p>Sample code:
*
* <pre>{@code
* @Override
* public void beforeStart(UDFParameters parameters, UDTFConfigurations configurations) {
* configurations
* .setOutputDataType(TSDataType.INT64)
* .setAccessStrategy(new MappableRowByRowAccessStrategy());
* }
* }</pre>
*
* @see UDTF
......
......@@ -27,21 +27,23 @@ import org.apache.iotdb.udf.api.customizer.parameter.UDFParameters;
/**
* Used in {@link UDTF#beforeStart(UDFParameters, UDTFConfigurations)}.
* <p>
* When the access strategy of a UDTF is set to an instance of this class, the method {@link
*
* <p>When the access strategy of a UDTF is set to an instance of this class, the method {@link
* UDTF#transform(Row, PointCollector)} of the UDTF will be called to transform the original data.
* You need to override the method in your own UDTF class.
* <p>
* Each call of the method {@link UDTF#transform(Row, PointCollector)} processes only one row
*
* <p>Each call of the method {@link UDTF#transform(Row, PointCollector)} processes only one row
* (aligned by time) of the original data and can generate any number of data points.
* <p>
* Sample code:
*
* <p>Sample code:
*
* <pre>{@code
* @Override
* public void beforeStart(UDFParameters parameters, UDTFConfigurations configurations) {
* configurations
* .setOutputDataType(TSDataType.INT64)
* .setAccessStrategy(new RowByRowAccessStrategy());
* }
* }</pre>
*
* @see UDTF
......
......@@ -30,6 +30,8 @@ public class SessionTimeWindowAccessStrategy implements AccessStrategy {
private ZoneId zoneId;
/**
* Display window begin, display window end and sessionTimeGap will be set by the parameters.
*
* @param displayWindowBegin displayWindowBegin < displayWindowEnd
* @param displayWindowEnd displayWindowBegin < displayWindowEnd
* @param sessionTimeGap 0 <= sessionTimeGap
......
......@@ -27,23 +27,25 @@ import org.apache.iotdb.udf.api.customizer.parameter.UDFParameters;
/**
* Used in {@link UDTF#beforeStart(UDFParameters, UDTFConfigurations)}.
* <p>
* When the access strategy of a UDTF is set to an instance of this class, the method {@link
*
* <p>When the access strategy of a UDTF is set to an instance of this class, the method {@link
* UDTF#transform(RowWindow, PointCollector)} of the UDTF will be called to transform the original
* data. You need to override the method in your own UDTF class.
* <p>
* Sliding size window is a kind of size-based window. Except for the last call, each call of the
*
* <p>Sliding size window is a kind of size-based window. Except for the last call, each call of the
* method {@link UDTF#transform(RowWindow, PointCollector)} processes a window with {@code
* windowSize} rows (aligned by time) of the original data and can generate any number of data
* points.
* <p>
* Sample code:
*
* <p>Sample code:
*
* <pre>{@code
* @Override
* public void beforeStart(UDFParameters parameters, UDTFConfigurations configurations) {
* configurations
* .setOutputDataType(TSDataType.INT32)
* .setAccessStrategy(new SlidingSizeWindowAccessStrategy(10000)); // window size
* }
* }</pre>
*
* @see UDTF
......@@ -72,7 +74,7 @@ public class SlidingSizeWindowAccessStrategy implements AccessStrategy {
* <li>(7, 102, 'error')
* </ul>
*
* Set windowSize to 2 and set slidingStep to 3, windows will be generated as below: Window 0:
* <p>Set windowSize to 2 and set slidingStep to 3, windows will be generated as below: Window 0:
* [(1, 100, null ), (2, 100, null)] Window 1: [(4, 100, 'error'), (5, 100, null)] Window 2: [(7,
* 102, 'error')]
*
......
......@@ -29,29 +29,30 @@ import java.time.ZoneId;
/**
* Used in {@link UDTF#beforeStart(UDFParameters, UDTFConfigurations)}.
* <p>
* When the access strategy of a UDTF is set to an instance of this class, the method {@link
*
* <p>When the access strategy of a UDTF is set to an instance of this class, the method {@link
* UDTF#transform(RowWindow, PointCollector)} of the UDTF will be called to transform the original
* data. You need to override the method in your own UDTF class.
* <p>
* Sliding time window is a kind of time-based window. To partition the raw query data set into
*
* <p>Sliding time window is a kind of time-based window. To partition the raw query data set into
* sliding time windows, you need to give the following 4 parameters:
* <p>
* <li> display window begin: determines the start time of the first window
* <li> display window end: if the start time of current window + sliding step > display window
* end, then current window is the last window that your UDTF can process
* <li> time interval: determines the time range of a window
* <li> sliding step: the start time of the next window = the start time of current window +
* sliding step
* <p>
* Each call of the method {@link UDTF#transform(RowWindow, PointCollector)} processes one time
* window and can generate any number of data points. Note that the transform method will still be
* called when there is no data point in a window. Note that the time range of the last few windows
* may be less than the specified time interval.
* <p>
* Sample code:
* <p>Style 1:
* <pre>{@code
* <li>display window begin: determines the start time of the first window
* <li>display window end: if the start time of current window + sliding step > display window end,
* then current window is the last window that your UDTF can process
* <li>time interval: determines the time range of a window
* <li>sliding step: the start time of the next window = the start time of current window + sliding
* step
*
* <p>Each call of the method {@link UDTF#transform(RowWindow, PointCollector)} processes one
* time window and can generate any number of data points. Note that the transform method will
* still be called when there is no data point in a window. Note that the time range of the last
* few windows may be less than the specified time interval.
*
* <p>Sample code:
*
* <p>Style 1:
*
* <pre>{@code
* @Override
* public void beforeStart(UDFParameters parameters, UDTFConfigurations configurations) {
* configurations.setAccessStrategy(new SlidingTimeWindowAccessStrategy(
......@@ -59,9 +60,12 @@ import java.time.ZoneId;
* parameters.getLong(50), // sliding step
* parameters.getLong(0), // display window begin
* parameters.getLong(10000))); // display window end
* }
* }</pre>
* <p>Style 2 (deprecated since v0.14):
* <pre>{@code
*
* <p>Style 2 (deprecated since v0.14):
*
* <pre>{@code
* @Override
* public void beforeStart(UDFParameters parameters, UDTFConfigurations configurations) {
* configurations.setAccessStrategy(new SlidingTimeWindowAccessStrategy(
......@@ -69,6 +73,7 @@ import java.time.ZoneId;
* parameters.getLong("7d"), // sliding step
* parameters.getLong("2020-01-01T00:00:00"), // display window begin
* parameters.getLong("2020-06-01T00:00:00"))); // display window end
* }
* }</pre>
*
* @see UDTF
......@@ -95,6 +100,7 @@ public class SlidingTimeWindowAccessStrategy implements AccessStrategy {
* @param displayWindowEndString display window end in string. format: 2011-12-03T10:15:30 or
* 2011-12-03T10:15:30+01:00.
* @throws UnsupportedOperationException deprecated since v0.14
* @deprecated use {@link #SlidingTimeWindowAccessStrategy(long, long, long, long)} instead.
*/
@Deprecated
public SlidingTimeWindowAccessStrategy(
......@@ -117,6 +123,7 @@ public class SlidingTimeWindowAccessStrategy implements AccessStrategy {
* @param slidingStepString sliding step in string. examples: 12d8m9ns, 1y1mo, etc. supported
* units: y, mo, w, d, h, m, s, ms, us, ns.
* @throws UnsupportedOperationException deprecated since v0.14
* @deprecated use {@link #SlidingTimeWindowAccessStrategy(long, long)} instead.
*/
@Deprecated
public SlidingTimeWindowAccessStrategy(String timeIntervalString, String slidingStepString) {
......@@ -139,6 +146,8 @@ public class SlidingTimeWindowAccessStrategy implements AccessStrategy {
}
/**
* Display window begin and display window end will be set by the parameters.
*
* @param timeInterval 0 < timeInterval
* @param slidingStep 0 < slidingStep
* @param displayWindowBegin displayWindowBegin < displayWindowEnd
......
......@@ -30,6 +30,8 @@ public class StateWindowAccessStrategy implements AccessStrategy {
private ZoneId zoneId;
/**
* Display window begin, display window end and delta will be set by the parameters.
*
* @param displayWindowBegin displayWindowBegin < displayWindowEnd
* @param displayWindowEnd displayWindowBegin < displayWindowEnd
* @param delta delta >= 0
......@@ -41,6 +43,9 @@ public class StateWindowAccessStrategy implements AccessStrategy {
}
/**
* Display window begin and display window end will be set by the parameters. delta default equals
* 0.
*
* @param displayWindowBegin displayWindowBegin < displayWindowEnd
* @param displayWindowEnd displayWindowBegin < displayWindowEnd
*/
......
......@@ -16,10 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iotdb.udf.api.type;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
/**
......@@ -30,7 +32,7 @@ public class Binary implements Comparable<Binary>, Serializable {
private static final long serialVersionUID = 1250049718612917815L;
public static final String STRING_ENCODING = "UTF-8";
public static final Charset STRING_CHARSET = Charset.forName(STRING_ENCODING);
public static final Charset STRING_CHARSET = StandardCharsets.UTF_8;
private final byte[] values;
......
......@@ -16,35 +16,36 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iotdb.udf.api.type;
/** A substitution class for TsDataType in UDF APIs. */
public enum Type {
/** BOOLEAN */
/* BOOLEAN */
BOOLEAN((byte) 0),
/** INT32 */
/* INT32 */
INT32((byte) 1),
/** INT64 */
/* INT64 */
INT64((byte) 2),
/** FLOAT */
/* FLOAT */
FLOAT((byte) 3),
/** DOUBLE */
/* DOUBLE */
DOUBLE((byte) 4),
/** TEXT */
/* TEXT */
TEXT((byte) 5);
private final byte type;
private final byte dataType;
Type(byte type) {
this.type = type;
this.dataType = type;
}
public byte getType() {
return type;
return dataType;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册