Skip to content
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

Pipe: Fix the problem that the receiver constructs InsertStatement causing the MeasurementShcema to not be correctly set to null (NPE) #14831

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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 @@ -84,6 +84,9 @@ public Statement visitPlan(final PlanNode node, final Void context) {

@Override
public InsertRowStatement visitInsertRow(final InsertRowNode node, final Void context) {
// MeasurementSchema is only allowed to be set at the analysis type stage. However, InsertNode
// has already set MeasurementSchema at the sending end. If the statement constructed this time
// calls SetMeasurementSchema, it will cause NPE
final InsertRowStatement statement = new InsertRowStatement();
statement.setDevicePath(node.getTargetPath());
statement.setTime(node.getTime());
Expand All @@ -92,20 +95,29 @@ public InsertRowStatement visitInsertRow(final InsertRowNode node, final Void co
statement.setValues(node.getValues());
statement.setNeedInferType(node.isNeedInferType());
statement.setAligned(node.isAligned());
statement.setMeasurementSchemas(node.getMeasurementSchemas());
statement.setColumnCategories(node.getColumnCategories());
return statement;
}

@Override
public Statement visitRelationalInsertTablet(
final RelationalInsertTabletNode node, final Void context) {
return new InsertTabletStatement(node);
final InsertTabletStatement insertTabletStatement = new InsertTabletStatement(node);
// MeasurementSchema is only allowed to be set at the analysis type stage. However, InsertNode
// has already set MeasurementSchema at the sending end. If the statement constructed this time
// calls SetMeasurementSchema, it will cause NPE
insertTabletStatement.setMeasurementSchemas(null);
return insertTabletStatement;
}

@Override
public InsertTabletStatement visitInsertTablet(final InsertTabletNode node, final Void context) {
return new InsertTabletStatement(node);
final InsertTabletStatement insertTabletStatement = new InsertTabletStatement(node);
// MeasurementSchema is only allowed to be set at the analysis type stage. However, InsertNode
// has already set MeasurementSchema at the sending end. If the statement constructed this time
// calls SetMeasurementSchema, it will cause NPE
insertTabletStatement.setMeasurementSchemas(null);
return insertTabletStatement;
}

@Override
Expand Down
Loading