class GpuScalar extends AutoCloseable
The wrapper of a Scala value and its corresponding cudf Scalar, along with its DataType.
This class is introduced because many expressions require both the cudf Scalar and its corresponding Scala value to complete their computations. e.g. 'GpuStringSplit', 'GpuStringLocate', 'GpuDivide', 'GpuDateAddInterval', 'GpuTimeMath' ... So only either a cudf Scalar or a Scala value can not support such cases, unless copying data between the host and the device each time being asked for.
This GpuScalar can be created from either a cudf Scalar or a Scala value. By initializing the cudf Scalar or the Scala value lazily and caching them after being created, it can reduce the unnecessary data copies.
If a GpuScalar is created from a Scala value and is used only on the host side, there will be no data copy and no cudf Scalar created. And if it is used on the device side, only need to copy data to the device once to create a cudf Scalar.
Similarly, if a GpuScalar is created from a cudf Scalar, no need to copy data to the host if it is used only on the device side (This is the ideal case we like, since all is on the GPU). And only need to copy the data to the host once if it is used on the host side.
So a GpuScalar will have at most one data copy but support all the cases. No round-trip happens.
Another reason why storing the Scala value in addition to the cudf Scalar is
GpuDateAddInterval and 'GpuTimeMath' have different algorithms with the 3 members of
a CalendarInterval, which can not be supported by a single cudf Scalar now.
Do not create a GpuScalar from the constructor, instead call the factory APIs above.
- Alphabetic
- By Inheritance
- GpuScalar
- AutoCloseable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
close(): Unit
- Definition Classes
- GpuScalar → AutoCloseable
- val dataType: DataType
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
getBase: Scalar
Gets the internal cudf Scalar of this GpuScalar.
Gets the internal cudf Scalar of this GpuScalar.
This will not increase any reference count. So users need to close either the GpuScalar or the return cudf Scalar, not both.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getValue: Any
Gets the internal Scala value of this GpuScalar.
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
incRefCount: GpuScalar.this.type
Increment the reference count for this scalar.
Increment the reference count for this scalar. You need to call close on this to decrement the reference count again.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isNan: Boolean
Whether the GpuScalar is Nan.
Whether the GpuScalar is Nan. It works only for float and double types, otherwise an exception will be raised.
-
def
isNotNan: Boolean
Whether the GpuScalar is not a Nan.
Whether the GpuScalar is not a Nan. It works only for float and double types, otherwise an exception will be raised.
-
def
isValid: Boolean
GpuScalar is valid when the Scala value is not null if it is defined, or the cudf Scalar is valid if the Scala value is not defined.
GpuScalar is valid when the Scala value is not null if it is defined, or the cudf Scalar is valid if the Scala value is not defined. Because a cudf Scalar created from a null is invalid.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- GpuScalar → AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()