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

ORC-1810: [C++] Add environment variable ORC_FORMAT_URL #2094

Closed
wants to merge 3 commits into from

Conversation

luffy-zh
Copy link
Contributor

What changes were proposed in this pull request?

Add an CMake option ORC_FORMAT_URL to indicate where to download the orc-format_ep

Why are the changes needed?

Handle the issue discussed apache/arrow#43417

How was this patch tested?

Test it locally

Was this patch authored or co-authored using generative AI tooling?

NO

@github-actions github-actions bot added the BUILD label Dec 24, 2024
ExternalProject_Add (orc-format_ep
URL "https://www.apache.org/dyn/closer.lua/orc/orc-format-${ORC_FORMAT_VERSION}/orc-format-${ORC_FORMAT_VERSION}.tar.gz?action=download"
URL ${ORC_FORMAT_URL}
URL_HASH SHA256=739fae5ff94b1f812b413077280361045bf92e510ef04b34a610e23a945d8cd5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User provided URL may not match the URL_HASH below. We should probably avoid passing URL_HASH to ExternalProject_Add

@@ -33,7 +33,8 @@ option(ORC_PREFER_STATIC_LZ4 "Prefer static lz4 library, if available"
option(ORC_PREFER_STATIC_ZSTD "Prefer static zstd library, if available" ON)
option(ORC_PREFER_STATIC_ZLIB "Prefer static zlib library, if available" ON)
option(ORC_PREFER_STATIC_GMOCK "Prefer static gmock library, if available" ON)

set(DEFAULT_ORC_FORMAT_URL "https://www.apache.org/dyn/closer.lua/orc/orc-format-${ORC_FORMAT_VERSION}/orc-format-${ORC_FORMAT_VERSION}.tar.gz?action=download")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about moving it to below line 139?

@@ -33,7 +33,8 @@ option(ORC_PREFER_STATIC_LZ4 "Prefer static lz4 library, if available"
option(ORC_PREFER_STATIC_ZSTD "Prefer static zstd library, if available" ON)
option(ORC_PREFER_STATIC_ZLIB "Prefer static zlib library, if available" ON)
option(ORC_PREFER_STATIC_GMOCK "Prefer static gmock library, if available" ON)

set(DEFAULT_ORC_FORMAT_URL "https://www.apache.org/dyn/closer.lua/orc/orc-format-${ORC_FORMAT_VERSION}/orc-format-${ORC_FORMAT_VERSION}.tar.gz?action=download")
set(ORC_FORMAT_URL ${DEFAULT_ORC_FORMAT_URL} CACHE STRING "URL from which to download ORC format library" FORCE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using environment variable?

if(DEFINED ENV{ORC_FORMAT_URL})
  set(ORC_FORMAT_SOURCE_URL "$ENV{ORC_FORMAT_URL}")
else()
  set(ORC_FORMAT_SOURCE_URL
    "https://www.apache.org/dyn/closer.lua/orc/orc-format-${ORC_FORMAT_VERSION}/orc-format-${ORC_FORMAT_VERSION}.tar.gz?action=download"
  )
endif()

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @luffy-zh .

  • I'm also +1 for the above @wgtmac 's comment to use env variable.
  • However, I'm -1 for allowing a different URL_HASH code because it could expose a vulnerability.

@luffy-zh luffy-zh changed the title ORC-1810: [C++] Add cmake option ORC_FORMAT_URL ORC-1810: [C++] Add environment variable ORC_FORMAT_URL Dec 26, 2024
Copy link
Member

@wgtmac wgtmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Thanks @luffy-zh!

cc @kou

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Thanks!

FYI: Apache Arrow accepts not only source URL but also checksum. It's for accepting newer/older versions than pre-defined versions at https://github.com/apache/arrow/blob/main/cpp/thirdparty/versions.txt . Apache Arrow uses ExternalProject_Add()/FetchContent_Declare() for optional external libraries. But Apache ORC uses ExternalProject_Add() for mandatory orc-format dependency. So situations in Apache Arrow and Apache ORC may be different.

@@ -33,7 +33,6 @@ option(ORC_PREFER_STATIC_LZ4 "Prefer static lz4 library, if available"
option(ORC_PREFER_STATIC_ZSTD "Prefer static zstd library, if available" ON)
option(ORC_PREFER_STATIC_ZLIB "Prefer static zlib library, if available" ON)
option(ORC_PREFER_STATIC_GMOCK "Prefer static gmock library, if available" ON)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to revert this needless change.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Thank you, @luffy-zh and all.

Happy New Year.

Merged to main for Apache ORC 2.1.

@dongjoon-hyun dongjoon-hyun added this to the 2.1.0 milestone Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants