The companies commercialize the Hadoop open-source big data software, which companies can use to store, process and analyze lots of different types of data.

The combined equity value of the two companies is $5.2 billion based on the closing prices of their stocks on Tuesday, according to a statement . The deal is subject to U.S. antitrust clearance, and the companies expect it to close in the first quarter of 2019.

Cloudera stock jumped as much as 25 percent on Wednesday after it announced an all-stock merger of equals with competitor Hortonworks . Hortonworks stock was halted just prior to the announcement and jumped as much as 29 percent when it resumed trading in extended hours.

"Under the terms of the transaction agreement, Cloudera stockholders will own approximately 60% of the equity of the combined company and Hortonworks stockholders will own approximately 40%," the statement said. "Hortonworks stockholders will receive 1.305 common shares of Cloudera for each share of Hortonworks stock owned, which is based on the 10-day average exchange ratio of the two companies' prices through October 1, 2018."

Hortonworks and Cloudera have discussed a deal for a long time, given the companies' complimentary assets and specializations, according to a person familiar with the matter. Hortonworks initially wanted to be sold for a premium but took an at-market deal because it was all-stock, said the person, who asked not to be named because the negotiations were private.

Cloudera's CEO, Tom Reilly, will be CEO of the combined company, and Cloudera's finance chief, Jim Frankola, will be finance chief of the combined company, the statement said. Hortonworks' CEO, Rob Bearden, will be on the board of the combined company, and Cloudera board member Marty Cole will be chairman of the combined firm's board. Morgan Stanley is advising Cloudera, and Qatalyst is advising Hortonworks.

Hortonworks, which spun out of Yahoo, went public in 2014, and Cloudera, which is larger than Hortonworks in terms of market capitalization and revenue, went public in 2017. Intel was a major Cloudera investor. Amazon's market-leading cloud unit has a distribution of Hadoop software, and another competitor of the companies, MapR, is privately held.

The announcement comes six months after Cloudera stock fell 28 percent after the company announced earnings that came in below analysts' earnings expectations. Reilly told analysts that the company would be making changes to its sales organization.

Wednesday's statement said the combined company will have $720 million in annual revenue, based on the year that ended on June 30, and more than 2,500 customers.

"We expect to generate more cash sooner than if we remained independent companies," Reilly said on a conference call after the news was announced on Wednesday.

The two companies are committed to supporting existing offerings from the two companies for at least three years but will work on a "unity release" of software, drawing on technologies from both companies' portfolios, Reilly said. The unified company wants to honor Hortonworks' commitment around providing all of its software under open-source licenses, but over time there will also be a proprietary option that offer additional features, including in the cloud, Reilly said.

The combination of Cloudera and Hortonworks could bring about more than $125 million in annualized savings, including optimizations in sales and research and development, according to an investor presentation. Some roles will be eliminated over time, Frankola said.

-- CNBC's Alex Sherman contributed to this report.