MCPcopy Create free account
hub / github.com/alibaba/graph-learn / _common_construct_source

Method _common_construct_source

graphlearn/python/graph.py:896–923  ·  view source on GitHub ↗

Construct pywrap.Source

(self, source, path, decoder, option=None)

Source from the content-addressed store, hash-verified

894 return source
895
896 def _common_construct_source(self, source, path, decoder, option=None):
897 """Construct pywrap.Source
898 """
899 source.path = path
900 source.format = decoder.data_format
901 if option:
902 source.option = option
903 else:
904 source.option = pywrap.IndexOption()
905 source.option.name = "sort"
906
907 if decoder.attributed:
908 source.attr_info.delimiter = decoder.attr_delimiter
909 for t in decoder.attr_types:
910 type_str, bucket_size, is_multival = decoder.parse(t)
911 if is_multival:
912 source.attr_info.append_hash_bucket(0)
913 elif bucket_size is not None:
914 source.attr_info.append_hash_bucket(bucket_size)
915 else:
916 source.attr_info.append_hash_bucket(0)
917
918 if type_str == "int":
919 source.attr_info.append_type(pywrap.DataType.INT64)
920 elif type_str == "float":
921 source.attr_info.append_type(pywrap.DataType.FLOAT)
922 else:
923 source.attr_info.append_type(pywrap.DataType.STRING)
924
925 def lookup_nodes(self, node_type, ids):
926 """ Get the attributes of given nodes.

Callers 2

Calls 2

IndexOptionMethod · 0.80
parseMethod · 0.80

Tested by

no test coverage detected