Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

import static org.apache.iotdb.ainode.utils.AINodeTestUtils.BUILTIN_MODEL_MAP;
import static org.apache.iotdb.ainode.utils.AINodeTestUtils.checkHeader;
import static org.apache.iotdb.ainode.utils.AINodeTestUtils.errorTest;
import static org.apache.iotdb.ainode.utils.AINodeTestUtils.prepareDataInTree;

@RunWith(IoTDBTestRunner.class)
Expand Down Expand Up @@ -72,6 +73,7 @@ public void callInferenceTest() throws SQLException {
Statement statement = connection.createStatement()) {
callInferenceTest(statement, modelInfo);
callInferenceByDefaultTest(statement, modelInfo);
callInferenceErrorTest(statement, modelInfo);
}
}
}
Expand Down Expand Up @@ -118,4 +120,16 @@ public static void callInferenceByDefaultTest(
}
}
}

public static void callInferenceErrorTest(
Statement statement, AINodeTestUtils.FakeModelInfo modelInfo) {
String multiVariateSQL =
String.format(
"CALL INFERENCE(%s, \"SELECT s0,s1 FROM root.AI LIMIT 128\", generateTime=true, outputLength=10)",
modelInfo.getModelId());
errorTest(
statement,
multiVariateSQL,
"701: Call inference function should not contain more than one input column, found [2] input columns.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.iotdb.commons.client.exception.ClientManagerException;
import org.apache.iotdb.db.exception.ainode.AINodeConnectionException;
import org.apache.iotdb.db.exception.runtime.ModelInferenceProcessException;
import org.apache.iotdb.db.exception.sql.SemanticException;
import org.apache.iotdb.db.protocol.client.an.AINodeClient;
import org.apache.iotdb.db.protocol.client.an.AINodeClientManager;
import org.apache.iotdb.db.queryengine.execution.MemoryEstimationHelper;
Expand Down Expand Up @@ -225,6 +226,12 @@ private void appendTsBlockToBuilder(TsBlock inputTsBlock) {
maxTimestamp = Math.max(maxTimestamp, timestamp);
}
timeColumnBuilder.writeLong(timestamp);
if (inputTsBlock.getValueColumnCount() > 1) {
throw new SemanticException(
String.format(
"Call inference function should not contain more than one input column, found [%d] input columns.",
inputTsBlock.getValueColumnCount()));
}
for (int columnIndex = 0; columnIndex < inputTsBlock.getValueColumnCount(); columnIndex++) {
columnBuilders[columnIndexes[columnIndex]].write(inputTsBlock.getColumn(columnIndex), i);
}
Expand Down
Loading