错误:编译语句时出错:失败:SemanticException第1行:未定义:-1无效的函数“替换”

时间:2019-06-05 23:49:21

标签: apache-spark hive hiveql impala hue

我正在使用HIVE

每次运行代码时,我都会不断收到以下错误消息:

Error while compiling statement: FAILED: SemanticException line 1:undefined:-1 Invalid function 'replace'

这是我的代码:

select 
ecat.count_category, eact.count_eventaction, elabel.count_eventlabel,
g.*,h.*  from db1.table1 g 
join (select count(distinct eventcategory) count_category, g.session_id from db1.table1 g group by g.session_id ) ecat on ecat.session_id = g.session_id
join (select count(distinct eventaction) count_eventaction,  g.session_id from db1.table1 g group by g.session_id) eact on eact.session_id = g.session_id
join (select count(distinct eventlabel) count_eventlabel, g.session_id from db1.table1 g group by g.session_id ) elabel on elabel.session_id = g.session_id
join (select replace(h.display_name, '\'', '') display_name, h.ncct_cat, h.ncct_cat_cd, h.ncct_trmnt_id, h.oop_proc_cd, replace(h.oop_diag_cd, '\'','') oop_diag_cd from db2.table2 h  
  where replace(h.display_name, '\'', '') =  'Ultrasound, Abdomen (Complete)' and 
   replace(h.client_code, '\'', '')='MASTER' ) h on 
   replace(h.display_name, '\'', '') = g.eventLabel and g.eventAction='ENCOUNTER';

关于我为什么继续收到此错误消息的任何想法或建议?我正在使用HIVE。

1 个答案:

答案 0 :(得分:1)

从1.3.0版开始引入了蜂巢replace函数。

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>

<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" style="-fx-background-color: BLACK;" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.OptionsScreenController">
   <children>
      <VBox layoutX="30.0" layoutY="725.0" prefHeight="38.0" prefWidth="171.0">
         <children>
            <Button fx:id="returnButton" mnemonicParsing="false" onAction="#returnToTitleScreen" prefHeight="38.0" prefWidth="188.0" stylesheets="@../css/buttons_menu.css" text="   Return   ">
               <font>
                  <Font name="Caladea" size="13.0" />
               </font>
            </Button>
         </children>
      </VBox>
      <CheckBox fx:id="fullscreenCheckBox" layoutX="30.0" layoutY="37.0" mnemonicParsing="false" onAction="#toggleFullscreen" text="Fullscreen" textFill="WHITE">
         <font>
            <Font name="Old Style" size="22.0" />
         </font>
      </CheckBox>
   </children>
</Pane>

检查您在环境中使用的配置单元版本

要解决此问题,请使用 select replace(string("kkl'll"),'\'','')="kk"; false 功能。

regexp_replace