You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by er...@apache.org on 2022/01/14 05:45:20 UTC
[iotdb] branch master updated: [IOTDB-2367] Linear fill should log warning for unsupported data type (#4809)
This is an automated email from the ASF dual-hosted git repository.
ericpai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new e3827ea [IOTDB-2367] Linear fill should log warning for unsupported data type (#4809)
e3827ea is described below
commit e3827ea57c8b5928f74b55550b6d42bf8c10d645
Author: CRZbulabula <33...@users.noreply.github.com>
AuthorDate: Fri Jan 14 13:44:47 2022 +0800
[IOTDB-2367] Linear fill should log warning for unsupported data type (#4809)
---
.../db/query/dataset/groupby/GroupByFillDataSet.java | 20 ++++++++++++++++----
.../iotdb/db/query/executor/FillQueryExecutor.java | 15 +++++++++++++++
2 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java
index 179b2c9..7f39f4b 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java
@@ -57,6 +57,7 @@ public class GroupByFillDataSet extends GroupByEngineDataSet {
private final Map<TSDataType, IFill> fillTypes;
private final IFill singleFill;
private final List<String> aggregations;
+ private boolean[] unsupportedFillMethod;
// the result datatype for each aggregation
private final TSDataType[] resultDataType;
@@ -92,9 +93,11 @@ public class GroupByFillDataSet extends GroupByEngineDataSet {
previousTimes = new long[aggregations.size()];
previousValues = new Object[aggregations.size()];
nextIndices = new int[aggregations.size()];
+ unsupportedFillMethod = new boolean[aggregations.size()];
Arrays.fill(previousTimes, Long.MAX_VALUE);
Arrays.fill(previousValues, null);
Arrays.fill(nextIndices, 0);
+ Arrays.fill(unsupportedFillMethod, false);
nextTVLists = new ArrayList<>(aggregations.size());
for (int i = 0; i < aggregations.size(); i++) {
@@ -174,13 +177,18 @@ public class GroupByFillDataSet extends GroupByEngineDataSet {
try {
slideCache(record.getTimestamp());
} catch (QueryProcessException e) {
- logger.warn("group by fill has an exception while sliding: ", e);
+ logger.error("group by fill has an exception while sliding: ", e);
}
return record;
}
private void fillRecord(int index, RowRecord record) throws IOException {
+ if (unsupportedFillMethod[index]) {
+ record.addField(null);
+ return;
+ }
+
IFill fill;
if (fillTypes != null) {
// old type fill logic
@@ -252,9 +260,11 @@ public class GroupByFillDataSet extends GroupByEngineDataSet {
record.getTimestamp(),
resultDataType[index]);
record.addField(filledPair.getValue().getValue(), resultDataType[index]);
- } catch (UnSupportedFillTypeException e) {
- // Don't fill and ignore unsupported type exception
+ } catch (UnSupportedFillTypeException ignore) {
+ // Don't fill and ignore unsupported fill type exception
record.addField(null);
+ unsupportedFillMethod[index] = true;
+ logger.info("Linear fill doesn't support the " + index + "-th column in SQL.");
}
} else {
record.addField(null);
@@ -266,9 +276,11 @@ public class GroupByFillDataSet extends GroupByEngineDataSet {
filledPair = ((ValueFill) fill).getSpecifiedFillResult(resultDataType[index]);
}
record.addField(filledPair.getValue().getValue(), resultDataType[index]);
- } catch (NumberFormatException ne) {
+ } catch (NumberFormatException ignore) {
// Don't fill and ignore type convert exception
record.addField(null);
+ unsupportedFillMethod[index] = true;
+ logger.info("Value fill doesn't support the " + index + "-th column in SQL.");
} catch (QueryProcessException | StorageEngineException e) {
throw new IOException(e);
}
diff --git a/server/src/main/java/org/apache/iotdb/db/query/executor/FillQueryExecutor.java b/server/src/main/java/org/apache/iotdb/db/query/executor/FillQueryExecutor.java
index 9f17547..bcef343 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/executor/FillQueryExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/executor/FillQueryExecutor.java
@@ -46,6 +46,9 @@ import org.apache.iotdb.tsfile.read.filter.factory.FilterFactory;
import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
import org.apache.iotdb.tsfile.utils.Pair;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import javax.activation.UnsupportedDataTypeException;
import java.io.IOException;
@@ -56,6 +59,8 @@ import java.util.Set;
public class FillQueryExecutor {
+ private static final Logger logger = LoggerFactory.getLogger(FillQueryExecutor.class);
+
protected FillQueryPlan plan;
protected List<PartialPath> selectedSeries;
protected List<TSDataType> dataTypes;
@@ -108,6 +113,15 @@ public class FillQueryExecutor {
IFill fill = fillExecutors[i];
+ if (fill instanceof LinearFill
+ && (dataType == TSDataType.VECTOR
+ || dataType == TSDataType.BOOLEAN
+ || dataType == TSDataType.TEXT)) {
+ record.addField(null);
+ logger.info("Linear fill doesn't support the " + i + "-th column in SQL.");
+ continue;
+ }
+
TimeValuePair timeValuePair;
try {
timeValuePair = fill.getFillResult();
@@ -116,6 +130,7 @@ public class FillQueryExecutor {
}
} catch (QueryProcessException | NumberFormatException ignored) {
record.addField(null);
+ logger.info("Value fill doesn't support the " + i + "-th column in SQL.");
continue;
}
if (timeValuePair == null || timeValuePair.getValue() == null) {