带有配置单元的“in”子句中的多列

i2byvkas  于 2021-06-26  发布在  Hive
关注(0)|答案(2)|浏览(378)

配置单元是否支持在下面的“in”子句中使用多列查询?

select * from address where (se10,ctry_nm) IN (44444444,"USA");

我发现这个问题有以下错误-

at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken(BaseRecognizer.java:617)
    at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:115)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.atomExpression(HiveParser_IdentifiersParser.java:6318)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceFieldExpression(HiveParser_IdentifiersParser.java:6383)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnaryPrefixExpression(HiveParser_IdentifiersParser.java:6768)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnarySuffixExpression(HiveParser_IdentifiersParser.java:6828)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceBitwiseXorExpression(HiveParser_IdentifiersParser.java:7012)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceStarExpression(HiveParser_IdentifiersParser.java:7172)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedencePlusExpression(HiveParser_IdentifiersParser.java:7332)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceAmpersandExpression(HiveParser_IdentifiersParser.java:7483)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceBitwiseOrExpression(HiveParser_IdentifiersParser.java:7634)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceEqualExpression(HiveParser_IdentifiersParser.java:8164)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceNotExpression(HiveParser_IdentifiersParser.java:9177)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceAndExpression(HiveParser_IdentifiersParser.java:9296)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceOrExpression(HiveParser_IdentifiersParser.java:9455)
    at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expression(HiveParser_IdentifiersParser.java:6105)
    at org.apache.hadoop.hive.ql.parse.HiveParser.expression(HiveParser.java:45856)
    at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.searchCondition(HiveParser_FromClauseParser.java:6637)
    at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.whereClause(HiveParser_FromClauseParser.java:6545)
    at org.apache.hadoop.hive.ql.parse.HiveParser.whereClause(HiveParser.java:45911)
    at org.apache.hadoop.hive.ql.parse.HiveParser.selectStatement(HiveParser.java:41543)
    at org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:41402)
    at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:40413)
    at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpression(HiveParser.java:40283)
    at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1590)
    at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1109)
    at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:202)
    at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
    at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:397)
    at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:309)
    at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1146)
    at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1194)
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1083)
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1073)
    at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:213)
    at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:165)
    at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:376)
    at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:745)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:690)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:626)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

失败:parseexception行1:33表达式规范中“se10”附近的输入不匹配(应为“,”)

iqih9akk

iqih9akk1#

不,如果你用两个值比较两个列,一个简单的 = 就足够了。 AND 或者 OR 根据您的要求。

select * from address where se10 = 44444444 and ctry_nm = "USA";

或在Hive0.13

select * from address where se10 in (44444444) and ctry_nm in ("USA");
2vuwiymt

2vuwiymt2#

我会的

SELECT * 
  FROM address 
 WHERE CONCAT(se10,ctry_nm) IN ('44444444USA');

相关问题