rdblue commented on code in PR #3709:
URL: https://github.com/apache/parquet-java/pull/3709#discussion_r3884274796


##########
dev/update-parquet-thrift.sh:
##########
@@ -0,0 +1,161 @@
+#!/usr/bin/env bash
+#
+# 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.
+#
+# Updates the inlined parquet.thrift and sidecar to a specific parquet-format
+# commit or release.
+#
+# Usage:
+#   update-parquet-thrift.sh <full-40-char-commit-hash>  -- POC: sets 
version=UNRELEASED
+#   update-parquet-thrift.sh --version <X.Y.Z>           -- release sync: 
derives commit from tag
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
+THRIFT_FILE="${REPO_ROOT}/parquet-format-structures/src/main/thrift/parquet.thrift"
+SIDECAR_FILE="${REPO_ROOT}/parquet-format-structures/src/main/thrift/parquet-format.version"
+
+# shellcheck source=parquet-thrift-lib.sh
+source "${SCRIPT_DIR}/parquet-thrift-lib.sh"
+
+usage() {
+  cat <<EOF
+Usage:
+  $0 <full-40-char-commit-hash>  POC sync — fetch parquet.thrift at that 
commit; version=UNRELEASED
+  $0 --version <X.Y.Z>           Release sync — resolve tag 
apache-parquet-format-<X.Y.Z>
+
+Only one of a commit hash or --version may be given, not both.
+Commit mode requires a full 40-character sha (short shas cannot be fetched 
from a remote).
+EOF
+  exit 1
+}
+
+if [[ $# -eq 0 ]]; then
+  usage
+fi
+
+mode=""
+commit_arg=""
+version_arg=""
+
+if [[ "$1" == "--version" ]]; then

Review Comment:
   Can't we just use a ref? If it is a tag then we get that version, otherwise 
we get the commit hash? That seems simpler than implementing CLI parsing here.



##########
dev/update-parquet-thrift.sh:
##########
@@ -0,0 +1,161 @@
+#!/usr/bin/env bash
+#
+# 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.
+#
+# Updates the inlined parquet.thrift and sidecar to a specific parquet-format
+# commit or release.
+#
+# Usage:
+#   update-parquet-thrift.sh <full-40-char-commit-hash>  -- POC: sets 
version=UNRELEASED
+#   update-parquet-thrift.sh --version <X.Y.Z>           -- release sync: 
derives commit from tag
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
+THRIFT_FILE="${REPO_ROOT}/parquet-format-structures/src/main/thrift/parquet.thrift"
+SIDECAR_FILE="${REPO_ROOT}/parquet-format-structures/src/main/thrift/parquet-format.version"
+
+# shellcheck source=parquet-thrift-lib.sh
+source "${SCRIPT_DIR}/parquet-thrift-lib.sh"
+
+usage() {
+  cat <<EOF
+Usage:
+  $0 <full-40-char-commit-hash>  POC sync — fetch parquet.thrift at that 
commit; version=UNRELEASED
+  $0 --version <X.Y.Z>           Release sync — resolve tag 
apache-parquet-format-<X.Y.Z>
+
+Only one of a commit hash or --version may be given, not both.
+Commit mode requires a full 40-character sha (short shas cannot be fetched 
from a remote).
+EOF
+  exit 1
+}
+
+if [[ $# -eq 0 ]]; then
+  usage
+fi
+
+mode=""
+commit_arg=""
+version_arg=""
+
+if [[ "$1" == "--version" ]]; then

Review Comment:
   Can't we just use a ref? If it is a tag then we get that version, otherwise 
we get the commit hash? That seems simpler than implementing CLI parsing and 
validation here.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to