Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tc paimon 0.9 compatible spark3.4 timestamp #16

Open
wants to merge 2 commits into
base: tc-paimon-0.9
Choose a base branch
from
Open
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 @@ -18,6 +18,7 @@

package org.apache.paimon.spark;

import org.apache.paimon.annotation.Documentation;
import org.apache.paimon.options.ConfigOption;

import static org.apache.paimon.options.ConfigOptions.key;
Expand Down Expand Up @@ -77,4 +78,16 @@ public class SparkConnectorOptions {
.defaultValue(false)
.withDescription(
"Whether to read row in the form of changelog (add rowkind column in row to represent its change type).");

@Documentation.ExcludeFromDocumentation(
"In Spark >= 3.4, does Paimon's TimestampType type conversion use the old version method by default")
public static final ConfigOption<Boolean> PAIMON_INFER_TIMESTAMP_NTZ_ENABLED =
key("spark.sql.paimon.inferTimestampNTZ.enabled")
.booleanType()
.noDefaultValue()
.withDescription(
"When false, the default is to follow the historical version method. "
+ "LocalZonedTimestamp and TimestampType are converted to "
+ "Spark's TimestampType. Otherwise, the new version method is used."
+ "The default value is true");
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@

package org.apache.paimon.spark.util.shim

import org.apache.paimon.spark.SparkConnectorOptions

import org.apache.spark.SparkEnv

object TypeUtils {

def treatPaimonTimestampTypeAsSparkTimestampType(): Boolean = false
def treatPaimonTimestampTypeAsSparkTimestampType(): Boolean = {
!SparkEnv.get.conf
.getOption(SparkConnectorOptions.PAIMON_INFER_TIMESTAMP_NTZ_ENABLED.key())
.getOrElse("true")
.toBoolean
}
}
Loading