Skip to content

Commit d25de2d

Browse files
committed
Initializes PQLValue and adds functionality to evaluator
1 parent 607c4c0 commit d25de2d

File tree

81 files changed

+2437
-341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2437
-341
lines changed

partiql-eval/api/partiql-eval.api

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
1+
public abstract interface class org/partiql/eval/PQLValue {
2+
public static fun bagValue (Ljava/lang/Iterable;)Lorg/partiql/eval/PQLValue;
3+
public static fun boolValue (Z)Lorg/partiql/eval/PQLValue;
4+
public fun getBagValues ()Ljava/util/Iterator;
5+
public fun getBinaryValue ()[B
6+
public fun getBlobValue ()[B
7+
public fun getBoolValue ()Z
8+
public fun getByteValue ()B
9+
public fun getCharValue ()Ljava/lang/String;
10+
public fun getClobValue ()[B
11+
public fun getDateValue ()Lorg/partiql/value/datetime/Date;
12+
public fun getDecimalArbitraryValue ()Ljava/math/BigDecimal;
13+
public fun getDecimalValue ()Ljava/math/BigDecimal;
14+
public fun getFloat32Value ()F
15+
public fun getFloat64Value ()D
16+
public fun getInt16Value ()S
17+
public fun getInt32Value ()I
18+
public fun getInt64Value ()J
19+
public fun getInt8Value ()B
20+
public fun getIntValue ()Ljava/math/BigInteger;
21+
public fun getIntervalValue ()J
22+
public fun getListValues ()Ljava/util/Iterator;
23+
public fun getSexpValues ()Ljava/util/Iterator;
24+
public fun getStringValue ()Ljava/lang/String;
25+
public fun getStructFields ()Ljava/util/Iterator;
26+
public fun getSymbolValue ()Ljava/lang/String;
27+
public fun getTimeValue ()Lorg/partiql/value/datetime/Time;
28+
public fun getTimestampValue ()Lorg/partiql/value/datetime/Timestamp;
29+
public abstract fun getType ()Lorg/partiql/value/PartiQLValueType;
30+
public static fun int32Value (I)Lorg/partiql/eval/PQLValue;
31+
public static fun int64Value (J)Lorg/partiql/eval/PQLValue;
32+
public abstract fun isNull ()Z
33+
public static fun listValue (Ljava/lang/Iterable;)Lorg/partiql/eval/PQLValue;
34+
public static fun missingValue ()Lorg/partiql/eval/PQLValue;
35+
public static fun nullValue ()Lorg/partiql/eval/PQLValue;
36+
public static fun nullValue (Lorg/partiql/value/PartiQLValueType;)Lorg/partiql/eval/PQLValue;
37+
public static fun of (Lorg/partiql/value/PartiQLValue;)Lorg/partiql/eval/PQLValue;
38+
public static fun sexpValue (Ljava/lang/Iterable;)Lorg/partiql/eval/PQLValue;
39+
public static fun stringValue (Ljava/lang/String;)Lorg/partiql/eval/PQLValue;
40+
public static fun structValue (Ljava/lang/Iterable;)Lorg/partiql/eval/PQLValue;
41+
public fun toPartiQLValue ()Lorg/partiql/value/PartiQLValue;
42+
}
43+
144
public abstract interface class org/partiql/eval/PartiQLEngine {
245
public static final field Companion Lorg/partiql/eval/PartiQLEngine$Companion;
346
public static fun builder ()Lorg/partiql/eval/PartiQLEngineBuilder;
@@ -63,3 +106,9 @@ public abstract interface class org/partiql/eval/PartiQLStatement {
63106
public abstract interface class org/partiql/eval/PartiQLStatement$Query : org/partiql/eval/PartiQLStatement {
64107
}
65108

109+
public abstract interface class org/partiql/eval/StructField {
110+
public abstract fun getName ()Ljava/lang/String;
111+
public abstract fun getValue ()Lorg/partiql/eval/PQLValue;
112+
public static fun of (Ljava/lang/String;Lorg/partiql/eval/PQLValue;)Lorg/partiql/eval/StructField;
113+
}
114+

partiql-eval/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ kotlin {
4343
explicitApi = null
4444
}
4545

46+
// Need to add this as we have both Java and Kotlin sources. Dokka already handles multi-language projects. If
47+
// Javadoc is enabled, we end up overwriting index.html (causing compilation errors).
48+
tasks.withType<Javadoc>() {
49+
enabled = false
50+
}
51+
tasks.withType<Jar>() {
52+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
53+
}
54+
4655
publish {
4756
artifactId = "partiql-eval"
4857
name = "PartiQL Lang Kotlin Evaluator"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package org.partiql.eval;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.partiql.value.PartiQLValueType;
5+
6+
import java.util.Collections;
7+
import java.util.Iterator;
8+
9+
/**
10+
* This shall always be package-private (internal).
11+
*/
12+
class BagValue implements PQLValue {
13+
14+
@NotNull
15+
final Iterable<PQLValue> _value;
16+
17+
BagValue(@NotNull Iterable<PQLValue> value) {
18+
_value = value;
19+
}
20+
21+
@Override
22+
public boolean isNull() {
23+
return false;
24+
}
25+
26+
@Override
27+
@NotNull
28+
public Iterator<PQLValue> getBagValues() {
29+
return _value.iterator();
30+
}
31+
32+
@NotNull
33+
@Override
34+
public PartiQLValueType getType() {
35+
return PartiQLValueType.BAG;
36+
}
37+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.partiql.eval;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.partiql.value.PartiQLValueType;
5+
6+
/**
7+
* This shall always be package-private (internal).
8+
*/
9+
class BinaryValue implements PQLValue {
10+
11+
@NotNull
12+
final byte[] _value;
13+
14+
BinaryValue(@NotNull byte[] value) {
15+
_value = value;
16+
}
17+
18+
@Override
19+
public boolean isNull() {
20+
return false;
21+
}
22+
23+
@Override
24+
@NotNull
25+
public byte[] getBinaryValue() {
26+
return _value;
27+
}
28+
29+
@NotNull
30+
@Override
31+
public PartiQLValueType getType() {
32+
return PartiQLValueType.BINARY;
33+
}
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.partiql.eval;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.partiql.value.PartiQLValueType;
5+
6+
/**
7+
* This shall always be package-private (internal).
8+
*/
9+
class BlobValue implements PQLValue {
10+
11+
@NotNull
12+
final byte[] _value;
13+
14+
BlobValue(@NotNull byte[] value) {
15+
_value = value;
16+
}
17+
18+
@Override
19+
public boolean isNull() {
20+
return false;
21+
}
22+
23+
@Override
24+
@NotNull
25+
public byte[] getBlobValue() {
26+
return _value;
27+
}
28+
29+
@NotNull
30+
@Override
31+
public PartiQLValueType getType() {
32+
return PartiQLValueType.BLOB;
33+
}
34+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.partiql.eval;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.partiql.value.PartiQLValueType;
5+
6+
/**
7+
* This shall always be package-private (internal).
8+
*/
9+
class BoolValue implements PQLValue {
10+
11+
final boolean _value;
12+
13+
BoolValue(boolean value) {
14+
_value = value;
15+
}
16+
17+
@Override
18+
public boolean isNull() {
19+
return false;
20+
}
21+
22+
@Override
23+
public boolean getBoolValue() {
24+
return _value;
25+
}
26+
27+
@NotNull
28+
@Override
29+
public PartiQLValueType getType() {
30+
return PartiQLValueType.BOOL;
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.partiql.eval;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.partiql.value.PartiQLValueType;
5+
6+
/**
7+
* This shall always be package-private (internal).
8+
*/
9+
class ByteValue implements PQLValue {
10+
11+
final byte _value;
12+
13+
ByteValue(byte value) {
14+
_value = value;
15+
}
16+
17+
@Override
18+
public boolean isNull() {
19+
return false;
20+
}
21+
22+
@Override
23+
public byte getByteValue() {
24+
return _value;
25+
}
26+
27+
@NotNull
28+
@Override
29+
public PartiQLValueType getType() {
30+
return PartiQLValueType.BYTE;
31+
}
32+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.partiql.eval;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.partiql.value.PartiQLValueType;
5+
6+
import java.math.BigInteger;
7+
8+
/**
9+
* This shall always be package-private (internal).
10+
*/
11+
class CharValue implements PQLValue {
12+
13+
@NotNull
14+
final String _value;
15+
16+
CharValue(@NotNull String value) {
17+
_value = value;
18+
}
19+
20+
@Override
21+
public boolean isNull() {
22+
return false;
23+
}
24+
25+
@Override
26+
@NotNull
27+
public String getCharValue() {
28+
return _value;
29+
}
30+
31+
@NotNull
32+
@Override
33+
public PartiQLValueType getType() {
34+
return PartiQLValueType.CHAR;
35+
}
36+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.partiql.eval;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.partiql.value.PartiQLValueType;
5+
6+
/**
7+
* This shall always be package-private (internal).
8+
*/
9+
class ClobValue implements PQLValue {
10+
11+
@NotNull
12+
final byte[] _value;
13+
14+
ClobValue(@NotNull byte[] value) {
15+
_value = value;
16+
}
17+
18+
@Override
19+
public boolean isNull() {
20+
return false;
21+
}
22+
23+
@Override
24+
@NotNull
25+
public byte[] getClobValue() {
26+
return _value;
27+
}
28+
29+
@NotNull
30+
@Override
31+
public PartiQLValueType getType() {
32+
return PartiQLValueType.CLOB;
33+
}
34+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package org.partiql.eval;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.partiql.value.PartiQLValueType;
5+
import org.partiql.value.datetime.Date;
6+
import org.partiql.value.datetime.Time;
7+
8+
import java.util.Objects;
9+
10+
/**
11+
* This shall always be package-private (internal).
12+
*/
13+
class DateValue implements PQLValue {
14+
15+
@NotNull
16+
final Date _value;
17+
18+
DateValue(@NotNull Date value) {
19+
_value = value;
20+
}
21+
22+
@Override
23+
public boolean isNull() {
24+
return false;
25+
}
26+
27+
@Override
28+
@NotNull
29+
public Date getDateValue() {
30+
return _value;
31+
}
32+
33+
@NotNull
34+
@Override
35+
public PartiQLValueType getType() {
36+
return PartiQLValueType.DATE;
37+
}
38+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.partiql.eval;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.partiql.value.PartiQLValueType;
5+
6+
import java.math.BigDecimal;
7+
8+
/**
9+
* This shall always be package-private (internal).
10+
*/
11+
class DecimalArbitraryValue implements PQLValue {
12+
13+
@NotNull
14+
final BigDecimal _value;
15+
16+
DecimalArbitraryValue(@NotNull BigDecimal value) {
17+
_value = value;
18+
}
19+
20+
@Override
21+
public boolean isNull() {
22+
return false;
23+
}
24+
25+
@Override
26+
@NotNull
27+
public BigDecimal getDecimalArbitraryValue() {
28+
return _value;
29+
}
30+
31+
@NotNull
32+
@Override
33+
public PartiQLValueType getType() {
34+
return PartiQLValueType.DECIMAL_ARBITRARY;
35+
}
36+
}

0 commit comments

Comments
 (0)