Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

Copilot was spending 12 minutes discovering it needs to build Calcite from source when working on SQL compiler features. The build instructions were embedded in build.sh, making them non-discoverable during environment setup.

Changes

New sql-to-dbsp-compiler/build_calcite.sh

  • Extracts Calcite build logic into standalone script (100 lines)
  • Runs independently without triggering SQL compiler build
  • Command-line flags (-n/-c) override calcite_version.env settings
  • Handles clone, build, and Maven installation

Updated sql-to-dbsp-compiler/build.sh

  • Simplified from 77 to 42 lines (delegates to build_calcite.sh)
  • Maintains identical CLI interface and behavior

Updated .github/workflows/copilot-setup-steps.yml

  • Added step after Java setup to pre-build Calcite from source
  • Eliminates version mismatch discovery delay

Example

# Build only Calcite (new capability)
./build_calcite.sh

# Build SQL compiler (same as before, now calls build_calcite.sh internally)
./build.sh

# Override environment settings
./build_calcite.sh -c  # Use current release
./build.sh -n          # Use next/unreleased
Original prompt

This section details on the original issue you should resolve

<issue_title>Instruct Copilot to build Calcite from source when setting up its work environment</issue_title>
<issue_description>When implementing a feature in the SQL compiler, Copilot got confused by the version mismatch of Calcite dependency and spent 12 minutes until it realized it needs to build it from source. Instructions in .github/copilot-instructions.md did not seem to avoid this.

Copilot needs to be instructed to build Calcite from source.</issue_description>

<agent_instructions>Separate out the logic of sql-to-dbsp-compiler/build.sh that builds Calcite from source as a dependency into build_calcite.sh, which build.sh then uses. Then add a step to .github/workflows/copilot-setup-steps.yml after installing Java to build Calcite from source. This way, running only build_calcite.sh should not trigger the SQL compiler build, and running build.sh has exactly the same behavior (and command line options) as before.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 20, 2026 16:25
… setup

Co-authored-by: Karakatiza666 <8537259+Karakatiza666@users.noreply.github.com>
Co-authored-by: Karakatiza666 <8537259+Karakatiza666@users.noreply.github.com>
Copilot AI changed the title [WIP] Instruct to build Calcite from source during setup Extract Calcite build to standalone script and pre-build in Copilot setup Jan 20, 2026
Copilot AI requested a review from Karakatiza666 January 20, 2026 16:30
@Karakatiza666 Karakatiza666 requested review from mihaibudiu and removed request for Karakatiza666 January 20, 2026 16:36
@Karakatiza666 Karakatiza666 marked this pull request as ready for review January 20, 2026 16:39
Copilot AI review requested due to automatic review settings January 20, 2026 16:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request extracts Calcite build logic from the SQL compiler build script into a standalone script and adds a Copilot setup step to pre-build Calcite from source. This eliminates the ~12-minute delay Copilot experiences when discovering version mismatches during SQL compiler development.

Changes:

  • Extracted Calcite build logic into standalone build_calcite.sh script (100 lines) that can be run independently
  • Simplified build.sh from 77 to 42 lines by delegating to build_calcite.sh while maintaining identical CLI interface
  • Added Calcite pre-build step to Copilot setup workflow after Java installation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
sql-to-dbsp-compiler/build_calcite.sh New standalone script that handles Calcite cloning, building, and Maven installation with command-line flags to override environment settings
sql-to-dbsp-compiler/build.sh Simplified script that delegates Calcite building to build_calcite.sh while preserving the same command-line interface
.github/workflows/copilot-setup-steps.yml Added step to pre-build Calcite from source after Java setup, eliminating discovery delays for Copilot

Comment on lines +74 to +81
19* | 20* | 21*) ;;
2[5-9]*)
echo >&2 "*** ERROR *** Java version 25+ does not work with Calcite"
exit 1
;;
*)
echo "*** WARNING *** Only Java versions 19, 20, and 21 are known to work with Calcite but you have $jvm_version"
;;
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The indentation in this case statement uses tabs instead of spaces, which is inconsistent with the rest of the file. The file uses spaces elsewhere (4 spaces for the main if block, etc.), but this section uses tabs. This should be standardized to use spaces for consistency.

Suggested change
19* | 20* | 21*) ;;
2[5-9]*)
echo >&2 "*** ERROR *** Java version 25+ does not work with Calcite"
exit 1
;;
*)
echo "*** WARNING *** Only Java versions 19, 20, and 21 are known to work with Calcite but you have $jvm_version"
;;
19* | 20* | 21*) ;;
2[5-9]*)
echo >&2 "*** ERROR *** Java version 25+ does not work with Calcite"
exit 1
;;
*)
echo "*** WARNING *** Only Java versions 19, 20, and 21 are known to work with Calcite but you have $jvm_version"
;;

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +58
if [ "${CALCITE_BUILD_NEXT}" = "y" ]; then
update_pom "${CALCITE_NEXT}"

if [ ! -d "${CALCITE_BUILD_DIR}" ]; then
echo "Cloning Calcite into ${CALCITE_BUILD_DIR}"
git clone --depth 1 --quiet --single-branch --branch "${CALCITE_BRANCH}" ${GIT_ARGS} "${CALCITE_REPO}" "${CALCITE_BUILD_DIR}"
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The script uses environment variables (CALCITE_NEXT, CALCITE_BRANCH, CALCITE_REPO) that are not defined with default values. If the calcite_version.env file is missing or incomplete, and someone runs this script with the -n flag or if CALCITE_BUILD_NEXT is set to "y", the script will fail with undefined variable errors. These variables should have default values defined at the beginning of the script, similar to CALCITE_BUILD_DIR and CALCITE_CURRENT.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot document at the beginning of build_calcite.sh that these environment variables do not have a default and need to be defined if using the -n flag or whatever

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Instruct Copilot to build Calcite from source when setting up its work environment

2 participants