Skip to content

Commit

Permalink
fix query recorder class loading (OpenLineage#3281)
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Leszczynski <[email protected]>
  • Loading branch information
pawel-big-lebowski authored Nov 28, 2024
1 parent 7d7c715 commit 66a0b8b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ SQLQueryRecorder resolveQueryRecorder() {
String resolveParserClass(String version) {
if (version.startsWith("2.")) {
return SPARK_3_2_OR_BELOW;
} else if (version.startsWith("3.0")) {
return SPARK_3_2_OR_BELOW;
} else if (version.startsWith("3.1")) {
return SPARK_3_2_OR_BELOW;
} else if (version.startsWith("3.2")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
/* Copyright 2018-2024 contributors to the OpenLineage project
/* SPDX-License-Identifier: Apache-2.0
*/

package io.openlineage.spark.agent.lifecycle;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

class SparkSQLQueryParserTest {

SparkSQLQueryParser parser = new SparkSQLQueryParser();

@ParameterizedTest
@CsvSource({
"2.4.8,io.openlineage.spark32.agent.lifecycle.plan.OpenLineageSQLQueryRecorder",
"3.0.1,io.openlineage.spark32.agent.lifecycle.plan.OpenLineageSQLQueryRecorder",
"3.1.0,io.openlineage.spark32.agent.lifecycle.plan.OpenLineageSQLQueryRecorder",
"3.2.0,io.openlineage.spark32.agent.lifecycle.plan.OpenLineageSQLQueryRecorder",
"3.3.0,io.openlineage.spark33.agent.lifecycle.plan.OpenLineageSQLQueryRecorder",
"3.4.0,io.openlineage.spark33.agent.lifecycle.plan.OpenLineageSQLQueryRecorder",
"3.5.0,io.openlineage.spark33.agent.lifecycle.plan.OpenLineageSQLQueryRecorder",
"4.0.0,io.openlineage.spark33.agent.lifecycle.plan.OpenLineageSQLQueryRecorder"
})
void testResolveParserClass(String sparkVersion, String expectedParserClass) {
assertThat(parser.resolveParserClass(sparkVersion)).isEqualTo(expectedParserClass);
}
}

0 comments on commit 66a0b8b

Please sign in to comment.