graphar_pyspark.enums
Enumerations and constants.
1# Licensed to the Apache Software Foundation (ASF) under one 2# or more contributor license agreements. See the NOTICE file 3# distributed with this work for additional information 4# regarding copyright ownership. The ASF licenses this file 5# to you under the Apache License, Version 2.0 (the 6# "License"); you may not use this file except in compliance 7# with the License. You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, 12# software distributed under the License is distributed on an 13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14# KIND, either express or implied. See the License for the 15# specific language governing permissions and limitations 16# under the License. 17 18"""Enumerations and constants.""" 19 20from enum import Enum 21 22from py4j.java_gateway import JavaObject 23 24from graphar_pyspark import GraphArSession, _check_session 25 26 27class GarType(Enum): 28 """Main data type in gar enumeration.""" 29 30 BOOL = "bool" 31 INT32 = "int32" 32 INT64 = "int64" 33 FLOAT = "float" 34 DOUBLE = "double" 35 STRING = "string" 36 LIST = "list" 37 38 @staticmethod 39 def from_scala(jvm_obj: JavaObject) -> "GarType": 40 """Create an instance of the Class from the corresponding JVM object. 41 42 :param jvm_obj: scala object in JVM. 43 :returns: instance of Python Class. 44 """ 45 _check_session() 46 return GarType(GraphArSession.graphar.GarType.GarTypeToString(jvm_obj)) 47 48 def to_scala(self) -> JavaObject: 49 """Transform object to JVM representation. 50 51 :returns: JavaObject 52 """ 53 _check_session() 54 return GraphArSession.graphar.GarType.StringToGarType(self.value) 55 56 57class FileType(Enum): 58 """Type of file format.""" 59 60 CSV = "csv" 61 JSON = "json" 62 PARQUET = "parquet" 63 ORC = "orc" 64 65 @staticmethod 66 def from_scala(jvm_obj: JavaObject) -> "FileType": 67 """Create an instance of the Class from the corresponding JVM object. 68 69 :param jvm_obj: scala object in JVM. 70 :returns: instance of Python Class. 71 """ 72 _check_session() 73 return FileType(GraphArSession.graphar.FileType.FileTypeToString(jvm_obj)) 74 75 def to_scala(self) -> JavaObject: 76 """Transform object to JVM representation. 77 78 :returns: JavaObject 79 """ 80 _check_session() 81 return GraphArSession.graphar.FileType.StringToFileType(self.value) 82 83 84class AdjListType(Enum): 85 """Adj list type enumeration for adjacency list of graph.""" 86 87 UNORDERED_BY_SOURCE = "unordered_by_source" 88 UNORDERED_BY_DEST = "unordered_by_dest" 89 ORDERED_BY_SOURCE = "ordered_by_source" 90 ORDERED_BY_DEST = "ordered_by_dest" 91 92 @staticmethod 93 def from_scala(jvm_obj: JavaObject) -> "AdjListType": 94 """Create an instance of the Class from the corresponding JVM object. 95 96 :param jvm_obj: scala object in JVM. 97 :returns: instance of Python Class. 98 """ 99 _check_session() 100 return AdjListType( 101 GraphArSession.graphar.AdjListType.AdjListTypeToString(jvm_obj), 102 ) 103 104 def to_scala(self) -> JavaObject: 105 """Transform object to JVM representation. 106 107 :returns: JavaObject 108 """ 109 _check_session() 110 return GraphArSession.graphar.AdjListType.StringToAdjListType(self.value)
class
GarType(enum.Enum):
28class GarType(Enum): 29 """Main data type in gar enumeration.""" 30 31 BOOL = "bool" 32 INT32 = "int32" 33 INT64 = "int64" 34 FLOAT = "float" 35 DOUBLE = "double" 36 STRING = "string" 37 LIST = "list" 38 39 @staticmethod 40 def from_scala(jvm_obj: JavaObject) -> "GarType": 41 """Create an instance of the Class from the corresponding JVM object. 42 43 :param jvm_obj: scala object in JVM. 44 :returns: instance of Python Class. 45 """ 46 _check_session() 47 return GarType(GraphArSession.graphar.GarType.GarTypeToString(jvm_obj)) 48 49 def to_scala(self) -> JavaObject: 50 """Transform object to JVM representation. 51 52 :returns: JavaObject 53 """ 54 _check_session() 55 return GraphArSession.graphar.GarType.StringToGarType(self.value)
Main data type in gar enumeration.
BOOL =
<GarType.BOOL: 'bool'>
INT32 =
<GarType.INT32: 'int32'>
INT64 =
<GarType.INT64: 'int64'>
FLOAT =
<GarType.FLOAT: 'float'>
DOUBLE =
<GarType.DOUBLE: 'double'>
STRING =
<GarType.STRING: 'string'>
LIST =
<GarType.LIST: 'list'>
39 @staticmethod 40 def from_scala(jvm_obj: JavaObject) -> "GarType": 41 """Create an instance of the Class from the corresponding JVM object. 42 43 :param jvm_obj: scala object in JVM. 44 :returns: instance of Python Class. 45 """ 46 _check_session() 47 return GarType(GraphArSession.graphar.GarType.GarTypeToString(jvm_obj))
Create an instance of the Class from the corresponding JVM object.
Parameters
- jvm_obj: scala object in JVM. :returns: instance of Python Class.
def
to_scala(self) -> py4j.java_gateway.JavaObject:
49 def to_scala(self) -> JavaObject: 50 """Transform object to JVM representation. 51 52 :returns: JavaObject 53 """ 54 _check_session() 55 return GraphArSession.graphar.GarType.StringToGarType(self.value)
Transform object to JVM representation.
:returns: JavaObject
Inherited Members
- enum.Enum
- name
- value
class
FileType(enum.Enum):
58class FileType(Enum): 59 """Type of file format.""" 60 61 CSV = "csv" 62 JSON = "json" 63 PARQUET = "parquet" 64 ORC = "orc" 65 66 @staticmethod 67 def from_scala(jvm_obj: JavaObject) -> "FileType": 68 """Create an instance of the Class from the corresponding JVM object. 69 70 :param jvm_obj: scala object in JVM. 71 :returns: instance of Python Class. 72 """ 73 _check_session() 74 return FileType(GraphArSession.graphar.FileType.FileTypeToString(jvm_obj)) 75 76 def to_scala(self) -> JavaObject: 77 """Transform object to JVM representation. 78 79 :returns: JavaObject 80 """ 81 _check_session() 82 return GraphArSession.graphar.FileType.StringToFileType(self.value)
Type of file format.
CSV =
<FileType.CSV: 'csv'>
JSON =
<FileType.JSON: 'json'>
PARQUET =
<FileType.PARQUET: 'parquet'>
ORC =
<FileType.ORC: 'orc'>
66 @staticmethod 67 def from_scala(jvm_obj: JavaObject) -> "FileType": 68 """Create an instance of the Class from the corresponding JVM object. 69 70 :param jvm_obj: scala object in JVM. 71 :returns: instance of Python Class. 72 """ 73 _check_session() 74 return FileType(GraphArSession.graphar.FileType.FileTypeToString(jvm_obj))
Create an instance of the Class from the corresponding JVM object.
Parameters
- jvm_obj: scala object in JVM. :returns: instance of Python Class.
def
to_scala(self) -> py4j.java_gateway.JavaObject:
76 def to_scala(self) -> JavaObject: 77 """Transform object to JVM representation. 78 79 :returns: JavaObject 80 """ 81 _check_session() 82 return GraphArSession.graphar.FileType.StringToFileType(self.value)
Transform object to JVM representation.
:returns: JavaObject
Inherited Members
- enum.Enum
- name
- value
class
AdjListType(enum.Enum):
85class AdjListType(Enum): 86 """Adj list type enumeration for adjacency list of graph.""" 87 88 UNORDERED_BY_SOURCE = "unordered_by_source" 89 UNORDERED_BY_DEST = "unordered_by_dest" 90 ORDERED_BY_SOURCE = "ordered_by_source" 91 ORDERED_BY_DEST = "ordered_by_dest" 92 93 @staticmethod 94 def from_scala(jvm_obj: JavaObject) -> "AdjListType": 95 """Create an instance of the Class from the corresponding JVM object. 96 97 :param jvm_obj: scala object in JVM. 98 :returns: instance of Python Class. 99 """ 100 _check_session() 101 return AdjListType( 102 GraphArSession.graphar.AdjListType.AdjListTypeToString(jvm_obj), 103 ) 104 105 def to_scala(self) -> JavaObject: 106 """Transform object to JVM representation. 107 108 :returns: JavaObject 109 """ 110 _check_session() 111 return GraphArSession.graphar.AdjListType.StringToAdjListType(self.value)
Adj list type enumeration for adjacency list of graph.
UNORDERED_BY_SOURCE =
<AdjListType.UNORDERED_BY_SOURCE: 'unordered_by_source'>
UNORDERED_BY_DEST =
<AdjListType.UNORDERED_BY_DEST: 'unordered_by_dest'>
ORDERED_BY_SOURCE =
<AdjListType.ORDERED_BY_SOURCE: 'ordered_by_source'>
ORDERED_BY_DEST =
<AdjListType.ORDERED_BY_DEST: 'ordered_by_dest'>
93 @staticmethod 94 def from_scala(jvm_obj: JavaObject) -> "AdjListType": 95 """Create an instance of the Class from the corresponding JVM object. 96 97 :param jvm_obj: scala object in JVM. 98 :returns: instance of Python Class. 99 """ 100 _check_session() 101 return AdjListType( 102 GraphArSession.graphar.AdjListType.AdjListTypeToString(jvm_obj), 103 )
Create an instance of the Class from the corresponding JVM object.
Parameters
- jvm_obj: scala object in JVM. :returns: instance of Python Class.
def
to_scala(self) -> py4j.java_gateway.JavaObject:
105 def to_scala(self) -> JavaObject: 106 """Transform object to JVM representation. 107 108 :returns: JavaObject 109 """ 110 _check_session() 111 return GraphArSession.graphar.AdjListType.StringToAdjListType(self.value)
Transform object to JVM representation.
:returns: JavaObject
Inherited Members
- enum.Enum
- name
- value