From dda5b69c74e6894d66a707708cdeb693b6d9dd00 Mon Sep 17 00:00:00 2001 From: "R. C. Howell" Date: Tue, 30 Apr 2024 16:13:57 -0700 Subject: [PATCH] Initializes 'beam' for type and plan serde --- partiql-types/api/partiql-types.api | 642 ++++++++++++++++++ .../kotlin/org/partiql/beam/BeamStatic.kt | 174 +++++ .../main/kotlin/org/partiql/beam/README.adoc | 25 + .../main/kotlin/org/partiql/beam/beam.ridl | 113 +++ .../main/kotlin/org/partiql/beam/io/Beam.kt | 420 ++++++++++++ .../kotlin/org/partiql/beam/io/BeamReader.kt | 414 +++++++++++ .../kotlin/org/partiql/beam/io/BeamWriter.kt | 603 ++++++++++++++++ .../org/partiql/beam/io/runtime/Ridl.kt | 14 + .../org/partiql/beam/io/runtime/RidlReader.kt | 17 + .../org/partiql/beam/io/runtime/RidlWriter.kt | 7 + 10 files changed, 2429 insertions(+) create mode 100644 partiql-types/src/main/kotlin/org/partiql/beam/BeamStatic.kt create mode 100644 partiql-types/src/main/kotlin/org/partiql/beam/README.adoc create mode 100644 partiql-types/src/main/kotlin/org/partiql/beam/beam.ridl create mode 100644 partiql-types/src/main/kotlin/org/partiql/beam/io/Beam.kt create mode 100644 partiql-types/src/main/kotlin/org/partiql/beam/io/BeamReader.kt create mode 100644 partiql-types/src/main/kotlin/org/partiql/beam/io/BeamWriter.kt create mode 100644 partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/Ridl.kt create mode 100644 partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/RidlReader.kt create mode 100644 partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/RidlWriter.kt diff --git a/partiql-types/api/partiql-types.api b/partiql-types/api/partiql-types.api index 5df16b7fd3..e74f81216c 100644 --- a/partiql-types/api/partiql-types.api +++ b/partiql-types/api/partiql-types.api @@ -1,3 +1,645 @@ +public final class org/partiql/beam/BeamStaticKt { + public static final fun beam (Lorg/partiql/types/StaticType;)Lorg/partiql/beam/io/Beam$Shape; +} + +public final class org/partiql/beam/io/Beam { + public static final field Companion Lorg/partiql/beam/io/Beam$Companion; + public static final fun toString (Lorg/partiql/beam/io/Beam$$Serializable;)Ljava/lang/String; +} + +public abstract interface class org/partiql/beam/io/Beam$$Serializable { + public abstract fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public abstract fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Companion { + public final fun toString (Lorg/partiql/beam/io/Beam$$Serializable;)Ljava/lang/String; +} + +public final class org/partiql/beam/io/Beam$Field : org/partiql/beam/io/Beam$$Serializable { + public field name Ljava/lang/String; + public field shape Lorg/partiql/beam/io/Beam$Shape; + public fun (Ljava/lang/String;Lorg/partiql/beam/io/Beam$Shape;)V + public final fun component1 ()Ljava/lang/String; + public final fun component2 ()Lorg/partiql/beam/io/Beam$Shape; + public final fun copy (Ljava/lang/String;Lorg/partiql/beam/io/Beam$Shape;)Lorg/partiql/beam/io/Beam$Field; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Field;Ljava/lang/String;Lorg/partiql/beam/io/Beam$Shape;ILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Field; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Field; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Fields : org/partiql/beam/io/runtime/RidlList, org/partiql/beam/io/Beam$$Serializable { + public fun (Ljava/util/ArrayList;)V + public final fun contains (Ljava/lang/Object;)Z + public fun contains (Lorg/partiql/beam/io/Beam$Field;)Z + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Fields; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public abstract interface class org/partiql/beam/io/Beam$Shape : org/partiql/beam/io/Beam$$Serializable { + public abstract fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public abstract fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$DefaultImpls { + public static fun read (Lorg/partiql/beam/io/Beam$Shape;Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public static fun write (Lorg/partiql/beam/io/Beam$Shape;Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TBag : org/partiql/beam/io/Beam$Shape { + public field items Lorg/partiql/beam/io/Beam$Shape; + public fun (Lorg/partiql/beam/io/Beam$Shape;)V + public final fun component1 ()Lorg/partiql/beam/io/Beam$Shape; + public final fun copy (Lorg/partiql/beam/io/Beam$Shape;)Lorg/partiql/beam/io/Beam$Shape$TBag; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TBag;Lorg/partiql/beam/io/Beam$Shape;ILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TBag; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TBag; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TBinary : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TBinary; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TBinary; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TBitFixed : org/partiql/beam/io/Beam$Shape { + public field length J + public fun (J)V + public final fun component1 ()J + public final fun copy (J)Lorg/partiql/beam/io/Beam$Shape$TBitFixed; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TBitFixed;JILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TBitFixed; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TBitFixed; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TBitVarying : org/partiql/beam/io/Beam$Shape { + public field length J + public fun (J)V + public final fun component1 ()J + public final fun copy (J)Lorg/partiql/beam/io/Beam$Shape$TBitVarying; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TBitVarying;JILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TBitVarying; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TBitVarying; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TBlob : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TBlob; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TBlob; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TBool : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TBool; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TBool; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TByteFixed : org/partiql/beam/io/Beam$Shape { + public field length J + public fun (J)V + public final fun component1 ()J + public final fun copy (J)Lorg/partiql/beam/io/Beam$Shape$TByteFixed; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TByteFixed;JILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TByteFixed; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TByteFixed; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TByteVarying : org/partiql/beam/io/Beam$Shape { + public field length J + public fun (J)V + public final fun component1 ()J + public final fun copy (J)Lorg/partiql/beam/io/Beam$Shape$TByteVarying; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TByteVarying;JILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TByteVarying; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TByteVarying; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TCharFixed : org/partiql/beam/io/Beam$Shape { + public field length J + public fun (J)V + public final fun component1 ()J + public final fun copy (J)Lorg/partiql/beam/io/Beam$Shape$TCharFixed; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TCharFixed;JILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TCharFixed; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TCharFixed; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TCharVarying : org/partiql/beam/io/Beam$Shape { + public field length J + public fun (J)V + public final fun component1 ()J + public final fun copy (J)Lorg/partiql/beam/io/Beam$Shape$TCharVarying; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TCharVarying;JILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TCharVarying; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TCharVarying; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TClob : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TClob; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TClob; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TDate : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TDate; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TDate; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TDecimal : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TDecimal; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TDecimal; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TDynamic : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TDynamic; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TDynamic; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TFloat : org/partiql/beam/io/Beam$Shape { + public field precision J + public fun (J)V + public final fun component1 ()J + public final fun copy (J)Lorg/partiql/beam/io/Beam$Shape$TFloat; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TFloat;JILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TFloat; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TFloat; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TFloat32 : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TFloat32; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TFloat32; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TFloat64 : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TFloat64; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TFloat64; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TInt16 : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TInt16; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TInt16; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TInt32 : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TInt32; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TInt32; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TInt64 : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TInt64; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TInt64; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TInt8 : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TInt8; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TInt8; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TInteger : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TInteger; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TInteger; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TList : org/partiql/beam/io/Beam$Shape { + public field items Lorg/partiql/beam/io/Beam$Shape; + public fun (Lorg/partiql/beam/io/Beam$Shape;)V + public final fun component1 ()Lorg/partiql/beam/io/Beam$Shape; + public final fun copy (Lorg/partiql/beam/io/Beam$Shape;)Lorg/partiql/beam/io/Beam$Shape$TList; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TList;Lorg/partiql/beam/io/Beam$Shape;ILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TList; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TList; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TMissing : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TMissing; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TMissing; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TNull : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TNull; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TNull; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TNumeric : org/partiql/beam/io/Beam$Shape { + public field precision J + public field scale J + public fun (JJ)V + public final fun component1 ()J + public final fun component2 ()J + public final fun copy (JJ)Lorg/partiql/beam/io/Beam$Shape$TNumeric; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TNumeric;JJILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TNumeric; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TNumeric; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TSexp : org/partiql/beam/io/Beam$Shape { + public field items Lorg/partiql/beam/io/Beam$Shape; + public fun (Lorg/partiql/beam/io/Beam$Shape;)V + public final fun component1 ()Lorg/partiql/beam/io/Beam$Shape; + public final fun copy (Lorg/partiql/beam/io/Beam$Shape;)Lorg/partiql/beam/io/Beam$Shape$TSexp; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TSexp;Lorg/partiql/beam/io/Beam$Shape;ILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TSexp; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TSexp; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TString : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TString; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TString; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TStruct : org/partiql/beam/io/Beam$Shape { + public field fields Lorg/partiql/beam/io/Beam$Fields; + public field hasUniqueFields Z + public field isClosed Z + public field isOrdered Z + public fun (Lorg/partiql/beam/io/Beam$Fields;ZZZ)V + public final fun component1 ()Lorg/partiql/beam/io/Beam$Fields; + public final fun component2 ()Z + public final fun component3 ()Z + public final fun component4 ()Z + public final fun copy (Lorg/partiql/beam/io/Beam$Fields;ZZZ)Lorg/partiql/beam/io/Beam$Shape$TStruct; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TStruct;Lorg/partiql/beam/io/Beam$Fields;ZZZILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TStruct; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TStruct; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TSymbol : org/partiql/beam/io/Beam$Shape { + public static final field INSTANCE Lorg/partiql/beam/io/Beam$Shape$TSymbol; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TSymbol; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TTime : org/partiql/beam/io/Beam$Shape { + public field precision J + public fun (J)V + public final fun component1 ()J + public final fun copy (J)Lorg/partiql/beam/io/Beam$Shape$TTime; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TTime;JILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TTime; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TTime; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TTimeTz : org/partiql/beam/io/Beam$Shape { + public field offsetHour J + public field offsetMinute J + public field precision J + public fun (JJJ)V + public final fun component1 ()J + public final fun component2 ()J + public final fun component3 ()J + public final fun copy (JJJ)Lorg/partiql/beam/io/Beam$Shape$TTimeTz; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TTimeTz;JJJILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TTimeTz; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TTimeTz; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TTimestamp : org/partiql/beam/io/Beam$Shape { + public field precision J + public fun (J)V + public final fun component1 ()J + public final fun copy (J)Lorg/partiql/beam/io/Beam$Shape$TTimestamp; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TTimestamp;JILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TTimestamp; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TTimestamp; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TTimestampTz : org/partiql/beam/io/Beam$Shape { + public field offsetHour J + public field offsetMinute J + public field precision J + public fun (JJJ)V + public final fun component1 ()J + public final fun component2 ()J + public final fun component3 ()J + public final fun copy (JJJ)Lorg/partiql/beam/io/Beam$Shape$TTimestampTz; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TTimestampTz;JJJILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TTimestampTz; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TTimestampTz; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shape$TUnion : org/partiql/beam/io/Beam$Shape { + public field shapes Lorg/partiql/beam/io/Beam$Shapes; + public fun (Lorg/partiql/beam/io/Beam$Shapes;)V + public final fun component1 ()Lorg/partiql/beam/io/Beam$Shapes; + public final fun copy (Lorg/partiql/beam/io/Beam$Shapes;)Lorg/partiql/beam/io/Beam$Shape$TUnion; + public static synthetic fun copy$default (Lorg/partiql/beam/io/Beam$Shape$TUnion;Lorg/partiql/beam/io/Beam$Shapes;ILjava/lang/Object;)Lorg/partiql/beam/io/Beam$Shape$TUnion; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape$TUnion; + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shape; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public final class org/partiql/beam/io/Beam$Shapes : org/partiql/beam/io/runtime/RidlList, org/partiql/beam/io/Beam$$Serializable { + public fun (Ljava/util/ArrayList;)V + public final fun contains (Ljava/lang/Object;)Z + public fun contains (Lorg/partiql/beam/io/Beam$Shape;)Z + public synthetic fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$$Serializable; + public fun read (Lorg/partiql/beam/io/BeamReader;)Lorg/partiql/beam/io/Beam$Shapes; + public fun toString ()Ljava/lang/String; + public fun write (Lorg/partiql/beam/io/BeamWriter;)V +} + +public abstract class org/partiql/beam/io/BeamReader : org/partiql/beam/io/runtime/RidlReader { + public static final field Companion Lorg/partiql/beam/io/BeamReader$Companion; + public fun (Lcom/amazon/ion/IonReader;)V + public static final fun packed (Lcom/amazon/ion/IonReader;)Lorg/partiql/beam/io/BeamReader; + public final fun read (Lorg/partiql/beam/io/Beam$$Serializable;)Lorg/partiql/beam/io/Beam$$Serializable; + public abstract fun readField ()Lorg/partiql/beam/io/Beam$Field; + public abstract fun readFields ()Lorg/partiql/beam/io/Beam$Fields; + public abstract fun readShape ()Lorg/partiql/beam/io/Beam$Shape; + public abstract fun readShapeTBag ()Lorg/partiql/beam/io/Beam$Shape$TBag; + public abstract fun readShapeTBinary ()Lorg/partiql/beam/io/Beam$Shape$TBinary; + public abstract fun readShapeTBitFixed ()Lorg/partiql/beam/io/Beam$Shape$TBitFixed; + public abstract fun readShapeTBitVarying ()Lorg/partiql/beam/io/Beam$Shape$TBitVarying; + public abstract fun readShapeTBlob ()Lorg/partiql/beam/io/Beam$Shape$TBlob; + public abstract fun readShapeTBool ()Lorg/partiql/beam/io/Beam$Shape$TBool; + public abstract fun readShapeTByteFixed ()Lorg/partiql/beam/io/Beam$Shape$TByteFixed; + public abstract fun readShapeTByteVarying ()Lorg/partiql/beam/io/Beam$Shape$TByteVarying; + public abstract fun readShapeTCharFixed ()Lorg/partiql/beam/io/Beam$Shape$TCharFixed; + public abstract fun readShapeTCharVarying ()Lorg/partiql/beam/io/Beam$Shape$TCharVarying; + public abstract fun readShapeTClob ()Lorg/partiql/beam/io/Beam$Shape$TClob; + public abstract fun readShapeTDate ()Lorg/partiql/beam/io/Beam$Shape$TDate; + public abstract fun readShapeTDecimal ()Lorg/partiql/beam/io/Beam$Shape$TDecimal; + public abstract fun readShapeTDynamic ()Lorg/partiql/beam/io/Beam$Shape$TDynamic; + public abstract fun readShapeTFloat ()Lorg/partiql/beam/io/Beam$Shape$TFloat; + public abstract fun readShapeTFloat32 ()Lorg/partiql/beam/io/Beam$Shape$TFloat32; + public abstract fun readShapeTFloat64 ()Lorg/partiql/beam/io/Beam$Shape$TFloat64; + public abstract fun readShapeTInt16 ()Lorg/partiql/beam/io/Beam$Shape$TInt16; + public abstract fun readShapeTInt32 ()Lorg/partiql/beam/io/Beam$Shape$TInt32; + public abstract fun readShapeTInt64 ()Lorg/partiql/beam/io/Beam$Shape$TInt64; + public abstract fun readShapeTInt8 ()Lorg/partiql/beam/io/Beam$Shape$TInt8; + public abstract fun readShapeTInteger ()Lorg/partiql/beam/io/Beam$Shape$TInteger; + public abstract fun readShapeTList ()Lorg/partiql/beam/io/Beam$Shape$TList; + public abstract fun readShapeTMissing ()Lorg/partiql/beam/io/Beam$Shape$TMissing; + public abstract fun readShapeTNull ()Lorg/partiql/beam/io/Beam$Shape$TNull; + public abstract fun readShapeTNumeric ()Lorg/partiql/beam/io/Beam$Shape$TNumeric; + public abstract fun readShapeTSexp ()Lorg/partiql/beam/io/Beam$Shape$TSexp; + public abstract fun readShapeTString ()Lorg/partiql/beam/io/Beam$Shape$TString; + public abstract fun readShapeTStruct ()Lorg/partiql/beam/io/Beam$Shape$TStruct; + public abstract fun readShapeTSymbol ()Lorg/partiql/beam/io/Beam$Shape$TSymbol; + public abstract fun readShapeTTime ()Lorg/partiql/beam/io/Beam$Shape$TTime; + public abstract fun readShapeTTimeTz ()Lorg/partiql/beam/io/Beam$Shape$TTimeTz; + public abstract fun readShapeTTimestamp ()Lorg/partiql/beam/io/Beam$Shape$TTimestamp; + public abstract fun readShapeTTimestampTz ()Lorg/partiql/beam/io/Beam$Shape$TTimestampTz; + public abstract fun readShapeTUnion ()Lorg/partiql/beam/io/Beam$Shape$TUnion; + public abstract fun readShapes ()Lorg/partiql/beam/io/Beam$Shapes; + public static final fun text (Lcom/amazon/ion/IonReader;)Lorg/partiql/beam/io/BeamReader; +} + +public final class org/partiql/beam/io/BeamReader$Companion { + public final fun packed (Lcom/amazon/ion/IonReader;)Lorg/partiql/beam/io/BeamReader; + public final fun text (Lcom/amazon/ion/IonReader;)Lorg/partiql/beam/io/BeamReader; +} + +public abstract class org/partiql/beam/io/BeamWriter : org/partiql/beam/io/runtime/RidlWriter { + public static final field Companion Lorg/partiql/beam/io/BeamWriter$Companion; + public fun (Lcom/amazon/ion/IonWriter;)V + public static final fun packed (Lcom/amazon/ion/IonWriter;)Lorg/partiql/beam/io/BeamWriter; + public static final fun packed (Ljava/io/OutputStream;)Lorg/partiql/beam/io/BeamWriter; + public static final fun text (Lcom/amazon/ion/IonWriter;)Lorg/partiql/beam/io/BeamWriter; + public static final fun text (Ljava/lang/Appendable;)Lorg/partiql/beam/io/BeamWriter; + public final fun write (Lorg/partiql/beam/io/Beam$$Serializable;)V + public abstract fun writeField (Lorg/partiql/beam/io/Beam$Field;)V + public abstract fun writeFields (Lorg/partiql/beam/io/Beam$Fields;)V + public abstract fun writeShape (Lorg/partiql/beam/io/Beam$Shape;)V + public abstract fun writeShapeTBag (Lorg/partiql/beam/io/Beam$Shape$TBag;)V + public abstract fun writeShapeTBinary (Lorg/partiql/beam/io/Beam$Shape$TBinary;)V + public abstract fun writeShapeTBitFixed (Lorg/partiql/beam/io/Beam$Shape$TBitFixed;)V + public abstract fun writeShapeTBitVarying (Lorg/partiql/beam/io/Beam$Shape$TBitVarying;)V + public abstract fun writeShapeTBlob (Lorg/partiql/beam/io/Beam$Shape$TBlob;)V + public abstract fun writeShapeTBool (Lorg/partiql/beam/io/Beam$Shape$TBool;)V + public abstract fun writeShapeTByteFixed (Lorg/partiql/beam/io/Beam$Shape$TByteFixed;)V + public abstract fun writeShapeTByteVarying (Lorg/partiql/beam/io/Beam$Shape$TByteVarying;)V + public abstract fun writeShapeTCharFixed (Lorg/partiql/beam/io/Beam$Shape$TCharFixed;)V + public abstract fun writeShapeTCharVarying (Lorg/partiql/beam/io/Beam$Shape$TCharVarying;)V + public abstract fun writeShapeTClob (Lorg/partiql/beam/io/Beam$Shape$TClob;)V + public abstract fun writeShapeTDate (Lorg/partiql/beam/io/Beam$Shape$TDate;)V + public abstract fun writeShapeTDecimal (Lorg/partiql/beam/io/Beam$Shape$TDecimal;)V + public abstract fun writeShapeTDynamic (Lorg/partiql/beam/io/Beam$Shape$TDynamic;)V + public abstract fun writeShapeTFloat (Lorg/partiql/beam/io/Beam$Shape$TFloat;)V + public abstract fun writeShapeTFloat32 (Lorg/partiql/beam/io/Beam$Shape$TFloat32;)V + public abstract fun writeShapeTFloat64 (Lorg/partiql/beam/io/Beam$Shape$TFloat64;)V + public abstract fun writeShapeTInt16 (Lorg/partiql/beam/io/Beam$Shape$TInt16;)V + public abstract fun writeShapeTInt32 (Lorg/partiql/beam/io/Beam$Shape$TInt32;)V + public abstract fun writeShapeTInt64 (Lorg/partiql/beam/io/Beam$Shape$TInt64;)V + public abstract fun writeShapeTInt8 (Lorg/partiql/beam/io/Beam$Shape$TInt8;)V + public abstract fun writeShapeTInteger (Lorg/partiql/beam/io/Beam$Shape$TInteger;)V + public abstract fun writeShapeTList (Lorg/partiql/beam/io/Beam$Shape$TList;)V + public abstract fun writeShapeTMissing (Lorg/partiql/beam/io/Beam$Shape$TMissing;)V + public abstract fun writeShapeTNull (Lorg/partiql/beam/io/Beam$Shape$TNull;)V + public abstract fun writeShapeTNumeric (Lorg/partiql/beam/io/Beam$Shape$TNumeric;)V + public abstract fun writeShapeTSexp (Lorg/partiql/beam/io/Beam$Shape$TSexp;)V + public abstract fun writeShapeTString (Lorg/partiql/beam/io/Beam$Shape$TString;)V + public abstract fun writeShapeTStruct (Lorg/partiql/beam/io/Beam$Shape$TStruct;)V + public abstract fun writeShapeTSymbol (Lorg/partiql/beam/io/Beam$Shape$TSymbol;)V + public abstract fun writeShapeTTime (Lorg/partiql/beam/io/Beam$Shape$TTime;)V + public abstract fun writeShapeTTimeTz (Lorg/partiql/beam/io/Beam$Shape$TTimeTz;)V + public abstract fun writeShapeTTimestamp (Lorg/partiql/beam/io/Beam$Shape$TTimestamp;)V + public abstract fun writeShapeTTimestampTz (Lorg/partiql/beam/io/Beam$Shape$TTimestampTz;)V + public abstract fun writeShapeTUnion (Lorg/partiql/beam/io/Beam$Shape$TUnion;)V + public abstract fun writeShapes (Lorg/partiql/beam/io/Beam$Shapes;)V +} + +public final class org/partiql/beam/io/BeamWriter$Companion { + public final fun packed (Lcom/amazon/ion/IonWriter;)Lorg/partiql/beam/io/BeamWriter; + public final fun packed (Ljava/io/OutputStream;)Lorg/partiql/beam/io/BeamWriter; + public final fun text (Lcom/amazon/ion/IonWriter;)Lorg/partiql/beam/io/BeamWriter; + public final fun text (Ljava/lang/Appendable;)Lorg/partiql/beam/io/BeamWriter; +} + +public abstract class org/partiql/beam/io/runtime/RidlArray { + public fun ([Ljava/lang/Object;)V + public final fun get (I)Ljava/lang/Object; + public final fun getSize ()I + public final fun iterator ()Ljava/util/Iterator; + public final fun set (ILjava/lang/Object;)V +} + +public abstract class org/partiql/beam/io/runtime/RidlList : java/util/Collection, kotlin/jvm/internal/markers/KMappedMarker { + public fun (Ljava/util/ArrayList;)V + public fun add (Ljava/lang/Object;)Z + public fun addAll (Ljava/util/Collection;)Z + public fun clear ()V + public fun contains (Ljava/lang/Object;)Z + public fun containsAll (Ljava/util/Collection;)Z + public fun getSize ()I + public fun isEmpty ()Z + public fun iterator ()Ljava/util/Iterator; + public fun remove (Ljava/lang/Object;)Z + public fun removeAll (Ljava/util/Collection;)Z + public fun removeIf (Ljava/util/function/Predicate;)Z + public fun retainAll (Ljava/util/Collection;)Z + public final fun size ()I + public fun toArray ()[Ljava/lang/Object; + public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object; +} + +public abstract class org/partiql/beam/io/runtime/RidlReader { + public fun (Lcom/amazon/ion/IonReader;)V + public final fun assertKey (Ljava/lang/String;)V + public final fun assertTag (Lcom/amazon/ion/IonType;Ljava/lang/String;)V +} + +public abstract class org/partiql/beam/io/runtime/RidlWriter { + public fun (Lcom/amazon/ion/IonWriter;)V +} + public final class org/partiql/errors/CardinalityViolation : java/lang/RuntimeException { public fun ()V public fun fillInStackTrace ()Ljava/lang/Throwable; diff --git a/partiql-types/src/main/kotlin/org/partiql/beam/BeamStatic.kt b/partiql-types/src/main/kotlin/org/partiql/beam/BeamStatic.kt new file mode 100644 index 0000000000..16a1368448 --- /dev/null +++ b/partiql-types/src/main/kotlin/org/partiql/beam/BeamStatic.kt @@ -0,0 +1,174 @@ +package org.partiql.beam + +import org.partiql.beam.io.Beam +import org.partiql.types.AnyOfType +import org.partiql.types.AnyType +import org.partiql.types.BagType +import org.partiql.types.BlobType +import org.partiql.types.BoolType +import org.partiql.types.ClobType +import org.partiql.types.DateType +import org.partiql.types.DecimalType +import org.partiql.types.FloatType +import org.partiql.types.IntType +import org.partiql.types.ListType +import org.partiql.types.MissingType +import org.partiql.types.NullType +import org.partiql.types.NumberConstraint +import org.partiql.types.SexpType +import org.partiql.types.StaticType +import org.partiql.types.StringType +import org.partiql.types.StructType +import org.partiql.types.SymbolType +import org.partiql.types.TimeType +import org.partiql.types.TimestampType +import org.partiql.types.TupleConstraint +import org.partiql.value.PartiQLTimestampExperimental + +/** + * Convert a static type to a Beam Shape for serde purposes. + */ +public fun StaticType.beam(): Beam.Shape = when (this) { + is AnyOfType -> beam() + is AnyType -> Beam.Shape.TDynamic + is BlobType -> Beam.Shape.TBlob + is BoolType -> Beam.Shape.TBool + is ClobType -> Beam.Shape.TClob + is BagType -> beam() + is ListType -> beam() + is SexpType -> beam() + is DateType -> Beam.Shape.TDate + is DecimalType -> beam() + is FloatType -> beam() + is IntType -> beam() + MissingType -> Beam.Shape.TMissing + is NullType -> Beam.Shape.TNull + is StringType -> beam() + is StructType -> beam() + is SymbolType -> Beam.Shape.TSymbol + is TimeType -> beam() + is TimestampType -> beam() + else -> error("unsupported type $this") // graph +} + +private fun AnyOfType.beam(): Beam.Shape.TUnion { + val shapes = ArrayList() + // create some predictable ordering + val sorted = this.types.sortedWith { t1, t2 -> t1::class.java.simpleName.compareTo(t2::class.java.simpleName) } + for (type in sorted) { + shapes.add(type.beam()) + } + return Beam.Shape.TUnion(Beam.Shapes(shapes)) +} + +private fun BagType.beam(): Beam.Shape.TBag { + return Beam.Shape.TBag(this.elementType.beam()) +} + +private fun ListType.beam(): Beam.Shape.TList { + return Beam.Shape.TList(this.elementType.beam()) +} + +private fun SexpType.beam(): Beam.Shape.TSexp { + return Beam.Shape.TSexp(this.elementType.beam()) +} + +private fun DecimalType.beam(): Beam.Shape { + return when (precisionScaleConstraint) { + is DecimalType.PrecisionScaleConstraint.Unconstrained -> { + Beam.Shape.TDecimal + } + is DecimalType.PrecisionScaleConstraint.Constrained -> { + val p = precisionScaleConstraint.precision.toLong() + val s = precisionScaleConstraint.scale.toLong() + Beam.Shape.TNumeric(p, s) + } + } +} + +private fun FloatType.beam(): Beam.Shape { + // StaticType does not have float constraints. + return Beam.Shape.TFloat64 +} + +private fun IntType.beam(): Beam.Shape { + return when (this.rangeConstraint) { + IntType.IntRangeConstraint.SHORT -> Beam.Shape.TInt16 + IntType.IntRangeConstraint.INT4 -> Beam.Shape.TInt32 + IntType.IntRangeConstraint.LONG -> Beam.Shape.TInt64 + IntType.IntRangeConstraint.UNCONSTRAINED -> Beam.Shape.TInteger + } +} + +private fun StringType.beam(): Beam.Shape { + return when (lengthConstraint) { + is StringType.StringLengthConstraint.Constrained -> { + when (lengthConstraint.length) { + is NumberConstraint.Equals -> Beam.Shape.TCharFixed(lengthConstraint.length.value.toLong()) + is NumberConstraint.UpTo -> Beam.Shape.TCharVarying(lengthConstraint.length.value.toLong()) + } + } + is StringType.StringLengthConstraint.Unconstrained -> Beam.Shape.TString + } +} + +private fun StructType.beam(): Beam.Shape.TStruct { + var isClosed = false + var isOrdered = false + var hasUniqueKeys = false + var fields = ArrayList() + for (field in this.fields) { + fields.add( + Beam.Field( + name = field.key, + shape = field.value.beam(), + ) + ) + } + for (constraint in constraints) { + when (constraint) { + is TupleConstraint.Open -> isClosed = true + is TupleConstraint.Ordered -> isOrdered = true + is TupleConstraint.UniqueAttrs -> hasUniqueKeys = true + } + } + return Beam.Shape.TStruct( + isClosed = isClosed, + isOrdered = isOrdered, + hasUniqueFields = hasUniqueKeys, + fields = Beam.Fields(fields), + ) +} + +private fun TimeType.beam(): Beam.Shape { + if (precision == null) { + error("Time precision is required") + } + return when (withTimeZone) { + true -> Beam.Shape.TTime( + precision = precision.toLong(), + ) + else -> Beam.Shape.TTimeTz( + precision = precision.toLong(), + offsetHour = 0L, + offsetMinute = 0L, + ) + } +} + +@OptIn(PartiQLTimestampExperimental::class) +private fun TimestampType.beam(): Beam.Shape { + if (precision == null) { + error("Time precision is required") + } + return when (withTimeZone) { + true -> Beam.Shape.TTime( + precision = precision.toLong(), + ) + else -> Beam.Shape.TTimeTz( + precision = precision.toLong(), + offsetHour = 0L, + offsetMinute = 0L, + ) + } +} diff --git a/partiql-types/src/main/kotlin/org/partiql/beam/README.adoc b/partiql-types/src/main/kotlin/org/partiql/beam/README.adoc new file mode 100644 index 0000000000..ebfd2a3dbc --- /dev/null +++ b/partiql-types/src/main/kotlin/org/partiql/beam/README.adoc @@ -0,0 +1,25 @@ += PartiQL Beam + +PartiQL shape and plan encodings. + +== Usage + +[source,kotlin] +---- +// toString +val example = Shape.TNumeric(38, 0) +println(example) +// Output: +// 'shape.numeric'::{ +// precision: 38, +// scale: 0 +// } + +// write +val writer = BeamWriter.text(out) +writer.write(example) // base +writer.writeShapeTNumeric(example) // concrete + +// read +// similar to writer, ignore for now +---- \ No newline at end of file diff --git a/partiql-types/src/main/kotlin/org/partiql/beam/beam.ridl b/partiql-types/src/main/kotlin/org/partiql/beam/beam.ridl new file mode 100644 index 0000000000..1a98a64ef3 --- /dev/null +++ b/partiql-types/src/main/kotlin/org/partiql/beam/beam.ridl @@ -0,0 +1,113 @@ +// PartiQL Shapes +type shape union { + + // Bool type + t_bool: unit, + + // Exact-numeric types + t_int8: unit, + t_int16: unit, + t_int32: unit, + t_int64: unit, + t_integer: unit, // Ion int + t_decimal: unit, // Ion decimal + t_numeric: struct { + precision: int, + scale: int, + }, + + // Approximate-numeric types + t_float32: unit, + t_float64: unit, + t_float: struct { precision: int }, + + // Character String Shapes + t_char_fixed: struct { + length: int, + }, + t_char_varying: struct { + length: int, + }, + t_string: unit, + t_symbol: unit, + t_clob: unit, + + // Bit String Shapes + t_bit_fixed: struct { + length: int, + }, + t_bit_varying: struct { + length: int, + }, + + // Byte String Shapes + t_binary: unit, + t_byte_fixed: struct { + length: int, + }, + t_byte_varying: struct { + length: int, + }, + t_blob: unit, + + // Date/Time Shapes + t_date: unit, + t_time: struct { + precision: int, + }, + t_time_tz: struct { + precision: int, + offset_hour: int, + offset_minute: int, + }, + t_timestamp: struct { + precision: int, + }, + t_timestamp_tz: struct { + precision: int, + offset_hour: int, + offset_minute: int, + }, + + // Collection Shapes + t_bag: struct { + items: shape, + }, + t_list: struct { + items: shape, + }, + t_sexp: struct { + items: shape, + }, + + // Struct Shape (currently assuming open/closed/ordered) + t_struct: struct { + fields: fields, + is_closed: bool, + is_ordered: bool, + has_unique_fields: bool, + }, + + // Absent Shapes + t_null: unit, + t_missing: unit, + + // Union Shape + t_union: struct { + shapes: shapes, + }, + + // Dynamic shape + t_dynamic: unit, +}; + +type shapes shape[]; + +type fields field[]; + +type field struct { + name: string, + shape: shape, +}; + +// Plans to follow diff --git a/partiql-types/src/main/kotlin/org/partiql/beam/io/Beam.kt b/partiql-types/src/main/kotlin/org/partiql/beam/io/Beam.kt new file mode 100644 index 0000000000..8f6c064ef7 --- /dev/null +++ b/partiql-types/src/main/kotlin/org/partiql/beam/io/Beam.kt @@ -0,0 +1,420 @@ +package org.partiql.beam.io + +import com.amazon.ion.system.IonTextWriterBuilder +import org.partiql.beam.io.runtime.RidlList + +public class Beam private constructor() { + + public companion object { + + @JvmStatic + public fun toString(value: `$Serializable`): String { + val sb = StringBuilder() + val out = IonTextWriterBuilder.pretty().build(sb) + val writer = BeamWriter.text(out) + value.write(writer) + return sb.toString() + } + } + + public interface `$Serializable` { + + public fun write(writer: BeamWriter) + + public fun read(reader: BeamReader): `$Serializable` + } + + public sealed interface Shape : `$Serializable` { + + override fun write(writer: BeamWriter): Unit = writer.writeShape(this) + + override fun read(reader: BeamReader): Shape = reader.readShape() + + public object TBool : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTBool(this) + + override fun read(reader: BeamReader): TBool = reader.readShapeTBool() + + override fun toString(): String = toString(this) + } + + public object TInt8 : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTInt8(this) + + override fun read(reader: BeamReader): TInt8 = reader.readShapeTInt8() + + override fun toString(): String = toString(this) + } + + public object TInt16 : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTInt16(this) + + override fun read(reader: BeamReader): TInt16 = reader.readShapeTInt16() + + override fun toString(): String = toString(this) + } + + public object TInt32 : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTInt32(this) + + override fun read(reader: BeamReader): TInt32 = reader.readShapeTInt32() + + override fun toString(): String = toString(this) + } + + public object TInt64 : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTInt64(this) + + override fun read(reader: BeamReader): TInt64 = reader.readShapeTInt64() + + override fun toString(): String = toString(this) + } + + public object TInteger : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTInteger(this) + + override fun read(reader: BeamReader): TInteger = reader.readShapeTInteger() + + override fun toString(): String = toString(this) + } + + public object TDecimal : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTDecimal(this) + + override fun read(reader: BeamReader): TDecimal = reader.readShapeTDecimal() + + override fun toString(): String = toString(this) + } + + public data class TNumeric( + @JvmField var precision: Long, + @JvmField var scale: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTNumeric(this) + + override fun read(reader: BeamReader): TNumeric = reader.readShapeTNumeric() + + override fun toString(): String = toString(this) + } + + public object TFloat32 : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTFloat32(this) + + override fun read(reader: BeamReader): TFloat32 = reader.readShapeTFloat32() + + override fun toString(): String = toString(this) + } + + public object TFloat64 : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTFloat64(this) + + override fun read(reader: BeamReader): TFloat64 = reader.readShapeTFloat64() + + override fun toString(): String = toString(this) + } + + public data class TFloat( + @JvmField var precision: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTFloat(this) + + override fun read(reader: BeamReader): TFloat = reader.readShapeTFloat() + + override fun toString(): String = toString(this) + } + + public data class TCharFixed( + @JvmField var length: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTCharFixed(this) + + override fun read(reader: BeamReader): TCharFixed = reader.readShapeTCharFixed() + + override fun toString(): String = toString(this) + } + + public data class TCharVarying( + @JvmField var length: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTCharVarying(this) + + override fun read(reader: BeamReader): TCharVarying = reader.readShapeTCharVarying() + + override fun toString(): String = toString(this) + } + + public object TString : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTString(this) + + override fun read(reader: BeamReader): TString = reader.readShapeTString() + + override fun toString(): String = toString(this) + } + + public object TSymbol : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTSymbol(this) + + override fun read(reader: BeamReader): TSymbol = reader.readShapeTSymbol() + + override fun toString(): String = toString(this) + } + + public object TClob : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTClob(this) + + override fun read(reader: BeamReader): TClob = reader.readShapeTClob() + + override fun toString(): String = toString(this) + } + + public data class TBitFixed( + @JvmField var length: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTBitFixed(this) + + override fun read(reader: BeamReader): TBitFixed = reader.readShapeTBitFixed() + + override fun toString(): String = toString(this) + } + + public data class TBitVarying( + @JvmField var length: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTBitVarying(this) + + override fun read(reader: BeamReader): TBitVarying = reader.readShapeTBitVarying() + + override fun toString(): String = toString(this) + } + + public object TBinary : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTBinary(this) + + override fun read(reader: BeamReader): TBinary = reader.readShapeTBinary() + + override fun toString(): String = toString(this) + } + + public data class TByteFixed( + @JvmField var length: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTByteFixed(this) + + override fun read(reader: BeamReader): TByteFixed = reader.readShapeTByteFixed() + + override fun toString(): String = toString(this) + } + + public data class TByteVarying( + @JvmField var length: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTByteVarying(this) + + override fun read(reader: BeamReader): TByteVarying = reader.readShapeTByteVarying() + + override fun toString(): String = toString(this) + } + + public object TBlob : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTBlob(this) + + override fun read(reader: BeamReader): TBlob = reader.readShapeTBlob() + + override fun toString(): String = toString(this) + } + + public object TDate : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTDate(this) + + override fun read(reader: BeamReader): TDate = reader.readShapeTDate() + + override fun toString(): String = toString(this) + } + + public data class TTime( + @JvmField var precision: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTTime(this) + + override fun read(reader: BeamReader): TTime = reader.readShapeTTime() + + override fun toString(): String = toString(this) + } + + public data class TTimeTz( + @JvmField var precision: Long, + @JvmField var offsetHour: Long, + @JvmField var offsetMinute: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTTimeTz(this) + + override fun read(reader: BeamReader): TTimeTz = reader.readShapeTTimeTz() + + override fun toString(): String = toString(this) + } + + public data class TTimestamp( + @JvmField var precision: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTTimestamp(this) + + override fun read(reader: BeamReader): TTimestamp = reader.readShapeTTimestamp() + + override fun toString(): String = toString(this) + } + + public data class TTimestampTz( + @JvmField var precision: Long, + @JvmField var offsetHour: Long, + @JvmField var offsetMinute: Long, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTTimestampTz(this) + + override fun read(reader: BeamReader): TTimestampTz = reader.readShapeTTimestampTz() + + override fun toString(): String = toString(this) + } + + public data class TBag( + @JvmField var items: Shape, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTBag(this) + + override fun read(reader: BeamReader): TBag = reader.readShapeTBag() + + override fun toString(): String = toString(this) + } + + public data class TList( + @JvmField var items: Shape, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTList(this) + + override fun read(reader: BeamReader): TList = reader.readShapeTList() + + override fun toString(): String = toString(this) + } + + public data class TSexp( + @JvmField var items: Shape, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTSexp(this) + + override fun read(reader: BeamReader): TSexp = reader.readShapeTSexp() + + override fun toString(): String = toString(this) + } + + public data class TStruct( + @JvmField var fields: Fields, + @JvmField var isClosed: Boolean, + @JvmField var isOrdered: Boolean, + @JvmField var hasUniqueFields: Boolean, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTStruct(this) + + override fun read(reader: BeamReader): TStruct = reader.readShapeTStruct() + + override fun toString(): String = toString(this) + } + + public object TNull : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTNull(this) + + override fun read(reader: BeamReader): TNull = reader.readShapeTNull() + + override fun toString(): String = toString(this) + } + + public object TMissing : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTMissing(this) + + override fun read(reader: BeamReader): TMissing = reader.readShapeTMissing() + + override fun toString(): String = toString(this) + } + + public data class TUnion( + @JvmField var shapes: Shapes, + ) : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTUnion(this) + + override fun read(reader: BeamReader): TUnion = reader.readShapeTUnion() + + override fun toString(): String = toString(this) + } + + public object TDynamic : Shape { + + override fun write(writer: BeamWriter): Unit = writer.writeShapeTDynamic(this) + + override fun read(reader: BeamReader): TDynamic = reader.readShapeTDynamic() + + override fun toString(): String = toString(this) + } + } + + public class Shapes(private val items: ArrayList) : RidlList(items), `$Serializable` { + + override fun write(writer: BeamWriter): Unit = writer.writeShapes(this) + + override fun read(reader: BeamReader): Shapes = reader.readShapes() + + override fun toString(): String = toString(this) + } + + public class Fields(private val items: ArrayList) : RidlList(items), `$Serializable` { + + override fun write(writer: BeamWriter): Unit = writer.writeFields(this) + + override fun read(reader: BeamReader): Fields = reader.readFields() + + override fun toString(): String = toString(this) + } + + public data class Field( + @JvmField var name: String, + @JvmField var shape: Shape, + ) : `$Serializable` { + + override fun write(writer: BeamWriter): Unit = writer.writeField(this) + + override fun read(reader: BeamReader): Field = reader.readField() + + override fun toString(): String = toString(this) + } +} diff --git a/partiql-types/src/main/kotlin/org/partiql/beam/io/BeamReader.kt b/partiql-types/src/main/kotlin/org/partiql/beam/io/BeamReader.kt new file mode 100644 index 0000000000..04c9d2808c --- /dev/null +++ b/partiql-types/src/main/kotlin/org/partiql/beam/io/BeamReader.kt @@ -0,0 +1,414 @@ +package org.partiql.beam.io + +import com.amazon.ion.IonReader +import org.partiql.beam.io.runtime.RidlReader + +public abstract class BeamReader(reader: IonReader) : RidlReader(reader) { + + public fun read(value: Beam.`$Serializable`): Beam.`$Serializable` = value.read(this) + + public abstract fun readShape(): Beam.Shape + + public abstract fun readShapeTBool(): Beam.Shape.TBool + + public abstract fun readShapeTInt8(): Beam.Shape.TInt8 + + public abstract fun readShapeTInt16(): Beam.Shape.TInt16 + + public abstract fun readShapeTInt32(): Beam.Shape.TInt32 + + public abstract fun readShapeTInt64(): Beam.Shape.TInt64 + + public abstract fun readShapeTInteger(): Beam.Shape.TInteger + + public abstract fun readShapeTDecimal(): Beam.Shape.TDecimal + + public abstract fun readShapeTNumeric(): Beam.Shape.TNumeric + + public abstract fun readShapeTFloat32(): Beam.Shape.TFloat32 + + public abstract fun readShapeTFloat64(): Beam.Shape.TFloat64 + + public abstract fun readShapeTFloat(): Beam.Shape.TFloat + + public abstract fun readShapeTCharFixed(): Beam.Shape.TCharFixed + + public abstract fun readShapeTCharVarying(): Beam.Shape.TCharVarying + + public abstract fun readShapeTString(): Beam.Shape.TString + + public abstract fun readShapeTSymbol(): Beam.Shape.TSymbol + + public abstract fun readShapeTClob(): Beam.Shape.TClob + + public abstract fun readShapeTBitFixed(): Beam.Shape.TBitFixed + + public abstract fun readShapeTBitVarying(): Beam.Shape.TBitVarying + + public abstract fun readShapeTBinary(): Beam.Shape.TBinary + + public abstract fun readShapeTByteFixed(): Beam.Shape.TByteFixed + + public abstract fun readShapeTByteVarying(): Beam.Shape.TByteVarying + + public abstract fun readShapeTBlob(): Beam.Shape.TBlob + + public abstract fun readShapeTDate(): Beam.Shape.TDate + + public abstract fun readShapeTTime(): Beam.Shape.TTime + + public abstract fun readShapeTTimeTz(): Beam.Shape.TTimeTz + + public abstract fun readShapeTTimestamp(): Beam.Shape.TTimestamp + + public abstract fun readShapeTTimestampTz(): Beam.Shape.TTimestampTz + + public abstract fun readShapeTBag(): Beam.Shape.TBag + + public abstract fun readShapeTList(): Beam.Shape.TList + + public abstract fun readShapeTSexp(): Beam.Shape.TSexp + + public abstract fun readShapeTStruct(): Beam.Shape.TStruct + + public abstract fun readShapeTNull(): Beam.Shape.TNull + + public abstract fun readShapeTMissing(): Beam.Shape.TMissing + + public abstract fun readShapeTUnion(): Beam.Shape.TUnion + + public abstract fun readShapeTDynamic(): Beam.Shape.TDynamic + + public abstract fun readShapes(): Beam.Shapes + + public abstract fun readFields(): Beam.Fields + + public abstract fun readField(): Beam.Field + + public companion object { + + @JvmStatic + public fun text(reader: IonReader): BeamReader = Text(reader) + + @JvmStatic + public fun packed(reader: IonReader): BeamReader = Packed(reader) + } + + private class Text(private val reader: IonReader) : BeamReader(reader) { + + override fun readShape(): Beam.Shape = with(reader) { + TODO() + } + + override fun readShapeTBool(): Beam.Shape.TBool = with(reader) { + TODO() + } + + override fun readShapeTInt8(): Beam.Shape.TInt8 = with(reader) { + TODO() + } + + override fun readShapeTInt16(): Beam.Shape.TInt16 = with(reader) { + TODO() + } + + override fun readShapeTInt32(): Beam.Shape.TInt32 = with(reader) { + TODO() + } + + override fun readShapeTInt64(): Beam.Shape.TInt64 = with(reader) { + TODO() + } + + override fun readShapeTInteger(): Beam.Shape.TInteger = with(reader) { + TODO() + } + + override fun readShapeTDecimal(): Beam.Shape.TDecimal = with(reader) { + TODO() + } + + override fun readShapeTNumeric(): Beam.Shape.TNumeric = with(reader) { + TODO() + } + + override fun readShapeTFloat32(): Beam.Shape.TFloat32 = with(reader) { + TODO() + } + + override fun readShapeTFloat64(): Beam.Shape.TFloat64 = with(reader) { + TODO() + } + + override fun readShapeTFloat(): Beam.Shape.TFloat = with(reader) { + TODO() + } + + override fun readShapeTCharFixed(): Beam.Shape.TCharFixed = with(reader) { + TODO() + } + + override fun readShapeTCharVarying(): Beam.Shape.TCharVarying = with(reader) { + TODO() + } + + override fun readShapeTString(): Beam.Shape.TString = with(reader) { + TODO() + } + + override fun readShapeTSymbol(): Beam.Shape.TSymbol = with(reader) { + TODO() + } + + override fun readShapeTClob(): Beam.Shape.TClob = with(reader) { + TODO() + } + + override fun readShapeTBitFixed(): Beam.Shape.TBitFixed = with(reader) { + TODO() + } + + override fun readShapeTBitVarying(): Beam.Shape.TBitVarying = with(reader) { + TODO() + } + + override fun readShapeTBinary(): Beam.Shape.TBinary = with(reader) { + TODO() + } + + override fun readShapeTByteFixed(): Beam.Shape.TByteFixed = with(reader) { + TODO() + } + + override fun readShapeTByteVarying(): Beam.Shape.TByteVarying = with(reader) { + TODO() + } + + override fun readShapeTBlob(): Beam.Shape.TBlob = with(reader) { + TODO() + } + + override fun readShapeTDate(): Beam.Shape.TDate = with(reader) { + TODO() + } + + override fun readShapeTTime(): Beam.Shape.TTime = with(reader) { + TODO() + } + + override fun readShapeTTimeTz(): Beam.Shape.TTimeTz = with(reader) { + TODO() + } + + override fun readShapeTTimestamp(): Beam.Shape.TTimestamp = with(reader) { + TODO() + } + + override fun readShapeTTimestampTz(): Beam.Shape.TTimestampTz = with(reader) { + TODO() + } + + override fun readShapeTBag(): Beam.Shape.TBag = with(reader) { + TODO() + } + + override fun readShapeTList(): Beam.Shape.TList = with(reader) { + TODO() + } + + override fun readShapeTSexp(): Beam.Shape.TSexp = with(reader) { + TODO() + } + + override fun readShapeTStruct(): Beam.Shape.TStruct = with(reader) { + TODO() + } + + override fun readShapeTNull(): Beam.Shape.TNull = with(reader) { + TODO() + } + + override fun readShapeTMissing(): Beam.Shape.TMissing = with(reader) { + TODO() + } + + override fun readShapeTUnion(): Beam.Shape.TUnion = with(reader) { + TODO() + } + + override fun readShapeTDynamic(): Beam.Shape.TDynamic = with(reader) { + TODO() + } + + override fun readShapes(): Beam.Shapes = with(reader) { + TODO() + } + + override fun readFields(): Beam.Fields = with(reader) { + TODO() + } + + override fun readField(): Beam.Field = with(reader) { + TODO() + } + } + + private class Packed(private val reader: IonReader) : BeamReader(reader) { + + override fun readShape(): Beam.Shape = with(reader) { + TODO() + } + + override fun readShapeTBool(): Beam.Shape.TBool = with(reader) { + TODO() + } + + override fun readShapeTInt8(): Beam.Shape.TInt8 = with(reader) { + TODO() + } + + override fun readShapeTInt16(): Beam.Shape.TInt16 = with(reader) { + TODO() + } + + override fun readShapeTInt32(): Beam.Shape.TInt32 = with(reader) { + TODO() + } + + override fun readShapeTInt64(): Beam.Shape.TInt64 = with(reader) { + TODO() + } + + override fun readShapeTInteger(): Beam.Shape.TInteger = with(reader) { + TODO() + } + + override fun readShapeTDecimal(): Beam.Shape.TDecimal = with(reader) { + TODO() + } + + override fun readShapeTNumeric(): Beam.Shape.TNumeric = with(reader) { + TODO() + } + + override fun readShapeTFloat32(): Beam.Shape.TFloat32 = with(reader) { + TODO() + } + + override fun readShapeTFloat64(): Beam.Shape.TFloat64 = with(reader) { + TODO() + } + + override fun readShapeTFloat(): Beam.Shape.TFloat = with(reader) { + TODO() + } + + override fun readShapeTCharFixed(): Beam.Shape.TCharFixed = with(reader) { + TODO() + } + + override fun readShapeTCharVarying(): Beam.Shape.TCharVarying = with(reader) { + TODO() + } + + override fun readShapeTString(): Beam.Shape.TString = with(reader) { + TODO() + } + + override fun readShapeTSymbol(): Beam.Shape.TSymbol = with(reader) { + TODO() + } + + override fun readShapeTClob(): Beam.Shape.TClob = with(reader) { + TODO() + } + + override fun readShapeTBitFixed(): Beam.Shape.TBitFixed = with(reader) { + TODO() + } + + override fun readShapeTBitVarying(): Beam.Shape.TBitVarying = with(reader) { + TODO() + } + + override fun readShapeTBinary(): Beam.Shape.TBinary = with(reader) { + TODO() + } + + override fun readShapeTByteFixed(): Beam.Shape.TByteFixed = with(reader) { + TODO() + } + + override fun readShapeTByteVarying(): Beam.Shape.TByteVarying = with(reader) { + TODO() + } + + override fun readShapeTBlob(): Beam.Shape.TBlob = with(reader) { + TODO() + } + + override fun readShapeTDate(): Beam.Shape.TDate = with(reader) { + TODO() + } + + override fun readShapeTTime(): Beam.Shape.TTime = with(reader) { + TODO() + } + + override fun readShapeTTimeTz(): Beam.Shape.TTimeTz = with(reader) { + TODO() + } + + override fun readShapeTTimestamp(): Beam.Shape.TTimestamp = with(reader) { + TODO() + } + + override fun readShapeTTimestampTz(): Beam.Shape.TTimestampTz = with(reader) { + TODO() + } + + override fun readShapeTBag(): Beam.Shape.TBag = with(reader) { + TODO() + } + + override fun readShapeTList(): Beam.Shape.TList = with(reader) { + TODO() + } + + override fun readShapeTSexp(): Beam.Shape.TSexp = with(reader) { + TODO() + } + + override fun readShapeTStruct(): Beam.Shape.TStruct = with(reader) { + TODO() + } + + override fun readShapeTNull(): Beam.Shape.TNull = with(reader) { + TODO() + } + + override fun readShapeTMissing(): Beam.Shape.TMissing = with(reader) { + TODO() + } + + override fun readShapeTUnion(): Beam.Shape.TUnion = with(reader) { + TODO() + } + + override fun readShapeTDynamic(): Beam.Shape.TDynamic = with(reader) { + TODO() + } + + override fun readShapes(): Beam.Shapes = with(reader) { + TODO() + } + + override fun readFields(): Beam.Fields = with(reader) { + TODO() + } + + override fun readField(): Beam.Field = with(reader) { + TODO() + } + } +} diff --git a/partiql-types/src/main/kotlin/org/partiql/beam/io/BeamWriter.kt b/partiql-types/src/main/kotlin/org/partiql/beam/io/BeamWriter.kt new file mode 100644 index 0000000000..209b2e1627 --- /dev/null +++ b/partiql-types/src/main/kotlin/org/partiql/beam/io/BeamWriter.kt @@ -0,0 +1,603 @@ +package org.partiql.beam.io + +import com.amazon.ion.IonType +import com.amazon.ion.IonWriter +import com.amazon.ion.system.IonBinaryWriterBuilder +import com.amazon.ion.system.IonTextWriterBuilder +import org.partiql.beam.io.runtime.RidlWriter +import java.io.OutputStream + +public abstract class BeamWriter(writer: IonWriter) : RidlWriter(writer) { + + public fun write(value: Beam.`$Serializable`): Unit = value.write(this) + + public abstract fun writeShape(value: Beam.Shape) + + public abstract fun writeShapeTBool(value: Beam.Shape.TBool) + + public abstract fun writeShapeTInt8(value: Beam.Shape.TInt8) + + public abstract fun writeShapeTInt16(value: Beam.Shape.TInt16) + + public abstract fun writeShapeTInt32(value: Beam.Shape.TInt32) + + public abstract fun writeShapeTInt64(value: Beam.Shape.TInt64) + + public abstract fun writeShapeTInteger(value: Beam.Shape.TInteger) + + public abstract fun writeShapeTDecimal(value: Beam.Shape.TDecimal) + + public abstract fun writeShapeTNumeric(value: Beam.Shape.TNumeric) + + public abstract fun writeShapeTFloat32(value: Beam.Shape.TFloat32) + + public abstract fun writeShapeTFloat64(value: Beam.Shape.TFloat64) + + public abstract fun writeShapeTFloat(value: Beam.Shape.TFloat) + + public abstract fun writeShapeTCharFixed(value: Beam.Shape.TCharFixed) + + public abstract fun writeShapeTCharVarying(value: Beam.Shape.TCharVarying) + + public abstract fun writeShapeTString(value: Beam.Shape.TString) + + public abstract fun writeShapeTSymbol(value: Beam.Shape.TSymbol) + + public abstract fun writeShapeTClob(value: Beam.Shape.TClob) + + public abstract fun writeShapeTBitFixed(value: Beam.Shape.TBitFixed) + + public abstract fun writeShapeTBitVarying(value: Beam.Shape.TBitVarying) + + public abstract fun writeShapeTBinary(value: Beam.Shape.TBinary) + + public abstract fun writeShapeTByteFixed(value: Beam.Shape.TByteFixed) + + public abstract fun writeShapeTByteVarying(value: Beam.Shape.TByteVarying) + + public abstract fun writeShapeTBlob(value: Beam.Shape.TBlob) + + public abstract fun writeShapeTDate(value: Beam.Shape.TDate) + + public abstract fun writeShapeTTime(value: Beam.Shape.TTime) + + public abstract fun writeShapeTTimeTz(value: Beam.Shape.TTimeTz) + + public abstract fun writeShapeTTimestamp(value: Beam.Shape.TTimestamp) + + public abstract fun writeShapeTTimestampTz(value: Beam.Shape.TTimestampTz) + + public abstract fun writeShapeTBag(value: Beam.Shape.TBag) + + public abstract fun writeShapeTList(value: Beam.Shape.TList) + + public abstract fun writeShapeTSexp(value: Beam.Shape.TSexp) + + public abstract fun writeShapeTStruct(value: Beam.Shape.TStruct) + + public abstract fun writeShapeTNull(value: Beam.Shape.TNull) + + public abstract fun writeShapeTMissing(value: Beam.Shape.TMissing) + + public abstract fun writeShapeTUnion(value: Beam.Shape.TUnion) + + public abstract fun writeShapeTDynamic(value: Beam.Shape.TDynamic) + + public abstract fun writeShapes(value: Beam.Shapes) + + public abstract fun writeFields(value: Beam.Fields) + + public abstract fun writeField(value: Beam.Field) + + public companion object { + + @JvmStatic + public fun text(out: Appendable): BeamWriter = Text(IonTextWriterBuilder.standard().build(out)) + + @JvmStatic + public fun text(writer: IonWriter): BeamWriter = Text(writer) + + @JvmStatic + public fun packed(out: OutputStream): BeamWriter = Packed(IonBinaryWriterBuilder.standard().build(out)) + + @JvmStatic + public fun packed(writer: IonWriter): BeamWriter = Packed(writer) + } + + private class Text(private val writer: IonWriter) : BeamWriter(writer) { + + override fun writeShape(value: Beam.Shape) { + when (value) { + is Beam.Shape.TBool -> writeShapeTBool(value) + is Beam.Shape.TInt8 -> writeShapeTInt8(value) + is Beam.Shape.TInt16 -> writeShapeTInt16(value) + is Beam.Shape.TInt32 -> writeShapeTInt32(value) + is Beam.Shape.TInt64 -> writeShapeTInt64(value) + is Beam.Shape.TInteger -> writeShapeTInteger(value) + is Beam.Shape.TDecimal -> writeShapeTDecimal(value) + is Beam.Shape.TNumeric -> writeShapeTNumeric(value) + is Beam.Shape.TFloat32 -> writeShapeTFloat32(value) + is Beam.Shape.TFloat64 -> writeShapeTFloat64(value) + is Beam.Shape.TFloat -> writeShapeTFloat(value) + is Beam.Shape.TCharFixed -> writeShapeTCharFixed(value) + is Beam.Shape.TCharVarying -> writeShapeTCharVarying(value) + is Beam.Shape.TString -> writeShapeTString(value) + is Beam.Shape.TSymbol -> writeShapeTSymbol(value) + is Beam.Shape.TClob -> writeShapeTClob(value) + is Beam.Shape.TBitFixed -> writeShapeTBitFixed(value) + is Beam.Shape.TBitVarying -> writeShapeTBitVarying(value) + is Beam.Shape.TBinary -> writeShapeTBinary(value) + is Beam.Shape.TByteFixed -> writeShapeTByteFixed(value) + is Beam.Shape.TByteVarying -> writeShapeTByteVarying(value) + is Beam.Shape.TBlob -> writeShapeTBlob(value) + is Beam.Shape.TDate -> writeShapeTDate(value) + is Beam.Shape.TTime -> writeShapeTTime(value) + is Beam.Shape.TTimeTz -> writeShapeTTimeTz(value) + is Beam.Shape.TTimestamp -> writeShapeTTimestamp(value) + is Beam.Shape.TTimestampTz -> writeShapeTTimestampTz(value) + is Beam.Shape.TBag -> writeShapeTBag(value) + is Beam.Shape.TList -> writeShapeTList(value) + is Beam.Shape.TSexp -> writeShapeTSexp(value) + is Beam.Shape.TStruct -> writeShapeTStruct(value) + is Beam.Shape.TNull -> writeShapeTNull(value) + is Beam.Shape.TMissing -> writeShapeTMissing(value) + is Beam.Shape.TUnion -> writeShapeTUnion(value) + is Beam.Shape.TDynamic -> writeShapeTDynamic(value) + } + } + + override fun writeShapeTBool(value: Beam.Shape.TBool) { + writer.setTypeAnnotations("shape.t_bool") + writer.writeSymbol("unit") + } + + override fun writeShapeTInt8(value: Beam.Shape.TInt8) { + writer.setTypeAnnotations("shape.t_int8") + writer.writeSymbol("unit") + } + + override fun writeShapeTInt16(value: Beam.Shape.TInt16) { + writer.setTypeAnnotations("shape.t_int16") + writer.writeSymbol("unit") + } + + override fun writeShapeTInt32(value: Beam.Shape.TInt32) { + writer.setTypeAnnotations("shape.t_int32") + writer.writeSymbol("unit") + } + + override fun writeShapeTInt64(value: Beam.Shape.TInt64) { + writer.setTypeAnnotations("shape.t_int64") + writer.writeSymbol("unit") + } + + override fun writeShapeTInteger(value: Beam.Shape.TInteger) { + writer.setTypeAnnotations("shape.t_integer") + writer.writeSymbol("unit") + } + + override fun writeShapeTDecimal(value: Beam.Shape.TDecimal) { + writer.setTypeAnnotations("shape.t_decimal") + writer.writeSymbol("unit") + } + + override fun writeShapeTNumeric(value: Beam.Shape.TNumeric) { + writer.setTypeAnnotations("shape.t_numeric") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("precision"); writer.writeInt(value.precision) + writer.setFieldName("scale"); writer.writeInt(value.scale) + writer.stepOut() + } + + override fun writeShapeTFloat32(value: Beam.Shape.TFloat32) { + writer.setTypeAnnotations("shape.t_float32") + writer.writeSymbol("unit") + } + + override fun writeShapeTFloat64(value: Beam.Shape.TFloat64) { + writer.setTypeAnnotations("shape.t_float64") + writer.writeSymbol("unit") + } + + override fun writeShapeTFloat(value: Beam.Shape.TFloat) { + writer.setTypeAnnotations("shape.t_float") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("precision"); writer.writeInt(value.precision) + writer.stepOut() + } + + override fun writeShapeTCharFixed(value: Beam.Shape.TCharFixed) { + writer.setTypeAnnotations("shape.t_char_fixed") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("length"); writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTCharVarying(value: Beam.Shape.TCharVarying) { + writer.setTypeAnnotations("shape.t_char_varying") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("length"); writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTString(value: Beam.Shape.TString) { + writer.setTypeAnnotations("shape.t_string") + writer.writeSymbol("unit") + } + + override fun writeShapeTSymbol(value: Beam.Shape.TSymbol) { + writer.setTypeAnnotations("shape.t_symbol") + writer.writeSymbol("unit") + } + + override fun writeShapeTClob(value: Beam.Shape.TClob) { + writer.setTypeAnnotations("shape.t_clob") + writer.writeSymbol("unit") + } + + override fun writeShapeTBitFixed(value: Beam.Shape.TBitFixed) { + writer.setTypeAnnotations("shape.t_bit_fixed") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("length"); writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTBitVarying(value: Beam.Shape.TBitVarying) { + writer.setTypeAnnotations("shape.t_bit_varying") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("length"); writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTBinary(value: Beam.Shape.TBinary) { + writer.setTypeAnnotations("shape.t_binary") + writer.writeSymbol("unit") + } + + override fun writeShapeTByteFixed(value: Beam.Shape.TByteFixed) { + writer.setTypeAnnotations("shape.t_byte_fixed") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("length"); writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTByteVarying(value: Beam.Shape.TByteVarying) { + writer.setTypeAnnotations("shape.t_byte_varying") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("length"); writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTBlob(value: Beam.Shape.TBlob) { + writer.setTypeAnnotations("shape.t_blob") + writer.writeSymbol("unit") + } + + override fun writeShapeTDate(value: Beam.Shape.TDate) { + writer.setTypeAnnotations("shape.t_date") + writer.writeSymbol("unit") + } + + override fun writeShapeTTime(value: Beam.Shape.TTime) { + writer.setTypeAnnotations("shape.t_time") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("precision"); writer.writeInt(value.precision) + writer.stepOut() + } + + override fun writeShapeTTimeTz(value: Beam.Shape.TTimeTz) { + writer.setTypeAnnotations("shape.t_time_tz") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("precision"); writer.writeInt(value.precision) + writer.setFieldName("offset_hour"); writer.writeInt(value.offsetHour) + writer.setFieldName("offset_minute"); writer.writeInt(value.offsetMinute) + writer.stepOut() + } + + override fun writeShapeTTimestamp(value: Beam.Shape.TTimestamp) { + writer.setTypeAnnotations("shape.t_timestamp") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("precision"); writer.writeInt(value.precision) + writer.stepOut() + } + + override fun writeShapeTTimestampTz(value: Beam.Shape.TTimestampTz) { + writer.setTypeAnnotations("shape.t_timestamp_tz") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("precision"); writer.writeInt(value.precision) + writer.setFieldName("offset_hour"); writer.writeInt(value.offsetHour) + writer.setFieldName("offset_minute"); writer.writeInt(value.offsetMinute) + writer.stepOut() + } + + override fun writeShapeTBag(value: Beam.Shape.TBag) { + writer.setTypeAnnotations("shape.t_bag") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("items"); write(value.items) + writer.stepOut() + } + + override fun writeShapeTList(value: Beam.Shape.TList) { + writer.setTypeAnnotations("shape.t_list") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("items"); write(value.items) + writer.stepOut() + } + + override fun writeShapeTSexp(value: Beam.Shape.TSexp) { + writer.setTypeAnnotations("shape.t_sexp") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("items"); write(value.items) + writer.stepOut() + } + + override fun writeShapeTStruct(value: Beam.Shape.TStruct) { + writer.setTypeAnnotations("shape.t_struct") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("fields"); write(value.fields) + writer.setFieldName("is_closed"); writer.writeBool(value.isClosed) + writer.setFieldName("is_ordered"); writer.writeBool(value.isOrdered) + writer.setFieldName("has_unique_fields"); writer.writeBool(value.hasUniqueFields) + writer.stepOut() + } + + override fun writeShapeTNull(value: Beam.Shape.TNull) { + writer.setTypeAnnotations("shape.t_null") + writer.writeSymbol("unit") + } + + override fun writeShapeTMissing(value: Beam.Shape.TMissing) { + writer.setTypeAnnotations("shape.t_missing") + writer.writeSymbol("unit") + } + + override fun writeShapeTUnion(value: Beam.Shape.TUnion) { + writer.setTypeAnnotations("shape.t_union") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("shapes"); write(value.shapes) + writer.stepOut() + } + + override fun writeShapeTDynamic(value: Beam.Shape.TDynamic) { + writer.setTypeAnnotations("shape.t_dynamic") + writer.writeSymbol("unit") + } + + override fun writeShapes(value: Beam.Shapes) { + writer.setTypeAnnotations("shapes") + writer.stepIn(IonType.LIST) + for (item in value) { + write(item) + } + writer.stepOut() + } + + override fun writeFields(value: Beam.Fields) { + writer.setTypeAnnotations("fields") + writer.stepIn(IonType.LIST) + for (item in value) { + write(item) + } + writer.stepOut() + } + + override fun writeField(value: Beam.Field) { + writer.setTypeAnnotations("field") + writer.stepIn(IonType.STRUCT) + writer.setFieldName("name"); writer.writeString(value.name) + writer.setFieldName("shape"); write(value.shape) + writer.stepOut() + } + } + + private class Packed(private val writer: IonWriter) : BeamWriter(writer) { + + override fun writeShape(value: Beam.Shape) { + } + + override fun writeShapeTBool(value: Beam.Shape.TBool) { + writer.writeSymbol("unit") + } + + override fun writeShapeTInt8(value: Beam.Shape.TInt8) { + writer.writeSymbol("unit") + } + + override fun writeShapeTInt16(value: Beam.Shape.TInt16) { + writer.writeSymbol("unit") + } + + override fun writeShapeTInt32(value: Beam.Shape.TInt32) { + writer.writeSymbol("unit") + } + + override fun writeShapeTInt64(value: Beam.Shape.TInt64) { + writer.writeSymbol("unit") + } + + override fun writeShapeTInteger(value: Beam.Shape.TInteger) { + writer.writeSymbol("unit") + } + + override fun writeShapeTDecimal(value: Beam.Shape.TDecimal) { + writer.writeSymbol("unit") + } + + override fun writeShapeTNumeric(value: Beam.Shape.TNumeric) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.precision) + writer.writeInt(value.scale) + writer.stepOut() + } + + override fun writeShapeTFloat32(value: Beam.Shape.TFloat32) { + writer.writeSymbol("unit") + } + + override fun writeShapeTFloat64(value: Beam.Shape.TFloat64) { + writer.writeSymbol("unit") + } + + override fun writeShapeTFloat(value: Beam.Shape.TFloat) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.precision) + writer.stepOut() + } + + override fun writeShapeTCharFixed(value: Beam.Shape.TCharFixed) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTCharVarying(value: Beam.Shape.TCharVarying) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTString(value: Beam.Shape.TString) { + writer.writeSymbol("unit") + } + + override fun writeShapeTSymbol(value: Beam.Shape.TSymbol) { + writer.writeSymbol("unit") + } + + override fun writeShapeTClob(value: Beam.Shape.TClob) { + writer.writeSymbol("unit") + } + + override fun writeShapeTBitFixed(value: Beam.Shape.TBitFixed) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTBitVarying(value: Beam.Shape.TBitVarying) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTBinary(value: Beam.Shape.TBinary) { + writer.writeSymbol("unit") + } + + override fun writeShapeTByteFixed(value: Beam.Shape.TByteFixed) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTByteVarying(value: Beam.Shape.TByteVarying) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.length) + writer.stepOut() + } + + override fun writeShapeTBlob(value: Beam.Shape.TBlob) { + writer.writeSymbol("unit") + } + + override fun writeShapeTDate(value: Beam.Shape.TDate) { + writer.writeSymbol("unit") + } + + override fun writeShapeTTime(value: Beam.Shape.TTime) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.precision) + writer.stepOut() + } + + override fun writeShapeTTimeTz(value: Beam.Shape.TTimeTz) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.precision) + writer.writeInt(value.offsetHour) + writer.writeInt(value.offsetMinute) + writer.stepOut() + } + + override fun writeShapeTTimestamp(value: Beam.Shape.TTimestamp) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.precision) + writer.stepOut() + } + + override fun writeShapeTTimestampTz(value: Beam.Shape.TTimestampTz) { + writer.stepIn(IonType.SEXP) + writer.writeInt(value.precision) + writer.writeInt(value.offsetHour) + writer.writeInt(value.offsetMinute) + writer.stepOut() + } + + override fun writeShapeTBag(value: Beam.Shape.TBag) { + writer.stepIn(IonType.SEXP) + write(value.items) + writer.stepOut() + } + + override fun writeShapeTList(value: Beam.Shape.TList) { + writer.stepIn(IonType.SEXP) + write(value.items) + writer.stepOut() + } + + override fun writeShapeTSexp(value: Beam.Shape.TSexp) { + writer.stepIn(IonType.SEXP) + write(value.items) + writer.stepOut() + } + + override fun writeShapeTStruct(value: Beam.Shape.TStruct) { + writer.stepIn(IonType.SEXP) + write(value.fields) + writer.writeBool(value.isClosed) + writer.writeBool(value.isOrdered) + writer.writeBool(value.hasUniqueFields) + writer.stepOut() + } + + override fun writeShapeTNull(value: Beam.Shape.TNull) { + writer.writeSymbol("unit") + } + + override fun writeShapeTMissing(value: Beam.Shape.TMissing) { + writer.writeSymbol("unit") + } + + override fun writeShapeTUnion(value: Beam.Shape.TUnion) { + writer.stepIn(IonType.SEXP) + write(value.shapes) + writer.stepOut() + } + + override fun writeShapeTDynamic(value: Beam.Shape.TDynamic) { + writer.writeSymbol("unit") + } + + override fun writeShapes(value: Beam.Shapes) { + writer.stepIn(IonType.LIST) + for (item in value) { + write(item) + } + writer.stepOut() + } + + override fun writeFields(value: Beam.Fields) { + writer.stepIn(IonType.LIST) + for (item in value) { + write(item) + } + writer.stepOut() + } + + override fun writeField(value: Beam.Field) { + writer.stepIn(IonType.SEXP) + writer.writeString(value.name) + write(value.shape) + writer.stepOut() + } + } +} diff --git a/partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/Ridl.kt b/partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/Ridl.kt new file mode 100644 index 0000000000..350cada229 --- /dev/null +++ b/partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/Ridl.kt @@ -0,0 +1,14 @@ +package org.partiql.beam.io.runtime + +public abstract class RidlList(items: ArrayList) : Collection by items + +public abstract class RidlArray(private val items: Array) { + + public val size: Int = items.size + + public operator fun get(index: Int): T = items[index] + + public operator fun set(index: Int, value: T): Unit = items.set(index, value) + + public operator fun iterator(): Iterator = items.iterator() +} diff --git a/partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/RidlReader.kt b/partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/RidlReader.kt new file mode 100644 index 0000000000..052183b2be --- /dev/null +++ b/partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/RidlReader.kt @@ -0,0 +1,17 @@ +package org.partiql.beam.io.runtime + +import com.amazon.ion.IonReader +import com.amazon.ion.IonType + +public abstract class RidlReader(private val reader: IonReader) { + + public fun assertTag(expectedType: IonType, expectedTag: String) { + assert(reader.type == IonType.STRUCT) { "Expected `$expectedType`, got `${reader.type}`" } + val tag = reader.typeAnnotations.joinToString("::") + assert(tag == expectedTag) { "Expected `$expectedTag`, got `$tag`" } + } + + public fun assertKey(key: String) { + assert(reader.fieldName == key) { "Expected field `$key`, found `$reader.fieldName`" } + } +} diff --git a/partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/RidlWriter.kt b/partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/RidlWriter.kt new file mode 100644 index 0000000000..b917201ef5 --- /dev/null +++ b/partiql-types/src/main/kotlin/org/partiql/beam/io/runtime/RidlWriter.kt @@ -0,0 +1,7 @@ +package org.partiql.beam.io.runtime + +import com.amazon.ion.IonWriter + +public abstract class RidlWriter(private val writer: IonWriter) { + // TODO writer utilities +}