You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/02/02 13:29:29 UTC
[GitHub] [beam] ilya-kozyrev commented on a change in pull request #16700: [BEAM-13790][Playground] Change logic of receiving examples from the bucket on backend side
ilya-kozyrev commented on a change in pull request #16700:
URL: https://github.com/apache/beam/pull/16700#discussion_r797605462
##########
File path: playground/backend/internal/cloud_bucket/precompiled_objects.go
##########
@@ -164,6 +180,10 @@ func (cd *CloudStorage) GetPrecompiledObjects(ctx context.Context, targetSdk pb.
logger.Errorf("json.Unmarshal: %v", err.Error())
continue
}
+
+ folderName := strings.Split(objectDir, string(os.PathSeparator))[1]
+ precompiledObject.Type = getObjectTypeByFolderName(folderName)
Review comment:
```suggestion
precompiledObject.Type = pb.PrecompiledObjectType(pb.PrecompiledObjectType_value[folderName])
```
##########
File path: playground/backend/internal/cloud_bucket/precompiled_objects.go
##########
@@ -266,6 +286,20 @@ func getFileExtensionBySdk(precompiledObjectPath string) (string, error) {
return extension, nil
}
+// getObjectTypeByFolderName returns pb.PrecompiledObjectType by folder name
+func getObjectTypeByFolderName(folderName string) pb.PrecompiledObjectType {
+ switch folderName {
+ case "PRECOMPILED_OBJECT_TYPE_EXAMPLE":
+ return pb.PrecompiledObjectType_PRECOMPILED_OBJECT_TYPE_EXAMPLE
+ case "PRECOMPILED_OBJECT_TYPE_KATA":
+ return pb.PrecompiledObjectType_PRECOMPILED_OBJECT_TYPE_KATA
+ case "PRECOMPILED_OBJECT_TYPE_UNIT_TEST":
+ return pb.PrecompiledObjectType_PRECOMPILED_OBJECT_TYPE_UNIT_TEST
+ default:
+ return pb.PrecompiledObjectType_PRECOMPILED_OBJECT_TYPE_UNSPECIFIED
+ }
+}
+
Review comment:
This function redundant
```suggestion
```
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org