CREATE TEMPORARY TABLE es_sink_beesforce_poc_list (
id STRING,
pocMiddleId STRING,
...,
validationType INT,
PRIMARY KEY (id) NOT ENFORCED -- 主键可选,如果定义了主键,则作为文档ID,否则文档ID将为随机值。
) WITH (
'connector' = 'elasticsearch-7',
'index' = '*****',
'hosts' = '*****',
'username' ='*****',
'password' ='*****'
);
INSERT INTO es_sink_beesforce_poc_list WITH -- 渠道 层级 1
channel_info_level_1 AS (
SELECT
channel.channel_code,
channel.channel_name,
channel.channel_code AS parent_channel_code,
channel.channel_name AS parent_channel_name
FROM
`****`.`****`.poc_channel_info /*+ OPTIONS('server-id'='5400-5409') */
AS channel
WHERE
channel.channel_level = 1
),-- 渠道 层级 2
channel_info_level_2 AS (
SELECT
channel.channel_code,
channel.channel_name,
concat( parent.parent_channel_code, ',', channel.channel_code ) AS parent_channel_code,
concat( parent.parent_channel_name, '-', channel.channel_name ) AS parent_channel_name
FROM
`****`.`****`.poc_channel_info /*+ OPTIONS('server-id'='5410-5419') */
AS channel
LEFT JOIN channel_info_level_1 AS parent ON channel.parent_channel_code = parent.channel_code
WHERE
channel.channel_level = 2
),-- 渠道 层级 3
channel_info_level_3 AS (
SELECT
channel.channel_code,
channel.channel_name,
concat( parent.parent_channel_code, ',', channel.channel_code ) AS parent_channel_code,
concat( parent.parent_channel_name, '-', channel.channel_name ) AS parent_channel_name
FROM
`****`.`****`.poc_channel_info /*+ OPTIONS('server-id'='5420-5429') */
AS channel
LEFT JOIN channel_info_level_2 AS parent ON channel.parent_channel_code = parent.channel_code
WHERE
channel.channel_level = 3
),-- 渠道 层级 4
channel_info_level_4 AS (
SELECT
channel.channel_code,
channel.channel_name,
concat( parent.parent_channel_code, ',', channel.channel_code ) AS parent_channel_code,
concat( parent.parent_channel_name, '-', channel.channel_name ) AS parent_channel_name
FROM
`****`.`****`.poc_channel_info /*+ OPTIONS('server-id'='5430-5439') */
AS channel
LEFT JOIN channel_info_level_3 AS parent ON channel.parent_channel_code = parent.channel_code
WHERE
channel.channel_level = 4
),-- 查询 渠道层级
channel_info_level AS ( SELECT * FROM channel_info_level_1 UNION ALL SELECT * FROM channel_info_level_2 UNION ALL SELECT * FROM channel_info_level_3 UNION ALL SELECT * FROM channel_info_level_4 )
SELECT
concat(
poc_info.poc_middle_id,
'_',
IF
( salesman_ref.id IS NOT NULL, salesman_ref.id, '' )) AS id,
poc_info.poc_middle_id AS pocMiddleId,
...,
poc_info.validation_type AS validationType
FROM
`****`.`****`.poc_base_info /*+ OPTIONS('server-id'='5440-5449') */
AS poc_info
LEFT JOIN (
SELECT
label_ref.poc_middle_id,
LISTAGG ( label_info.label_code ) label_code,
LISTAGG ( label_info.label_name ) label_name
FROM
`****`.`****`.poc_label_ref /*+ OPTIONS('server-id'='5450-5459') */
AS label_ref
INNER JOIN `****`.`****`.poc_label_info /*+ OPTIONS('server-id'='5460-5469') */
AS label_info ON label_ref.label_code = label_info.label_code
AND label_ref.deleted = 0
GROUP BY
label_ref.poc_middle_id
) label_info ON poc_info.poc_middle_id = label_info.poc_middle_id
LEFT JOIN channel_info_level AS channel_info ON poc_info.channel_format_code = channel_info.channel_code
LEFT JOIN `****`.`****`.poc_salesman_ref /*+ OPTIONS('server-id'='5470-5479') */
AS salesman_ref ON poc_info.poc_middle_id = salesman_ref.poc_middle_id
LEFT JOIN `****`.`****`.poc_extend_info /*+ OPTIONS('server-id'='5480-5489') */
AS extend_info ON poc_info.poc_middle_id = extend_info.poc_middle_id
LEFT JOIN `****`.`****`.wccs_dict_info /*+ OPTIONS('server-id'='5490-5499') */
AS wccs_chain ON extend_info.wccs_chain_code_2022_version = wccs_chain.dict_code
AND wccs_chain.dict_type = 4
LEFT JOIN `****`.`****`.wccs_dict_info /*+ OPTIONS('server-id'='5500-5509') */
AS wccs_grade ON extend_info.wccs_grade_code_2022_version = wccs_grade.dict_code
AND wccs_grade.dict_type = 6
LEFT JOIN `****`.`****`.poc_bees_project_info /*+ OPTIONS('server-id'='6300-6309') */
AS bees_project_info ON poc_info.poc_middle_id = bees_project_info.poc_middle_id
AND bees_project_info.deleted = 0
WHERE
poc_info.deleted = 0
AND poc_info.poc_middle_id IS NOT NULL;
4.0.0abi-cloud-beesforce-data-boardcom.abi1.0.0-SNAPSHOTabi-cloud-beesforce-data-board-flinkabi-cloud-beesforce-data-board-flinkabi api projectUTF-81.13.11.82.11${target.java.version}${target.java.version}2.12.4apache.snapshotsApache Development Snapshot Repositoryhttps://repository.apache.org/content/repositories/snapshots/falsetrueorg.apache.flinkflink-java${flink.version}providedorg.apache.flinkflink-streaming-java_${scala.binary.version}${flink.version}providedorg.apache.flinkflink-clients_${scala.binary.version}${flink.version}providedorg.apache.flinkflink-connector-elasticsearch7_${scala.binary.version}${flink.version}com.ververicaflink-connector-mysql-cdc2.2.0org.apache.flinkflink-connector-base${flink.version}org.apache.flinkflink-table-common${flink.version}org.apache.logging.log4jlog4j-slf4j-impl${log4j.version}runtimeorg.apache.logging.log4jlog4j-api${log4j.version}runtimeorg.apache.logging.log4jlog4j-core${log4j.version}runtimeorg.projectlomboklombok1.18.24com.alibabadruid1.1.10cn.hutoolhutool-json5.7.16org.apache.commonscommons-text1.9org.apache.maven.pluginsmaven-compiler-plugin3.1${target.java.version}${target.java.version}org.apache.maven.pluginsmaven-shade-plugin3.1.1packageshadeorg.apache.flink:force-shadingcom.google.code.findbugs:jsr305org.slf4j:*org.apache.logging.log4j:**:*META-INF/*.SFMETA-INF/*.DSAMETA-INF/*.RSAorg.eclipse.m2elifecycle-mapping1.0.0org.apache.maven.pluginsmaven-shade-plugin[3.1.1,)shadeorg.apache.maven.pluginsmaven-compiler-plugin[3.1,)testCompilecompile
日志打印级别控制,log4j2.properties
################################################################################
# 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.
################################################################################
rootLogger.level = INFO
rootLogger.appenderRef.console.ref = ConsoleAppender
appender.console.name = ConsoleAppender
appender.console.type = CONSOLE
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{HH:mm:ss,SSS} %-5p %-60c %x - %m%n
public class OcuppyMoreThanHalf {
/**
* Q74 数组中有一个数字出现的次数超过了数组长度的一半,找出这个数字
* two solutions:
* 1.O(n)
* see <beauty of coding>--每次删除两个不同的数字,不改变数组的特性
* 2.O(nlogn)
* 排序。中间
cygwin很多命令显示command not found的解决办法
修改cygwin.BAT文件如下
@echo off
D:
set CYGWIN=tty notitle glob
set PATH=%PATH%;d:\cygwin\bin;d:\cygwin\sbin;d:\cygwin\usr\bin;d:\cygwin\usr\sbin;d:\cygwin\us