" IN"中的多列带有Hive的条款

时间:2017-12-27 23:10:43

标签: hive mapr

hive支持带有多列的查询" 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'在表达式规范

2 个答案:

答案 0 :(得分:2)

否。如果您要将两列与两个值进行比较,则只需<html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> </head> <body> <h1>My Google Map</h1> <div id="map"></div> <script> function initMap(){ var options = { zoom:13, center:{lat:45.538681, lng:10.221905} } var map = new google.maps.Map(document.getElementById('map'), options); //!!!BUG: just doesn't work!!! var sheet = SpreadsheetApp.openById("1Ogqb5kgaY9frtzk5_uu3y_Kwr_9ma5OfjghqDwetrCM").getSheetByName("Palestre"); //!!!BUG: just doesn't work!!! //var lRow = sheet.getLastRow(); //var lCol = sheet.getLastColumn(); //var db = sheet.getRange(3, 1, lRow-2, lCol).getValues(); 即可。=AND根据您的要求。

OR

OR在Hive 0.13中

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

答案 1 :(得分:0)

我愿意

$videoid = 'cMC_PtgKDJE';
$apikey = 'xyzxyzxyz';  //My API key

$json = file_get_contents('https://www.googleapis.com/youtube/v3/videos?id='.$videoid.'&key='.$apikey.'&part=snippet');
$ytdata = json_decode($json);
print_r($ytdata);
echo '<h1>Title: ' . $ytdata->items[0]->snippet->title . '</h1>';
echo 'Description: ' . $ytdata->items[0]->snippet->description;