wuchong commented on a change in pull request #11396: [FLINK-16170][connectors/elasticsearch]SearchTemplateRequest ClassNotFoundException when use flink-sql-connector-elasticsearch7 URL: https://github.com/apache/flink/pull/11396#discussion_r393466783
########## File path: flink-end-to-end-tests/test-scripts/test_sql_client.sh ########## @@ -262,10 +271,66 @@ EOF JOB_ID=$($FLINK_DIR/bin/sql-client.sh embedded \ --jar $KAFKA_SQL_JAR \ --jar $JSON_SQL_JAR \ - --jar $ELASTICSEARCH_SQL_JAR \ + --jar $ELASTICSEARCH6_SQL_JAR \ --jar $SQL_TOOLBOX_JAR \ --environment $SQL_CONF \ - --update "$SQL_STATEMENT_5" | grep "Job ID:" | sed 's/.* //g') + --update "$SQL_STATEMENT_3" | grep "Job ID:" | sed 's/.* //g') # 3 upsert results and 6 append results and 3 match_recognize results verify_result_line_number 12 "$ELASTICSEARCH_INDEX" + +############################################################################### +# Test sql-connector-elasticsearch7 +############################################################################### +echo "Executing SQL: Values -> Elasticsearch7 (upsert)" + +# prepare client_conf and sql statement +ELASTICSEARCH_VERSION=7 +ELASTICSEARCH7_MAC_DOWNLOAD_URL='https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.1-darwin-x86_64.tar.gz' +ELASTICSEARCH7_LINUX_DOWNLOAD_URL='https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.1-linux-x86_64.tar.gz' + +SQL_CONF_CONTENT=$(cat ${SQL_CONF}) +cat >> $SQL_CONF << EOF +${SQL_CONF_CONTENT//version: 6/version: 7} +EOF + +SQL_STATEMENT_4=$(cat << EOF +INSERT INTO ElasticsearchUpsertSinkTable + SELECT user_id, user_name, COUNT(*) AS user_count + FROM (VALUES (1, 'Bob'), (22, 'Tom'), (42, 'Kim'), (42, 'Kim'), (42, 'Kim'), (1, 'Bob')) + AS UserCountTable(user_id, user_name) + GROUP BY user_id, user_name +EOF +) + +# elastcisearch offers different release binary file for corresponding system since version 7. +case "$(uname -s)" in + Linux*) OS_TYPE=linux;; + Darwin*) OS_TYPE=mac;; + *) OS_TYPE="UNKNOWN:${unameOut}" +esac +OS_TYPE='test' +if [[ "$OS_TYPE" == "mac" ]]; then + DOWNLOAD_URL=$ELASTICSEARCH_MAC_DOWNLOAD_URL +elif [[ "$OS_TYPE" == "linux" ]]; then + DOWNLOAD_URL=$ELASTICSEARCH7_LINUX_DOWNLOAD_URL +else + echo "unsupported OS, only support Mac OS、Linux now." + exit 0 +fi Review comment: Why do we need this? Does linux binary not work in mac? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
