-
Notifications
You must be signed in to change notification settings - Fork 595
[GLUTEN-10247][FLINK] Support date_format function #10248
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
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
2dd79f2
Support date_format function
KevinyhZou 3ad14c9
consider about timezone
KevinyhZou 2573bbc
fix ci
KevinyhZou 57471ad
fix review
KevinyhZou c05c6b1
Merge branch 'main' into support_dateformat
KevinyhZou b7e055a
run and check timezone set error
KevinyhZou 86da02c
check error
KevinyhZou f99bf27
Merge branch 'main' into support_dateformat
KevinyhZou 9700c1f
fix reviews
KevinyhZou ccc347c
Merge branch 'main' into support_dateformat
KevinyhZou b07357a
test on remove arrow.memory.core from flink.yml
KevinyhZou 8b95500
fix ci
KevinyhZou af21e3a
Merge branch 'main' into support_dateformat
KevinyhZou 4bff55b
remove some useless changes
KevinyhZou 527eb42
fix ci
KevinyhZou 6e20d64
fix ut add timestamp_ltz type for datetime format
KevinyhZou 1ee5c76
fix reviews
KevinyhZou 16db006
update flink.yml for test
KevinyhZou 0bd0d77
for ci testing
KevinyhZou d97c6f2
Merge branch 'main' into support_dateformat
KevinyhZou f53101e
check ci
KevinyhZou f19774c
Merge branch 'main' into support_dateformat
KevinyhZou ca257e9
update flink.yml
KevinyhZou 948472f
remove disabled label
KevinyhZou 5d0e7e5
fix reviews
KevinyhZou 3638ce2
revert flink.yml
KevinyhZou 40da044
fix reviews
KevinyhZou 17a8ebf
update flink.yml
KevinyhZou e40a221
update flink.md
KevinyhZou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...-flink/runtime/src/main/java/org/apache/gluten/table/runtime/config/VeloxQueryConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.gluten.table.runtime.config; | ||
|
|
||
| import io.github.zhztheplayer.velox4j.config.Config; | ||
|
|
||
| import org.apache.flink.api.common.functions.RuntimeContext; | ||
| import org.apache.flink.configuration.Configuration; | ||
| import org.apache.flink.streaming.api.operators.StreamingRuntimeContext; | ||
| import org.apache.flink.table.api.config.TableConfigOptions; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| public class VeloxQueryConfig { | ||
|
|
||
| private static final String keyVeloxAdjustTimestampToSessionTimeZone = | ||
| "adjust_timestamp_to_session_timezone"; | ||
| private static final String keyVeloxSessionTimezone = "session_timezone"; | ||
|
|
||
| public static Config getConfig(RuntimeContext context) { | ||
| if (!(context instanceof StreamingRuntimeContext)) { | ||
| return Config.empty(); | ||
| } | ||
| Configuration config = ((StreamingRuntimeContext) context).getJobConfiguration(); | ||
| Map<String, String> configMap = new HashMap<>(); | ||
| configMap.put(keyVeloxAdjustTimestampToSessionTimeZone, "true"); | ||
| String localTimeZone = config.get(TableConfigOptions.LOCAL_TIME_ZONE); | ||
| // As flink's default timezone value is `default`, it is not a valid timezone id, so we should | ||
| // convert it to `UTC` timezone. | ||
| if (TableConfigOptions.LOCAL_TIME_ZONE.defaultValue().equals(localTimeZone)) { | ||
| configMap.put(keyVeloxSessionTimezone, "UTC"); | ||
| } else { | ||
| configMap.put(keyVeloxSessionTimezone, localTimeZone); | ||
| } | ||
| return Config.create(configMap); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,9 +17,9 @@ | |
| package org.apache.gluten.table.runtime.operators; | ||
|
|
||
| import org.apache.gluten.streaming.api.operators.GlutenOperator; | ||
| import org.apache.gluten.table.runtime.config.VeloxQueryConfig; | ||
|
|
||
| import io.github.zhztheplayer.velox4j.Velox4j; | ||
| import io.github.zhztheplayer.velox4j.config.Config; | ||
| import io.github.zhztheplayer.velox4j.config.ConnectorConfig; | ||
| import io.github.zhztheplayer.velox4j.connector.ExternalStreamConnectorSplit; | ||
| import io.github.zhztheplayer.velox4j.connector.ExternalStreams; | ||
|
|
@@ -94,11 +94,13 @@ public GlutenVectorTwoInputOperator( | |
| private void initGlutenTask() { | ||
| memoryManager = MemoryManager.create(AllocationListener.NOOP); | ||
| session = Velox4j.newSession(memoryManager); | ||
| query = new Query(glutenPlan, Config.empty(), ConnectorConfig.empty()); | ||
| query = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems missing the GlutenVectorOneInputOperator
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
| new Query( | ||
| glutenPlan, VeloxQueryConfig.getConfig(getRuntimeContext()), ConnectorConfig.empty()); | ||
| task = session.queryOps().execute(query); | ||
| LOG.debug("Gluten Plan: {}", Serde.toJson(glutenPlan)); | ||
| LOG.debug("OutTypes: {}", outputTypes.keySet()); | ||
| LOG.debug("RuntimeContex: {}", getRuntimeContext().getClass().getName()); | ||
| LOG.debug("RuntimeContext: {}", getRuntimeContext().getClass().getName()); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.