11/* SPDX-License-Identifier: Apache-2.0 */
22#include " substrait/textplan/SymbolTable.h"
33
4+ #include < algorithm>
45#include < any>
56#include < iomanip>
67#include < map>
@@ -27,7 +28,7 @@ const std::string& symbolTypeName(SymbolType type) {
2728 " kSourceDetail" ,
2829 " kField" ,
2930 };
30- auto typeNum = int32_t (type);
31+ auto typeNum = static_cast < int32_t > (type);
3132 if (typeNum == -1 ) {
3233 static std::string unknown = " kUnknown" ;
3334 return unknown;
@@ -136,9 +137,7 @@ void SymbolTable::setParentQueryLocation(
136137 int highestIndex = -1 ;
137138 for (const auto & sym : symbols_) {
138139 if (sym->parentQueryLocation == location) {
139- if (sym->parentQueryIndex > highestIndex) {
140- highestIndex = sym->parentQueryIndex ;
141- }
140+ highestIndex = std::max (sym->parentQueryIndex , highestIndex);
142141 }
143142 }
144143 symbols_[index]->parentQueryIndex = highestIndex + 1 ;
@@ -236,7 +235,7 @@ std::string SymbolTable::toDebugString() const {
236235 if (!relationData->subQueryPipelines .empty ()) {
237236 result << " SQC=" << relationData->subQueryPipelines .size ();
238237 }
239- result << std::endl ;
238+ result << ' \n ' ;
240239
241240 int32_t fieldNum = 0 ;
242241 for (const auto & field : relationData->fieldReferences ) {
@@ -248,7 +247,7 @@ std::string SymbolTable::toDebugString() const {
248247 if (!field->alias .empty ()) {
249248 result << " " << field->alias ;
250249 }
251- result << std::endl ;
250+ result << ' \n ' ;
252251 }
253252
254253 for (const auto & field : relationData->generatedFieldReferences ) {
@@ -266,7 +265,7 @@ std::string SymbolTable::toDebugString() const {
266265 } else if (!field->alias .empty ()) {
267266 result << " " << field->alias ;
268267 }
269- result << std::endl ;
268+ result << ' \n ' ;
270269 }
271270
272271 int32_t outputFieldNum = 0 ;
@@ -279,12 +278,12 @@ std::string SymbolTable::toDebugString() const {
279278 if (!field->alias .empty ()) {
280279 result << " " << field->alias ;
281280 }
282- result << std::endl ;
281+ result << ' \n ' ;
283282 }
284283 textAlreadyWritten = true ;
285284 }
286285 if (textAlreadyWritten) {
287- result << std::endl ;
286+ result << ' \n ' ;
288287 }
289288 return result.str ();
290289}
0 commit comments