Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import org.apache.hudi.common.model.HoodieRecord
import org.apache.spark.SPARK_VERSION
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.execution.SQLConfInjectingRDD
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.types.{StringType, StructField, StructType}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,26 @@ object HoodieCatalystExpressionUtils {
}
}

/**
* Convert Filters to Catalyst Expressions and joined by And. If convert success return an
* Non-Empty Option[Expression],or else return None.
*/
def convertToCatalystExpression(filters: Array[Filter],
tableSchema: StructType): Option[Expression] = {
val expressions = filters.map(convertToCatalystExpression(_, tableSchema))
if (expressions.forall(p => p.isDefined)) {
if (expressions.isEmpty) {
None
} else if (expressions.length == 1) {
expressions.head
} else {
Some(expressions.map(_.get).reduce(org.apache.spark.sql.catalyst.expressions.And))
}
} else {
None
}
}

/**
* Converts [[Filter]] to Catalyst [[Expression]]
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public class HoodieCommonConfig extends HoodieConfig {
.noDefaultValue()
.withDocumentation("The query instant for time travel. Without specified this option, we query the latest snapshot.");

public static final ConfigProperty<Boolean> READ_SUPPORT_V2_ENABLE = ConfigProperty
.key("hoodie.datasource.v2.read.enable")
.defaultValue(false)
.withDocumentation("If set to true, the query statement will use v2 to read");

public static final ConfigProperty<Boolean> RECONCILE_SCHEMA = ConfigProperty
.key("hoodie.datasource.write.reconcile.schema")
.defaultValue(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ object DataSourceReadOptions {

val SCHEMA_EVOLUTION_ENABLED: ConfigProperty[Boolean] = HoodieCommonConfig.SCHEMA_EVOLUTION_ENABLE

val READ_SUPPORT_V2_ENABLE: ConfigProperty[Boolean] = HoodieCommonConfig.READ_SUPPORT_V2_ENABLE

/** @deprecated Use {@link QUERY_TYPE} and its methods instead */
@Deprecated
val QUERY_TYPE_OPT_KEY = QUERY_TYPE.key()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import org.apache.spark.sql.catalyst.util.DateTimeUtils
import org.apache.spark.sql.{Row, SparkSession}
import org.apache.spark.util.Utils
import org.joda.time.DateTimeZone
import org.scalactic.source
import org.scalatest.{BeforeAndAfterAll, FunSuite, Tag}

import java.io.File
Expand Down Expand Up @@ -76,7 +75,7 @@ class HoodieSparkSqlTestBase extends FunSuite with BeforeAndAfterAll {
}
}

override protected def test(testName: String, testTags: Tag*)(testFun: => Any /* Assertion */)(implicit pos: source.Position): Unit = {
override protected def test(testName: String, testTags: Tag*)(testFun: => Any /* Assertion */)(implicit pos: org.scalactic.source.Position): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I have introduced org.apache.spark.sql.hudi.source package dircetory for HoodieBatchScan, just avoid conflict.

super.test(testName, testTags: _*)(
try {
testFun
Expand Down
Loading