<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: I would like to know why CROSS JOIN fails recognize columns in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27263#M19140</link>
    <description>&lt;P&gt;The underscore in the column name might be problematic, so try to put the column name in back ticks like `homepage_url`.&lt;/P&gt;&lt;P&gt;Would it be easier to use a regexp_extract &lt;A href="https://docs.databricks.com/sql/language-manual/functions/regexp_extract.html" alt="https://docs.databricks.com/sql/language-manual/functions/regexp_extract.html" target="_blank"&gt;https://docs.databricks.com/sql/language-manual/functions/regexp_extract.html&lt;/A&gt; instead of a cross join?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Oct 2022 17:25:12 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-10-14T17:25:12Z</dc:date>
    <item>
      <title>I would like to know why CROSS JOIN fails recognize columns</title>
      <link>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27262#M19139</link>
      <description>&lt;P&gt;Whenever I apply a CROSS JOIN to my Databricks SQL query I get a message letting me know that a column does not exists, but I'm not sure if the issue is with the CROSS JOIN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, the code should identify characters such as http, https, ://, / and remove those characters and add the results to a column called websiteurl without the characters aforemention. i.e.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/1358iC8F04D8BD62FE6FF/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;The code is a follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT  tt.homepage_url
        ,websiteurl = LEFT(v1.RightString,COALESCE(NULLIF(CHARINDEX('/',v1.RightString)-1,-1),150))
   FROM basecrmcbreport.organizations tt
  CROSS join (VALUES(SUBSTRING(homepage_url,CHARINDEX('//',homepage_url)+2,150)))v1(RightString)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, the above returns the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Error in SQL statement: AnalysisException: Column 'homepage_url' does not exist. Did you mean one of the following? []; line 4 pos 31;
'Project ['tt.homepage_url, unresolvedalias(('websiteurl = 'LEFT('v1.RightString, 'COALESCE('NULLIF(('CHARINDEX(/, 'v1.RightString) - 1), -1), 150))), None)]
+- 'Join Cross
   :- SubqueryAlias tt
   :  +- SubqueryAlias spark_catalog.basecrmcbreport.organizations
   :     +- Relation basecrmcbreport.organizations[uuid#2439,name#2440,type#2441,permalink#2442,cb_url#2443,rank#2444,created_at#2445,updated_at#2446,legal_name#2447,roles#2448,domain#2449,homepage_url#2450,country_code#2451,state_code#2452,region#2453,city#2454,address#2455,postal_code#2456,status#2457,short_description#2458,category_list#2459,category_groups_list#2460,num_funding_rounds#2461,total_funding_usd#2462,... 22 more fields] parquet
   +- 'SubqueryAlias v1
      +- 'UnresolvedSubqueryColumnAliases [RightString]
         +- 'UnresolvedInlineTable [col1], [['SUBSTRING('homepage_url, ('CHARINDEX(//, 'homepage_url) + 2), 150)]]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any thoughts on how to fix this?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 13:45:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27262#M19139</guid>
      <dc:creator>Carlton</dc:creator>
      <dc:date>2022-10-14T13:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: I would like to know why CROSS JOIN fails recognize columns</title>
      <link>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27263#M19140</link>
      <description>&lt;P&gt;The underscore in the column name might be problematic, so try to put the column name in back ticks like `homepage_url`.&lt;/P&gt;&lt;P&gt;Would it be easier to use a regexp_extract &lt;A href="https://docs.databricks.com/sql/language-manual/functions/regexp_extract.html" alt="https://docs.databricks.com/sql/language-manual/functions/regexp_extract.html" target="_blank"&gt;https://docs.databricks.com/sql/language-manual/functions/regexp_extract.html&lt;/A&gt; instead of a cross join?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 17:25:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27263#M19140</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-14T17:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: I would like to know why CROSS JOIN fails recognize columns</title>
      <link>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27264#M19141</link>
      <description>&lt;P&gt;Hi Joesphk,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for reaching out.&lt;/P&gt;&lt;P&gt;I tried your suggestion with the back ticks, however, I'm still getting the same error&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 18:51:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27264#M19141</guid>
      <dc:creator>Carlton</dc:creator>
      <dc:date>2022-10-14T18:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: I would like to know why CROSS JOIN fails recognize columns</title>
      <link>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27265#M19142</link>
      <description>&lt;P&gt;I think you can achieve it without CROSS JOIN.&lt;/P&gt;&lt;P&gt;Please check your query step by step so you will find error.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 12:34:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27265#M19142</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-10-20T12:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: I would like to know why CROSS JOIN fails recognize columns</title>
      <link>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27266#M19143</link>
      <description>&lt;P&gt;Hi @CARLTON PATTERSON​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope all is well! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or &lt;B&gt;mark an answer as best&lt;/B&gt;? Else please let us know if you need more help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We'd love to hear from you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Nov 2022 07:07:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27266#M19143</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-26T07:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: I would like to know why CROSS JOIN fails recognize columns</title>
      <link>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27267#M19144</link>
      <description>&lt;P&gt;@CARLTON PATTERSON​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you have given an alias "tt" to your table "basecrmcbreport.organizations", to access corresponding columns you will have to access them in format tt.&amp;lt;column_name&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in your code in line #4, try accessing the column 'homepage_url' along with table alias.&lt;/P&gt;&lt;P&gt;Example: "tt.homepage_url"&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2022 09:35:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-would-like-to-know-why-cross-join-fails-recognize-columns/m-p/27267#M19144</guid>
      <dc:creator>Shalabh007</dc:creator>
      <dc:date>2022-11-27T09:35:51Z</dc:date>
    </item>
  </channel>
</rss>

