@@ -179,22 +179,13 @@ private boolean alterTimeSeriesDataType(final ConfigNodeProcedureEnv env) {
179179 env .getConfigManager ().getRelatedSchemaRegionGroup (patternTree , false ),
180180 false ,
181181 CnToDnAsyncRequestType .ALTER_TIMESERIES_DATATYPE ,
182- ((dataNodeLocation , consensusGroupIdList ) -> {
183- ByteBuffer measurementPathBuffer = null ;
184- try (ByteArrayOutputStream baos = new ByteArrayOutputStream ()) {
185- measurementPath .serialize (baos );
186- measurementPathBuffer = ByteBuffer .wrap (baos .toByteArray ());
187- } catch (IOException ignored ) {
188- // ByteArrayOutputStream won't throw IOException
189- }
190-
191- return new TAlterTimeSeriesReq (
192- consensusGroupIdList ,
193- queryId ,
194- measurementPathBuffer ,
195- operationType ,
196- ByteBuffer .wrap (stream .toByteArray ()));
197- })) {
182+ ((dataNodeLocation , consensusGroupIdList ) ->
183+ new TAlterTimeSeriesReq (
184+ consensusGroupIdList ,
185+ queryId ,
186+ measurementPathBytes ,
187+ operationType ,
188+ prepareDataTypeBytesData ()))) {
198189
199190 @ Override
200191 protected List <TConsensusGroupId > processResponseOfOneDataNode (
@@ -210,13 +201,11 @@ protected List<TConsensusGroupId> processResponseOfOneDataNode(
210201 if (response .getCode () == TSStatusCode .MULTIPLE_ERROR .getStatusCode ()) {
211202 final List <TSStatus > subStatus = response .getSubStatus ();
212203 for (int i = 0 ; i < subStatus .size (); i ++) {
213- if (subStatus .get (i ).getCode () != TSStatusCode .SUCCESS_STATUS .getStatusCode ()
214- && !(subStatus .get (i ).getCode ()
215- == TSStatusCode .PATH_NOT_EXIST .getStatusCode ())) {
204+ if (subStatus .get (i ).getCode () != TSStatusCode .SUCCESS_STATUS .getStatusCode ()) {
216205 failedRegionList .add (consensusGroupIdList .get (i ));
217206 }
218207 }
219- } else if (!( response . getCode () == TSStatusCode . PATH_NOT_EXIST . getStatusCode ())) {
208+ } else {
220209 failedRegionList .addAll (consensusGroupIdList );
221210 }
222211 if (!failedRegionList .isEmpty ()) {
@@ -331,7 +320,7 @@ public MeasurementPath getmeasurementPath() {
331320
332321 public void setMeasurementPath (final MeasurementPath measurementPath ) {
333322 this .measurementPath = measurementPath ;
334- measurementPathBytes = prepareMeasurementPathBytesData (measurementPath );
323+ this . measurementPathBytes = prepareMeasurementPathBytesData (measurementPath );
335324 }
336325
337326 public static ByteBuffer prepareMeasurementPathBytesData (final MeasurementPath measurementPath ) {
@@ -356,6 +345,16 @@ public static ByteBuffer preparePatternTreeBytesData(final PathPatternTree patte
356345 return ByteBuffer .wrap (byteArrayOutputStream .toByteArray ());
357346 }
358347
348+ public ByteBuffer prepareDataTypeBytesData () {
349+ final ByteArrayOutputStream stream = new ByteArrayOutputStream (1 );
350+ try {
351+ ReadWriteIOUtils .write (dataType , stream );
352+ } catch (final IOException ignored ) {
353+ // ByteArrayOutputStream won't throw IOException
354+ }
355+ return ByteBuffer .wrap (stream .toByteArray ());
356+ }
357+
359358 @ Override
360359 public void serialize (final DataOutputStream stream ) throws IOException {
361360 stream .writeShort (
0 commit comments