Example #1
0
    def schema(self):
        """KeyTable schema.

        **Example:** print the key table columns / signatures
        >>> print(kt.schema)

        :rtype: :class:`.TStruct`
        """
        if self._schema is None:
            self._schema = Type._from_java(self._jkt.signature())
            assert (isinstance(self._schema, TStruct))
        return self._schema
Example #2
0
    def eval_expr_typed(self, expr):
        """Evaluate an expression and return the result as well as its type.

        :param str expr: Expression to evaluate.

        :rtype: (annotation, :class:`.Type`)

        """

        x = self._jhc.eval(expr)
        t = Type._from_java(x._2())
        v = t._convert_to_py(x._1())
        return (v, t)
Example #3
0
    def schema(self):
        """KeyTable schema.

        **Example:** print the key table columns / signatures

        >>> print(kt1.schema)
        Struct {
            ID: Int,
            HT: Int,
            SEX: String,
            X: Int,
            Z: Int,
            C1: Int,
            C2: Int,
            C3: Int
        }

        :rtype: :class:`.TStruct`
        """

        if self._schema is None:
            self._schema = Type._from_java(self._jkt.signature())
            assert (isinstance(self._schema, TStruct))
        return self._schema