Class InsertNode
- java.lang.Object
-
- org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNode
-
- org.apache.iotdb.db.mpp.plan.planner.plan.node.WritePlanNode
-
- org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertNode
-
- All Implemented Interfaces:
org.apache.iotdb.consensus.common.request.IConsensusRequest,IPartitionRelatedNode
- Direct Known Subclasses:
InsertMultiTabletsNode,InsertRowNode,InsertRowsNode,InsertRowsOfOneDeviceNode,InsertTabletNode
public abstract class InsertNode extends WritePlanNode
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classInsertNode.FailedMeasurementInfo
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.iotdb.common.rpc.thrift.TRegionReplicaSetdataRegionReplicaSetPhysical address of data region after splittingprotected org.apache.iotdb.tsfile.file.metadata.enums.TSDataType[]dataTypesprotected IDeviceIDdeviceIDdevice id reference, for reuse device id in both id table and memtable
used in memtableprotected org.apache.iotdb.commons.path.PartialPathdevicePathif use id table, this filed is id form of device path
if not, this filed is device pathprotected java.util.Map<java.lang.Integer,InsertNode.FailedMeasurementInfo>failedMeasurementIndex2Infoindex of failed measurements -> info including measurement, data type and valueprotected booleanisAlignedprotected java.lang.String[]measurementsprotected org.apache.iotdb.tsfile.write.schema.MeasurementSchema[]measurementSchemasstatic longNO_CONSENSUS_INDEXthis insert node doesn't need to participate in multi-leader consensusprotected longsearchIndexthis index is used by wal search, its order should be protected by the upper layer, and the value should start from 1-
Fields inherited from class org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNode
CHILD_COUNT_NO_LIMIT, NO_CHILD_ALLOWED, ONE_CHILD
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInsertNode(PlanNodeId id)protectedInsertNode(PlanNodeId id, org.apache.iotdb.commons.path.PartialPath devicePath, boolean isAligned, java.lang.String[] measurements, org.apache.iotdb.tsfile.file.metadata.enums.TSDataType[] dataTypes)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voiddeserializeMeasurementSchemas(java.io.DataInputStream stream)Deserialize measurement schemas.protected voiddeserializeMeasurementSchemas(java.nio.ByteBuffer buffer)booleanequals(java.lang.Object o)org.apache.iotdb.common.rpc.thrift.TRegionReplicaSetgetDataRegionReplicaSet()org.apache.iotdb.tsfile.file.metadata.enums.TSDataTypegetDataType(int index)org.apache.iotdb.tsfile.file.metadata.enums.TSDataType[]getDataTypes()IDeviceIDgetDeviceID()org.apache.iotdb.commons.path.PartialPathgetDevicePath()java.util.List<java.lang.Exception>getFailedExceptions()intgetFailedMeasurementNumber()java.util.List<java.lang.String>getFailedMeasurements()java.util.List<java.lang.String>getFailedMessages()abstract java.lang.ObjectgetFirstValueOfIndex(int index)java.lang.String[]getMeasurements()org.apache.iotdb.tsfile.write.schema.MeasurementSchema[]getMeasurementSchemas()abstract longgetMinTime()org.apache.iotdb.common.rpc.thrift.TRegionReplicaSetgetRegionReplicaSet()longgetSearchIndex()booleanhasFailedMeasurements()inthashCode()booleanhasValidMeasurements()booleanisAligned()voidmarkFailedMeasurement(int index, java.lang.Exception cause)Mark failed measurement, measurements[index], dataTypes[index] and values/columns[index] would be null.protected booleanselfCheckDataTypes()Check whether data types are matched with measurement schemasprotected voidserializeAttributes(java.io.DataOutputStream stream)protected voidserializeAttributes(java.nio.ByteBuffer byteBuffer)protected intserializeMeasurementSchemasSize()Serialized size of measurement schemas, ignoring failed time seriesprotected voidserializeMeasurementSchemasToWAL(IWALByteBufferView buffer)Serialize measurement schemas, ignoring failed time seriesvoidsetAligned(boolean aligned)voidsetDataRegionReplicaSet(org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet dataRegionReplicaSet)voidsetDataTypes(org.apache.iotdb.tsfile.file.metadata.enums.TSDataType[] dataTypes)voidsetDeviceID(IDeviceID deviceID)voidsetDevicePath(org.apache.iotdb.commons.path.PartialPath devicePath)voidsetMeasurementSchemas(org.apache.iotdb.tsfile.write.schema.MeasurementSchema[] measurementSchemas)voidsetSearchIndex(long searchIndex)Search index should start from 1abstract booleanvalidateAndSetSchema(ISchemaTree schemaTree)-
Methods inherited from class org.apache.iotdb.db.mpp.plan.planner.plan.node.WritePlanNode
splitByPartition
-
Methods inherited from class org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNode
accept, addChild, allowedChildCount, clone, cloneWithChildren, getChildren, getOutputColumnNames, getPlanNodeId, serialize, serialize, serializeToByteBuffer, setPlanNodeId
-
-
-
-
Field Detail
-
NO_CONSENSUS_INDEX
public static final long NO_CONSENSUS_INDEX
this insert node doesn't need to participate in multi-leader consensus- See Also:
- Constant Field Values
-
devicePath
protected org.apache.iotdb.commons.path.PartialPath devicePath
if use id table, this filed is id form of device path
if not, this filed is device path
-
isAligned
protected boolean isAligned
-
measurementSchemas
protected org.apache.iotdb.tsfile.write.schema.MeasurementSchema[] measurementSchemas
-
measurements
protected java.lang.String[] measurements
-
dataTypes
protected org.apache.iotdb.tsfile.file.metadata.enums.TSDataType[] dataTypes
-
failedMeasurementIndex2Info
protected java.util.Map<java.lang.Integer,InsertNode.FailedMeasurementInfo> failedMeasurementIndex2Info
index of failed measurements -> info including measurement, data type and value
-
deviceID
protected IDeviceID deviceID
device id reference, for reuse device id in both id table and memtable
used in memtable
-
searchIndex
protected long searchIndex
this index is used by wal search, its order should be protected by the upper layer, and the value should start from 1
-
dataRegionReplicaSet
protected org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet dataRegionReplicaSet
Physical address of data region after splitting
-
-
Constructor Detail
-
InsertNode
protected InsertNode(PlanNodeId id)
-
InsertNode
protected InsertNode(PlanNodeId id, org.apache.iotdb.commons.path.PartialPath devicePath, boolean isAligned, java.lang.String[] measurements, org.apache.iotdb.tsfile.file.metadata.enums.TSDataType[] dataTypes)
-
-
Method Detail
-
getDataRegionReplicaSet
public org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet getDataRegionReplicaSet()
-
setDataRegionReplicaSet
public void setDataRegionReplicaSet(org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet dataRegionReplicaSet)
-
getDevicePath
public org.apache.iotdb.commons.path.PartialPath getDevicePath()
-
setDevicePath
public void setDevicePath(org.apache.iotdb.commons.path.PartialPath devicePath)
-
isAligned
public boolean isAligned()
-
setAligned
public void setAligned(boolean aligned)
-
getMeasurementSchemas
public org.apache.iotdb.tsfile.write.schema.MeasurementSchema[] getMeasurementSchemas()
-
setMeasurementSchemas
public void setMeasurementSchemas(org.apache.iotdb.tsfile.write.schema.MeasurementSchema[] measurementSchemas)
-
getMeasurements
public java.lang.String[] getMeasurements()
-
getDataTypes
public org.apache.iotdb.tsfile.file.metadata.enums.TSDataType[] getDataTypes()
-
getDataType
public org.apache.iotdb.tsfile.file.metadata.enums.TSDataType getDataType(int index)
-
setDataTypes
public void setDataTypes(org.apache.iotdb.tsfile.file.metadata.enums.TSDataType[] dataTypes)
-
getDeviceID
public IDeviceID getDeviceID()
-
setDeviceID
public void setDeviceID(IDeviceID deviceID)
-
getSearchIndex
public long getSearchIndex()
-
setSearchIndex
public void setSearchIndex(long searchIndex)
Search index should start from 1
-
serializeAttributes
protected void serializeAttributes(java.nio.ByteBuffer byteBuffer)
- Specified by:
serializeAttributesin classPlanNode
-
serializeAttributes
protected void serializeAttributes(java.io.DataOutputStream stream) throws java.io.IOException- Specified by:
serializeAttributesin classPlanNode- Throws:
java.io.IOException
-
serializeMeasurementSchemasSize
protected int serializeMeasurementSchemasSize()
Serialized size of measurement schemas, ignoring failed time series
-
serializeMeasurementSchemasToWAL
protected void serializeMeasurementSchemasToWAL(IWALByteBufferView buffer)
Serialize measurement schemas, ignoring failed time series
-
deserializeMeasurementSchemas
protected void deserializeMeasurementSchemas(java.io.DataInputStream stream) throws java.io.IOExceptionDeserialize measurement schemas. Make sure the measurement schemas and measurements have been created before calling this- Throws:
java.io.IOException
-
deserializeMeasurementSchemas
protected void deserializeMeasurementSchemas(java.nio.ByteBuffer buffer)
-
getRegionReplicaSet
public org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet getRegionReplicaSet()
-
validateAndSetSchema
public abstract boolean validateAndSetSchema(ISchemaTree schemaTree)
-
selfCheckDataTypes
protected boolean selfCheckDataTypes()
Check whether data types are matched with measurement schemas
-
getMinTime
public abstract long getMinTime()
-
getFirstValueOfIndex
public abstract java.lang.Object getFirstValueOfIndex(int index)
-
markFailedMeasurement
public void markFailedMeasurement(int index, java.lang.Exception cause)Mark failed measurement, measurements[index], dataTypes[index] and values/columns[index] would be null. We'd better use "measurements[index] == null" to determine if the measurement failed.
This method is not concurrency-safe.- Parameters:
index- failed measurement indexcause- cause Exception of failure
-
hasValidMeasurements
public boolean hasValidMeasurements()
-
hasFailedMeasurements
public boolean hasFailedMeasurements()
-
getFailedMeasurementNumber
public int getFailedMeasurementNumber()
-
getFailedMeasurements
public java.util.List<java.lang.String> getFailedMeasurements()
-
getFailedExceptions
public java.util.List<java.lang.Exception> getFailedExceptions()
-
getFailedMessages
public java.util.List<java.lang.String> getFailedMessages()
-
-