From 5b60730934cafef899e60fda15cd4c4ad9f0549a Mon Sep 17 00:00:00 2001 From: Devin Smith Date: Thu, 28 Dec 2023 10:37:14 -0800 Subject: [PATCH] Refactor TypedFunction, ObjectProcessor, and ObjectProcessorFunctions * io.deephaven.functions: extensions/protobuf -> java/functions * io.deephaven.processor: extensions/kafka -> java/processor * io.deephaven.processor.functions: extensions/kafka -> java/processor-functions Introduced top-level directory `java/`, with the hopes of having it become the directory for new projects ala #4991 --- extensions/kafka/build.gradle | 2 + extensions/protobuf/build.gradle | 1 + java/functions/build.gradle | 19 +++ java/functions/gradle.properties | 1 + .../deephaven/functions/BooleanFunctions.java | 0 .../io/deephaven/functions/ByteFunctions.java | 0 .../io/deephaven/functions/CharFunctions.java | 0 .../deephaven/functions/DoubleFunctions.java | 0 .../deephaven/functions/FloatFunctions.java | 0 .../io/deephaven/functions/IntFunctions.java | 0 .../io/deephaven/functions/LongFunctions.java | 0 .../deephaven/functions/ObjectFunctions.java | 0 .../functions/PrimitiveFunctions.java | 0 .../deephaven/functions/ShortFunctions.java | 0 .../functions/ToBooleanFunction.java | 0 .../deephaven/functions/ToByteFunction.java | 0 .../deephaven/functions/ToCharFunction.java | 0 .../deephaven/functions/ToDoubleFunction.java | 0 .../deephaven/functions/ToFloatFunction.java | 0 .../io/deephaven/functions/ToIntFunction.java | 0 .../deephaven/functions/ToLongFunction.java | 0 .../deephaven/functions/ToObjectFunction.java | 0 .../functions/ToPrimitiveFunction.java | 0 .../deephaven/functions/ToShortFunction.java | 0 .../io/deephaven/functions/TypedFunction.java | 0 .../deephaven/functions/TypedFunctions.java | 0 .../functions/ToBooleanFunctionTest.java | 0 .../functions/ToByteFunctionTest.java | 0 .../functions/ToCharFunctionTest.java | 0 .../functions/ToDoubleFunctionTest.java | 0 .../functions/ToFloatFunctionTest.java | 0 .../functions/ToIntFunctionTest.java | 0 .../functions/ToLongFunctionTest.java | 0 .../functions/ToObjectFunctionTest.java | 0 .../functions/ToShortFunctionTest.java | 0 java/processor-functions/build.gradle | 16 ++ java/processor-functions/gradle.properties | 1 + .../processor/functions/ChunkUtils.java | 138 ++++++++++++++++++ .../functions/ObjectProcessorFunctions.java | 0 .../ObjectProcessorFunctionsImpl.java | 1 - .../ObjectProcessorFunctionsTest.java | 0 java/processor/build.gradle | 16 ++ java/processor/gradle.properties | 1 + .../deephaven/processor/ObjectProcessor.java | 2 +- .../processor/ObjectProcessorNoop.java | 0 .../processor/ObjectProcessorRowLimited.java | 0 .../processor/ObjectProcessorStrict.java | 0 .../processor/ObjectProcessorTypes.java | 0 .../processor/ObjectProcessorNoopTest.java | 0 .../ObjectProcessorRowLimitedTest.java | 0 .../processor/ObjectProcessorStrictTest.java | 0 .../processor/ObjectProcessorTest.java | 0 settings.gradle | 9 ++ 53 files changed, 205 insertions(+), 2 deletions(-) create mode 100644 java/functions/build.gradle create mode 100644 java/functions/gradle.properties rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/BooleanFunctions.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ByteFunctions.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/CharFunctions.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/DoubleFunctions.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/FloatFunctions.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/IntFunctions.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/LongFunctions.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ObjectFunctions.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/PrimitiveFunctions.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ShortFunctions.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ToBooleanFunction.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ToByteFunction.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ToCharFunction.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ToDoubleFunction.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ToFloatFunction.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ToIntFunction.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ToLongFunction.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ToObjectFunction.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ToPrimitiveFunction.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/ToShortFunction.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/TypedFunction.java (100%) rename {extensions/protobuf => java/functions}/src/main/java/io/deephaven/functions/TypedFunctions.java (100%) rename {extensions/protobuf => java/functions}/src/test/java/io/deephaven/functions/ToBooleanFunctionTest.java (100%) rename {extensions/protobuf => java/functions}/src/test/java/io/deephaven/functions/ToByteFunctionTest.java (100%) rename {extensions/protobuf => java/functions}/src/test/java/io/deephaven/functions/ToCharFunctionTest.java (100%) rename {extensions/protobuf => java/functions}/src/test/java/io/deephaven/functions/ToDoubleFunctionTest.java (100%) rename {extensions/protobuf => java/functions}/src/test/java/io/deephaven/functions/ToFloatFunctionTest.java (100%) rename {extensions/protobuf => java/functions}/src/test/java/io/deephaven/functions/ToIntFunctionTest.java (100%) rename {extensions/protobuf => java/functions}/src/test/java/io/deephaven/functions/ToLongFunctionTest.java (100%) rename {extensions/protobuf => java/functions}/src/test/java/io/deephaven/functions/ToObjectFunctionTest.java (100%) rename {extensions/protobuf => java/functions}/src/test/java/io/deephaven/functions/ToShortFunctionTest.java (100%) create mode 100644 java/processor-functions/build.gradle create mode 100644 java/processor-functions/gradle.properties create mode 100644 java/processor-functions/src/main/java/io/deephaven/processor/functions/ChunkUtils.java rename {extensions/kafka => java/processor-functions}/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctions.java (100%) rename {extensions/kafka => java/processor-functions}/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctionsImpl.java (99%) rename {extensions/kafka => java/processor-functions}/src/test/java/io/deephaven/processor/functions/ObjectProcessorFunctionsTest.java (100%) create mode 100644 java/processor/build.gradle create mode 100644 java/processor/gradle.properties rename {extensions/kafka => java/processor}/src/main/java/io/deephaven/processor/ObjectProcessor.java (98%) rename {extensions/kafka => java/processor}/src/main/java/io/deephaven/processor/ObjectProcessorNoop.java (100%) rename {extensions/kafka => java/processor}/src/main/java/io/deephaven/processor/ObjectProcessorRowLimited.java (100%) rename {extensions/kafka => java/processor}/src/main/java/io/deephaven/processor/ObjectProcessorStrict.java (100%) rename {extensions/kafka => java/processor}/src/main/java/io/deephaven/processor/ObjectProcessorTypes.java (100%) rename {extensions/kafka => java/processor}/src/test/java/io/deephaven/processor/ObjectProcessorNoopTest.java (100%) rename {extensions/kafka => java/processor}/src/test/java/io/deephaven/processor/ObjectProcessorRowLimitedTest.java (100%) rename {extensions/kafka => java/processor}/src/test/java/io/deephaven/processor/ObjectProcessorStrictTest.java (100%) rename {extensions/kafka => java/processor}/src/test/java/io/deephaven/processor/ObjectProcessorTest.java (100%) diff --git a/extensions/kafka/build.gradle b/extensions/kafka/build.gradle index 0543ed01a0b..91501af62de 100644 --- a/extensions/kafka/build.gradle +++ b/extensions/kafka/build.gradle @@ -8,6 +8,8 @@ description 'Kafka: Integrating Engine tables with Kafka' dependencies { api project(':engine-table') + api project(':processor') + api 'org.apache.avro:avro:1.11.2' // Using io.confluent dependencies requires code in the toplevel build.gradle to add their maven repository. diff --git a/extensions/protobuf/build.gradle b/extensions/protobuf/build.gradle index 5216aea91e2..61552cf1dea 100644 --- a/extensions/protobuf/build.gradle +++ b/extensions/protobuf/build.gradle @@ -6,6 +6,7 @@ plugins { dependencies { api project(':qst') + api project(':functions') api 'com.google.protobuf:protobuf-java:3.24.1' implementation project(':engine-query-constants') diff --git a/java/functions/build.gradle b/java/functions/build.gradle new file mode 100644 index 00000000000..1cd76588868 --- /dev/null +++ b/java/functions/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java-library' + id 'io.deephaven.project.register' +} + +dependencies { + api project(':qst') + + compileOnly depAnnotations + + Classpaths.inheritJUnitPlatform(project) + Classpaths.inheritAssertJ(project) + testImplementation 'org.junit.jupiter:junit-jupiter' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' +} + +test { + useJUnitPlatform() +} diff --git a/java/functions/gradle.properties b/java/functions/gradle.properties new file mode 100644 index 00000000000..c186bbfdde1 --- /dev/null +++ b/java/functions/gradle.properties @@ -0,0 +1 @@ +io.deephaven.project.ProjectType=JAVA_PUBLIC diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/BooleanFunctions.java b/java/functions/src/main/java/io/deephaven/functions/BooleanFunctions.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/BooleanFunctions.java rename to java/functions/src/main/java/io/deephaven/functions/BooleanFunctions.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ByteFunctions.java b/java/functions/src/main/java/io/deephaven/functions/ByteFunctions.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ByteFunctions.java rename to java/functions/src/main/java/io/deephaven/functions/ByteFunctions.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/CharFunctions.java b/java/functions/src/main/java/io/deephaven/functions/CharFunctions.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/CharFunctions.java rename to java/functions/src/main/java/io/deephaven/functions/CharFunctions.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/DoubleFunctions.java b/java/functions/src/main/java/io/deephaven/functions/DoubleFunctions.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/DoubleFunctions.java rename to java/functions/src/main/java/io/deephaven/functions/DoubleFunctions.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/FloatFunctions.java b/java/functions/src/main/java/io/deephaven/functions/FloatFunctions.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/FloatFunctions.java rename to java/functions/src/main/java/io/deephaven/functions/FloatFunctions.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/IntFunctions.java b/java/functions/src/main/java/io/deephaven/functions/IntFunctions.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/IntFunctions.java rename to java/functions/src/main/java/io/deephaven/functions/IntFunctions.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/LongFunctions.java b/java/functions/src/main/java/io/deephaven/functions/LongFunctions.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/LongFunctions.java rename to java/functions/src/main/java/io/deephaven/functions/LongFunctions.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ObjectFunctions.java b/java/functions/src/main/java/io/deephaven/functions/ObjectFunctions.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ObjectFunctions.java rename to java/functions/src/main/java/io/deephaven/functions/ObjectFunctions.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/PrimitiveFunctions.java b/java/functions/src/main/java/io/deephaven/functions/PrimitiveFunctions.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/PrimitiveFunctions.java rename to java/functions/src/main/java/io/deephaven/functions/PrimitiveFunctions.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ShortFunctions.java b/java/functions/src/main/java/io/deephaven/functions/ShortFunctions.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ShortFunctions.java rename to java/functions/src/main/java/io/deephaven/functions/ShortFunctions.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ToBooleanFunction.java b/java/functions/src/main/java/io/deephaven/functions/ToBooleanFunction.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ToBooleanFunction.java rename to java/functions/src/main/java/io/deephaven/functions/ToBooleanFunction.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ToByteFunction.java b/java/functions/src/main/java/io/deephaven/functions/ToByteFunction.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ToByteFunction.java rename to java/functions/src/main/java/io/deephaven/functions/ToByteFunction.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ToCharFunction.java b/java/functions/src/main/java/io/deephaven/functions/ToCharFunction.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ToCharFunction.java rename to java/functions/src/main/java/io/deephaven/functions/ToCharFunction.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ToDoubleFunction.java b/java/functions/src/main/java/io/deephaven/functions/ToDoubleFunction.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ToDoubleFunction.java rename to java/functions/src/main/java/io/deephaven/functions/ToDoubleFunction.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ToFloatFunction.java b/java/functions/src/main/java/io/deephaven/functions/ToFloatFunction.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ToFloatFunction.java rename to java/functions/src/main/java/io/deephaven/functions/ToFloatFunction.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ToIntFunction.java b/java/functions/src/main/java/io/deephaven/functions/ToIntFunction.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ToIntFunction.java rename to java/functions/src/main/java/io/deephaven/functions/ToIntFunction.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ToLongFunction.java b/java/functions/src/main/java/io/deephaven/functions/ToLongFunction.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ToLongFunction.java rename to java/functions/src/main/java/io/deephaven/functions/ToLongFunction.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ToObjectFunction.java b/java/functions/src/main/java/io/deephaven/functions/ToObjectFunction.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ToObjectFunction.java rename to java/functions/src/main/java/io/deephaven/functions/ToObjectFunction.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ToPrimitiveFunction.java b/java/functions/src/main/java/io/deephaven/functions/ToPrimitiveFunction.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ToPrimitiveFunction.java rename to java/functions/src/main/java/io/deephaven/functions/ToPrimitiveFunction.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/ToShortFunction.java b/java/functions/src/main/java/io/deephaven/functions/ToShortFunction.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/ToShortFunction.java rename to java/functions/src/main/java/io/deephaven/functions/ToShortFunction.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/TypedFunction.java b/java/functions/src/main/java/io/deephaven/functions/TypedFunction.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/TypedFunction.java rename to java/functions/src/main/java/io/deephaven/functions/TypedFunction.java diff --git a/extensions/protobuf/src/main/java/io/deephaven/functions/TypedFunctions.java b/java/functions/src/main/java/io/deephaven/functions/TypedFunctions.java similarity index 100% rename from extensions/protobuf/src/main/java/io/deephaven/functions/TypedFunctions.java rename to java/functions/src/main/java/io/deephaven/functions/TypedFunctions.java diff --git a/extensions/protobuf/src/test/java/io/deephaven/functions/ToBooleanFunctionTest.java b/java/functions/src/test/java/io/deephaven/functions/ToBooleanFunctionTest.java similarity index 100% rename from extensions/protobuf/src/test/java/io/deephaven/functions/ToBooleanFunctionTest.java rename to java/functions/src/test/java/io/deephaven/functions/ToBooleanFunctionTest.java diff --git a/extensions/protobuf/src/test/java/io/deephaven/functions/ToByteFunctionTest.java b/java/functions/src/test/java/io/deephaven/functions/ToByteFunctionTest.java similarity index 100% rename from extensions/protobuf/src/test/java/io/deephaven/functions/ToByteFunctionTest.java rename to java/functions/src/test/java/io/deephaven/functions/ToByteFunctionTest.java diff --git a/extensions/protobuf/src/test/java/io/deephaven/functions/ToCharFunctionTest.java b/java/functions/src/test/java/io/deephaven/functions/ToCharFunctionTest.java similarity index 100% rename from extensions/protobuf/src/test/java/io/deephaven/functions/ToCharFunctionTest.java rename to java/functions/src/test/java/io/deephaven/functions/ToCharFunctionTest.java diff --git a/extensions/protobuf/src/test/java/io/deephaven/functions/ToDoubleFunctionTest.java b/java/functions/src/test/java/io/deephaven/functions/ToDoubleFunctionTest.java similarity index 100% rename from extensions/protobuf/src/test/java/io/deephaven/functions/ToDoubleFunctionTest.java rename to java/functions/src/test/java/io/deephaven/functions/ToDoubleFunctionTest.java diff --git a/extensions/protobuf/src/test/java/io/deephaven/functions/ToFloatFunctionTest.java b/java/functions/src/test/java/io/deephaven/functions/ToFloatFunctionTest.java similarity index 100% rename from extensions/protobuf/src/test/java/io/deephaven/functions/ToFloatFunctionTest.java rename to java/functions/src/test/java/io/deephaven/functions/ToFloatFunctionTest.java diff --git a/extensions/protobuf/src/test/java/io/deephaven/functions/ToIntFunctionTest.java b/java/functions/src/test/java/io/deephaven/functions/ToIntFunctionTest.java similarity index 100% rename from extensions/protobuf/src/test/java/io/deephaven/functions/ToIntFunctionTest.java rename to java/functions/src/test/java/io/deephaven/functions/ToIntFunctionTest.java diff --git a/extensions/protobuf/src/test/java/io/deephaven/functions/ToLongFunctionTest.java b/java/functions/src/test/java/io/deephaven/functions/ToLongFunctionTest.java similarity index 100% rename from extensions/protobuf/src/test/java/io/deephaven/functions/ToLongFunctionTest.java rename to java/functions/src/test/java/io/deephaven/functions/ToLongFunctionTest.java diff --git a/extensions/protobuf/src/test/java/io/deephaven/functions/ToObjectFunctionTest.java b/java/functions/src/test/java/io/deephaven/functions/ToObjectFunctionTest.java similarity index 100% rename from extensions/protobuf/src/test/java/io/deephaven/functions/ToObjectFunctionTest.java rename to java/functions/src/test/java/io/deephaven/functions/ToObjectFunctionTest.java diff --git a/extensions/protobuf/src/test/java/io/deephaven/functions/ToShortFunctionTest.java b/java/functions/src/test/java/io/deephaven/functions/ToShortFunctionTest.java similarity index 100% rename from extensions/protobuf/src/test/java/io/deephaven/functions/ToShortFunctionTest.java rename to java/functions/src/test/java/io/deephaven/functions/ToShortFunctionTest.java diff --git a/java/processor-functions/build.gradle b/java/processor-functions/build.gradle new file mode 100644 index 00000000000..aed95d07f3f --- /dev/null +++ b/java/processor-functions/build.gradle @@ -0,0 +1,16 @@ +plugins { + id 'java-library' + id 'io.deephaven.project.register' +} + + +dependencies { + api project(':processor') + api project(':functions') + + implementation project(':engine-time') + + Classpaths.inheritJUnitClassic(project, 'testImplementation') + Classpaths.inheritSlf4j(project, 'slf4j-simple', 'testRuntimeOnly') + Classpaths.inheritAssertJ(project) +} diff --git a/java/processor-functions/gradle.properties b/java/processor-functions/gradle.properties new file mode 100644 index 00000000000..c186bbfdde1 --- /dev/null +++ b/java/processor-functions/gradle.properties @@ -0,0 +1 @@ +io.deephaven.project.ProjectType=JAVA_PUBLIC diff --git a/java/processor-functions/src/main/java/io/deephaven/processor/functions/ChunkUtils.java b/java/processor-functions/src/main/java/io/deephaven/processor/functions/ChunkUtils.java new file mode 100644 index 00000000000..31e6f5efbe6 --- /dev/null +++ b/java/processor-functions/src/main/java/io/deephaven/processor/functions/ChunkUtils.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending + */ +package io.deephaven.processor.functions; + +import io.deephaven.chunk.ObjectChunk; +import io.deephaven.chunk.WritableBooleanChunk; +import io.deephaven.chunk.WritableByteChunk; +import io.deephaven.chunk.WritableCharChunk; +import io.deephaven.chunk.WritableDoubleChunk; +import io.deephaven.chunk.WritableFloatChunk; +import io.deephaven.chunk.WritableIntChunk; +import io.deephaven.chunk.WritableLongChunk; +import io.deephaven.chunk.WritableObjectChunk; +import io.deephaven.chunk.WritableShortChunk; +import io.deephaven.functions.ToByteFunction; +import io.deephaven.functions.ToCharFunction; +import io.deephaven.functions.ToFloatFunction; +import io.deephaven.functions.ToShortFunction; + +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.function.ToDoubleFunction; +import java.util.function.ToIntFunction; +import java.util.function.ToLongFunction; + +final class ChunkUtils { + + // Copy from io.deephaven.kafka.ingest.ChunkUtils + + public static void applyInto( + Predicate booleanFunction, + ObjectChunk src, + int srcOffset, + WritableBooleanChunk dest, + int destOffset, + int length) { + for (int i = 0; i < length; ++i) { + dest.set(destOffset + i, booleanFunction.test(src.get(i + srcOffset))); + } + } + + public static void applyInto( + ToByteFunction byteFunction, + ObjectChunk src, + int srcOffset, + WritableByteChunk dest, + int destOffset, + int length) { + for (int i = 0; i < length; ++i) { + dest.set(destOffset + i, byteFunction.applyAsByte(src.get(srcOffset + i))); + } + } + + public static void applyInto( + ToCharFunction charFunction, + ObjectChunk src, + int srcOffset, + WritableCharChunk dest, + int destOffset, + int length) { + for (int i = 0; i < length; ++i) { + dest.set(destOffset + i, charFunction.applyAsChar(src.get(srcOffset + i))); + } + } + + public static void applyInto( + ToShortFunction shortFunction, + ObjectChunk src, + int srcOffset, + WritableShortChunk dest, + int destOffset, + int length) { + for (int i = 0; i < length; ++i) { + dest.set(destOffset + i, shortFunction.applyAsShort(src.get(srcOffset + i))); + } + } + + public static void applyInto( + ToIntFunction intFunction, + ObjectChunk src, + int srcOffset, + WritableIntChunk dest, + int destOffset, + int length) { + for (int i = 0; i < length; ++i) { + dest.set(destOffset + i, intFunction.applyAsInt(src.get(srcOffset + i))); + } + } + + public static void applyInto( + ToLongFunction longFunction, + ObjectChunk src, + int srcOffset, + WritableLongChunk dest, + int destOffset, + int length) { + for (int i = 0; i < length; ++i) { + dest.set(destOffset + i, longFunction.applyAsLong(src.get(srcOffset + i))); + } + } + + public static void applyInto( + ToFloatFunction floatFunction, + ObjectChunk src, + int srcOffset, + WritableFloatChunk dest, + int destOffset, + int length) { + for (int i = 0; i < length; ++i) { + dest.set(destOffset + i, floatFunction.applyAsFloat(src.get(srcOffset + i))); + } + } + + public static void applyInto( + ToDoubleFunction doubleFunction, + ObjectChunk src, + int srcOffset, + WritableDoubleChunk dest, + int destOffset, + int length) { + for (int i = 0; i < length; ++i) { + dest.set(destOffset + i, doubleFunction.applyAsDouble(src.get(srcOffset + i))); + } + } + + public static void applyInto( + Function objFunction, + ObjectChunk src, + int srcOffset, + WritableObjectChunk dest, + int destOffset, + int length) { + for (int i = 0; i < length; ++i) { + dest.set(destOffset + i, objFunction.apply(src.get(srcOffset + i))); + } + } +} diff --git a/extensions/kafka/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctions.java b/java/processor-functions/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctions.java similarity index 100% rename from extensions/kafka/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctions.java rename to java/processor-functions/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctions.java diff --git a/extensions/kafka/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctionsImpl.java b/java/processor-functions/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctionsImpl.java similarity index 99% rename from extensions/kafka/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctionsImpl.java rename to java/processor-functions/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctionsImpl.java index afa4763c204..cd3655ab710 100644 --- a/extensions/kafka/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctionsImpl.java +++ b/java/processor-functions/src/main/java/io/deephaven/processor/functions/ObjectProcessorFunctionsImpl.java @@ -24,7 +24,6 @@ import io.deephaven.functions.ToPrimitiveFunction; import io.deephaven.functions.ToShortFunction; import io.deephaven.functions.TypedFunction; -import io.deephaven.kafka.ingest.ChunkUtils; import io.deephaven.processor.ObjectProcessor; import io.deephaven.qst.type.ArrayType; import io.deephaven.qst.type.BoxedBooleanType; diff --git a/extensions/kafka/src/test/java/io/deephaven/processor/functions/ObjectProcessorFunctionsTest.java b/java/processor-functions/src/test/java/io/deephaven/processor/functions/ObjectProcessorFunctionsTest.java similarity index 100% rename from extensions/kafka/src/test/java/io/deephaven/processor/functions/ObjectProcessorFunctionsTest.java rename to java/processor-functions/src/test/java/io/deephaven/processor/functions/ObjectProcessorFunctionsTest.java diff --git a/java/processor/build.gradle b/java/processor/build.gradle new file mode 100644 index 00000000000..911942c33e3 --- /dev/null +++ b/java/processor/build.gradle @@ -0,0 +1,16 @@ +plugins { + id 'java-library' + id 'io.deephaven.project.register' +} + + +dependencies { + api project(':qst') + api project(':engine-chunk') + + implementation project(':engine-time') + + Classpaths.inheritJUnitClassic(project, 'testImplementation') + Classpaths.inheritSlf4j(project, 'slf4j-simple', 'testRuntimeOnly') + Classpaths.inheritAssertJ(project) +} diff --git a/java/processor/gradle.properties b/java/processor/gradle.properties new file mode 100644 index 00000000000..c186bbfdde1 --- /dev/null +++ b/java/processor/gradle.properties @@ -0,0 +1 @@ +io.deephaven.project.ProjectType=JAVA_PUBLIC diff --git a/extensions/kafka/src/main/java/io/deephaven/processor/ObjectProcessor.java b/java/processor/src/main/java/io/deephaven/processor/ObjectProcessor.java similarity index 98% rename from extensions/kafka/src/main/java/io/deephaven/processor/ObjectProcessor.java rename to java/processor/src/main/java/io/deephaven/processor/ObjectProcessor.java index 3a5b46c6253..6128ec0536b 100644 --- a/extensions/kafka/src/main/java/io/deephaven/processor/ObjectProcessor.java +++ b/java/processor/src/main/java/io/deephaven/processor/ObjectProcessor.java @@ -129,7 +129,7 @@ static ObjectProcessor noop(List> outputTypes, boolean fillWithNu * * * {@link InstantType} - * {@link ChunkType#Long} ({@link io.deephaven.time.DateTimeUtils#epochNanos(Instant)}) + * {@link ChunkType#Long} (io.deephaven.time.DateTimeUtils#epochNanos(Instant)) * * * All other {@link GenericType} diff --git a/extensions/kafka/src/main/java/io/deephaven/processor/ObjectProcessorNoop.java b/java/processor/src/main/java/io/deephaven/processor/ObjectProcessorNoop.java similarity index 100% rename from extensions/kafka/src/main/java/io/deephaven/processor/ObjectProcessorNoop.java rename to java/processor/src/main/java/io/deephaven/processor/ObjectProcessorNoop.java diff --git a/extensions/kafka/src/main/java/io/deephaven/processor/ObjectProcessorRowLimited.java b/java/processor/src/main/java/io/deephaven/processor/ObjectProcessorRowLimited.java similarity index 100% rename from extensions/kafka/src/main/java/io/deephaven/processor/ObjectProcessorRowLimited.java rename to java/processor/src/main/java/io/deephaven/processor/ObjectProcessorRowLimited.java diff --git a/extensions/kafka/src/main/java/io/deephaven/processor/ObjectProcessorStrict.java b/java/processor/src/main/java/io/deephaven/processor/ObjectProcessorStrict.java similarity index 100% rename from extensions/kafka/src/main/java/io/deephaven/processor/ObjectProcessorStrict.java rename to java/processor/src/main/java/io/deephaven/processor/ObjectProcessorStrict.java diff --git a/extensions/kafka/src/main/java/io/deephaven/processor/ObjectProcessorTypes.java b/java/processor/src/main/java/io/deephaven/processor/ObjectProcessorTypes.java similarity index 100% rename from extensions/kafka/src/main/java/io/deephaven/processor/ObjectProcessorTypes.java rename to java/processor/src/main/java/io/deephaven/processor/ObjectProcessorTypes.java diff --git a/extensions/kafka/src/test/java/io/deephaven/processor/ObjectProcessorNoopTest.java b/java/processor/src/test/java/io/deephaven/processor/ObjectProcessorNoopTest.java similarity index 100% rename from extensions/kafka/src/test/java/io/deephaven/processor/ObjectProcessorNoopTest.java rename to java/processor/src/test/java/io/deephaven/processor/ObjectProcessorNoopTest.java diff --git a/extensions/kafka/src/test/java/io/deephaven/processor/ObjectProcessorRowLimitedTest.java b/java/processor/src/test/java/io/deephaven/processor/ObjectProcessorRowLimitedTest.java similarity index 100% rename from extensions/kafka/src/test/java/io/deephaven/processor/ObjectProcessorRowLimitedTest.java rename to java/processor/src/test/java/io/deephaven/processor/ObjectProcessorRowLimitedTest.java diff --git a/extensions/kafka/src/test/java/io/deephaven/processor/ObjectProcessorStrictTest.java b/java/processor/src/test/java/io/deephaven/processor/ObjectProcessorStrictTest.java similarity index 100% rename from extensions/kafka/src/test/java/io/deephaven/processor/ObjectProcessorStrictTest.java rename to java/processor/src/test/java/io/deephaven/processor/ObjectProcessorStrictTest.java diff --git a/extensions/kafka/src/test/java/io/deephaven/processor/ObjectProcessorTest.java b/java/processor/src/test/java/io/deephaven/processor/ObjectProcessorTest.java similarity index 100% rename from extensions/kafka/src/test/java/io/deephaven/processor/ObjectProcessorTest.java rename to java/processor/src/test/java/io/deephaven/processor/ObjectProcessorTest.java diff --git a/settings.gradle b/settings.gradle index fdd30f42cd8..5ffc2315821 100644 --- a/settings.gradle +++ b/settings.gradle @@ -377,6 +377,15 @@ include ':clock-impl' include ':sql' +include ':functions' +project(':functions').projectDir = file('java/functions') + +include ':processor' +project(':processor').projectDir = file('java/processor') + +include ':processor-functions' +project(':processor-functions').projectDir = file('java/processor-functions') + file("${rootDir}/docker/registry").list().each { name -> if (file("${rootDir}/docker/registry/${name}/build.gradle").exists()) { include(":docker-${name}")