Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.2k
Optimized the overall performance of IoTDB & Fixed the NPE in LimitOperatorTest#17664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
508c7e5f28b5e13bf8da0828d3e8fa6e78dc242e06bbfcbb1b5d73e0c0b4676File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -153,45 +153,42 @@ public boolean hasNext() throws StatementExecutionException, IoTDBConnectionExce | ||
| } | ||
| private RowRecord constructRowRecordFromValueArray() throws StatementExecutionException { | ||
| List<Field> outFields = new ArrayList<>(); | ||
| for (int i = ioTDBRpcDataSet.getValueColumnStartIndex(); | ||
| i < ioTDBRpcDataSet.getColumnSize(); | ||
| i++) { | ||
| int valueColumnStartIndex = ioTDBRpcDataSet.getValueColumnStartIndex(); | ||
| int columnSize = ioTDBRpcDataSet.getColumnSize(); | ||
| List<Field> outFields = new ArrayList<>(columnSize - valueColumnStartIndex); | ||
| for (int columnIndex = valueColumnStartIndex + 1; columnIndex <= columnSize; columnIndex++) { | ||
Caideyipi marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Field field; | ||
| String columnName = ioTDBRpcDataSet.getColumnNameList().get(i); | ||
| if (!ioTDBRpcDataSet.isNull(columnName)) { | ||
| TSDataType dataType = ioTDBRpcDataSet.getDataType(columnName); | ||
| if (!ioTDBRpcDataSet.isNull(columnIndex)) { | ||
| TSDataType dataType = ioTDBRpcDataSet.getDataType(columnIndex); | ||
| field = new Field(dataType); | ||
| switch (dataType) { | ||
| case BOOLEAN: | ||
| boolean booleanValue = ioTDBRpcDataSet.getBoolean(columnName); | ||
| boolean booleanValue = ioTDBRpcDataSet.getBoolean(columnIndex); | ||
| field.setBoolV(booleanValue); | ||
| break; | ||
| case INT32: | ||
| case DATE: | ||
| int intValue = ioTDBRpcDataSet.getInt(columnName); | ||
| int intValue = ioTDBRpcDataSet.getInt(columnIndex); | ||
| field.setIntV(intValue); | ||
| break; | ||
| case INT64: | ||
| case TIMESTAMP: | ||
| long longValue = ioTDBRpcDataSet.getLong(columnName); | ||
| long longValue = ioTDBRpcDataSet.getLong(columnIndex); | ||
| field.setLongV(longValue); | ||
| break; | ||
| case FLOAT: | ||
| float floatValue = ioTDBRpcDataSet.getFloat(columnName); | ||
| float floatValue = ioTDBRpcDataSet.getFloat(columnIndex); | ||
| field.setFloatV(floatValue); | ||
| break; | ||
| case DOUBLE: | ||
| double doubleValue = ioTDBRpcDataSet.getDouble(columnName); | ||
| double doubleValue = ioTDBRpcDataSet.getDouble(columnIndex); | ||
| field.setDoubleV(doubleValue); | ||
| break; | ||
| case TEXT: | ||
| case BLOB: | ||
| case STRING: | ||
| case OBJECT: | ||
| field.setBinaryV(ioTDBRpcDataSet.getBinary(columnName)); | ||
| field.setBinaryV(ioTDBRpcDataSet.getBinary(columnIndex)); | ||
| break; | ||
| default: | ||
| throw new UnSupportedDataTypeException( | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -128,20 +128,15 @@ public IoTDBJDBCDataSet( | ||
| // deduplicate and map | ||
| if (columnNameIndex != null) { | ||
| int deduplicatedColumnSize = (int) columnNameIndex.values().stream().distinct().count(); | ||
| this.columnTypeDeduplicatedList = new ArrayList<>(deduplicatedColumnSize); | ||
| for (int i = 0; i < deduplicatedColumnSize; i++) { | ||
| columnTypeDeduplicatedList.add(null); | ||
| } | ||
| this.columnTypeDeduplicatedList = | ||
| initDeduplicatedColumnTypes(getDeduplicatedColumnSize(columnNameIndex)); | ||
| for (int i = 0; i < columnNameList.size(); i++) { | ||
| String name = columnNameList.get(i); | ||
| this.columnNameList.add(name); | ||
| this.columnTypeList.add(columnTypeList.get(i)); | ||
| if (!columnOrdinalMap.containsKey(name)) { | ||
| int index = columnNameIndex.get(name); | ||
| if (!columnOrdinalMap.containsValue(index + START_INDEX)) { | ||
| columnTypeDeduplicatedList.set(index, TSDataType.valueOf(columnTypeList.get(i))); | ||
| } | ||
| setColumnTypeIfAbsent(columnTypeDeduplicatedList, index, columnTypeList.get(i)); | ||
| columnOrdinalMap.put(name, index + START_INDEX); | ||
| } | ||
| } | ||
| @@ -243,11 +238,8 @@ public IoTDBJDBCDataSet( | ||
| // deduplicate and map | ||
| if (columnNameIndex != null) { | ||
| int deduplicatedColumnSize = (int) columnNameIndex.values().stream().distinct().count(); | ||
| this.columnTypeDeduplicatedList = new ArrayList<>(deduplicatedColumnSize); | ||
| for (int i = 0; i < deduplicatedColumnSize; i++) { | ||
| columnTypeDeduplicatedList.add(null); | ||
| } | ||
| this.columnTypeDeduplicatedList = | ||
| initDeduplicatedColumnTypes(getDeduplicatedColumnSize(columnNameIndex)); | ||
| for (int i = 0; i < columnNameList.size(); i++) { | ||
| String name = ""; | ||
| if (sgList != null | ||
| @@ -263,9 +255,7 @@ public IoTDBJDBCDataSet( | ||
| // "Time".equals(name) -> to allow the Time column appear in value columns | ||
| if (!columnOrdinalMap.containsKey(name) || "Time".equals(name)) { | ||
| int index = columnNameIndex.get(name); | ||
| if (!columnOrdinalMap.containsValue(index + START_INDEX)) { | ||
| columnTypeDeduplicatedList.set(index, TSDataType.valueOf(columnTypeList.get(i))); | ||
| } | ||
| setColumnTypeIfAbsent(columnTypeDeduplicatedList, index, columnTypeList.get(i)); | ||
| columnOrdinalMap.put(name, index + START_INDEX); | ||
| } | ||
| } | ||
| @@ -321,6 +311,31 @@ public IoTDBJDBCDataSet( | ||
| this.emptyResultSet = (queryDataSet == null || !queryDataSet.time.hasRemaining()); | ||
| } | ||
| private static int getDeduplicatedColumnSize(Map<String, Integer> columnNameIndex) { | ||
Caideyipi marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| int deduplicatedColumnSize = 0; | ||
| for (Integer index : columnNameIndex.values()) { | ||
| if (index != null && index + 1 > deduplicatedColumnSize) { | ||
| deduplicatedColumnSize = index + 1; | ||
| } | ||
| } | ||
| return deduplicatedColumnSize; | ||
| } | ||
| private static List<TSDataType> initDeduplicatedColumnTypes(int deduplicatedColumnSize) { | ||
| List<TSDataType> columnTypes = new ArrayList<>(deduplicatedColumnSize); | ||
| for (int i = 0; i < deduplicatedColumnSize; i++) { | ||
| columnTypes.add(null); | ||
| } | ||
| return columnTypes; | ||
| } | ||
| private static void setColumnTypeIfAbsent( | ||
| List<TSDataType> columnTypeDeduplicatedList, int index, String columnType) { | ||
| if (columnTypeDeduplicatedList.get(index) == null) { | ||
| columnTypeDeduplicatedList.set(index, TSDataType.valueOf(columnType)); | ||
| } | ||
| } | ||
| public void close() throws StatementExecutionException, TException { | ||
| if (isClosed) { | ||
| return; | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.