PHILO-HE commented on code in PR #4833:
URL: https://github.com/apache/incubator-gluten/pull/4833#discussion_r1529999690


##########
cpp/velox/substrait/VeloxSubstraitSignature.cc:
##########
@@ -159,16 +151,43 @@ TypePtr 
VeloxSubstraitSignature::fromSubstraitSignature(const std::string& signa
         }
       }
       types.emplace_back(fromSubstraitSignature(typeStr));
-      names.emplace_back("");
       childrenTypes.erase(0, endPos + delimiter.length());
     }
     if (childrenTypes.size() > 0 && !startWith(childrenTypes, ">")) {
       types.emplace_back(fromSubstraitSignature(childrenTypes));
-      names.emplace_back("");
+    }
+    return types;
+  };
+
+  if (startWith(signature, "dec")) {
+    // Decimal type name is in the format of dec<precision,scale>.
+    auto precisionStart = signature.find_first_of('<');
+    auto tokenIndex = signature.find_first_of(',');
+    auto scaleEnd = signature.find_first_of('>');
+    auto precision = stoi(signature.substr(precisionStart + 1, (tokenIndex - 
precisionStart - 1)));
+    auto scale = stoi(signature.substr(tokenIndex + 1, (scaleEnd - tokenIndex 
- 1)));
+    return DECIMAL(precision, scale);
+  }
+
+  if (startWith(signature, "struct")) {
+    // Struct type name is in the format of struct<T1,T2,...,Tn>.
+    auto types = parseNestedTypeSignature(signature);
+    std::vector<std::string> names(types.size());
+    for (int i = 0; i < types.size(); i++) {
+      names[i] = "";
     }
     return std::make_shared<RowType>(std::move(names), std::move(types));
   }
 
+  if (startWith(signature, "map")) {
+    // Map type name is in the format of map<T1,T2>.
+    auto types = parseNestedTypeSignature(signature);
+    if (types.size() != 2) {
+      VELOX_UNSUPPORTED("Substrait type signature conversion to Velox type not 
supported for {}.", signature);
+    }
+    return MAP(std::move(types)[0], std::move(types)[1]);
+  }
+
   if (startWith(signature, "list")) {
     auto listStart = signature.find_first_of('<');

Review Comment:
   @WangGuangxin, it seems we can also use `parseNestedTypeSignature` to handle 
list type. Right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to