草庐IT

hadoop - pig 脚本: count returns 0 on null field

我有一个pig脚本,它通过json的“公司”部分加载文件。当我执行计数时,如果文件中缺少域(或为空),则计数为0。我怎样才能将它分组为空字符串并仍然对其进行计数?文件示例:{"company":{"domain":"test1.com","name":"test1company"}}{"company":{"domain":"test1.com","name":"test1company"}}{"company":{"domain":"test1.com","name":"test2company"}}{"company":{"domain":"test2.com","name":"t

hadoop - Apache-PIG 脚本 : ERROR Invalid field projection on joined variable

我创建的Pig脚本有效,除非我尝试在我加入的字段上使用GENERATE。cc_data=LOAD'default.complaint1'USINGorg.apache.hive.hcatalog.pig.HCatLoader();cc2_data=LOAD'default.complaint2'USINGorg.apache.hive.hcatalog.pig.HCatLoader();combined=joincc_databycomplaintid,cc2_databycomplaintid;如果我对我的组合执行DESCRIBE,它会显示如下:合并:{cc_data::datere

hadoop - PIG 拉丁语 : Output Path based on Field Value

我有一个日志文件,其中包含来自多个域的日志。现在我想对它们进行一些分析并将输出存储在一个名为域的目录中。我在日志中将域作为字段值:STOREoutputlogsINTO'testpath/DOMAIN/logsUSING....这可能吗?或者我只能将输出存储在硬编码文件路径中吗? 最佳答案 如果域的名称是outputlogs中的一个字段,那么您可以使用MultiStorage从存钱jar。像这样的东西:STOREoutputlogsINTO'testpath/DOMAIN/logs'USINGMultiStorage('testpa

hadoop - "the container format for fields in a row"对文件格式意味着什么?

来自Hadoop:权威指南:TherearetwodimensionsthatgoverntablestorageinHive:therowformatandthefileformat.Therowformatdictateshowrows,andthefieldsinaparticularrow,arestored.InHiveparlance,therowformatisdefinedbyaSerDe,aportmanteauwordforaSerializer-Deserializer.Whenactingasadeserializer,whichisthecasewhenque

hadoop - Apache pig : Easier way to filter by a bunch of values from the same field

假设我想根据同一字段中的值选择数据子集。现在我必须做这样的事情TestLocationsResults=FILTERSalesDataby(StoreId=='17'orStoreId=='85'orStoreId=='12'orStoreId=='45'orStoreId=='26'orStoreId=='75'orStoreId=='13')在SQL中,我们可以简单地这样做:SELECT*FROMSalesDatawhereStoreIDIN(17,12,85,45,26,75,13)Pig中是否有我缺少的类似快捷方式? 最佳答案

hadoop - Cloudera错误-java.lang.NoSuchFieldError : IS_SECURITY_ENABLED while trying to access this field

DoneMyHome工作到处搜索,但没有找到任何解决方案java.lang.NoSuchFieldError:IS_SECURITY_ENABLEDCDH包包含冲突的jar(jsp-api-2.1-6.1.14.jar、jasper-runtime-5.5.23.jar)。jsp-api-2.1-6.1.14.jar和jasper-runtime-5.5.23.jar包含不同版本的org.apache.Constants.java类。jasper-runtime-*jar不包含字段“IS_SECURITY_ENABLED”,因此jetty在尝试访问类org.apache.Constan

hadoop - PIG 存储函数 : storing only certain fields is possible?

我有一个用例,我只需要将某些字段存储到HDFS。我知道我可以做一些foreach等等来保留感兴趣的领域,但我想知道这在Store函数中是否可行。 最佳答案 这可以使用您自定义的Store函数:http://ofps.oreilly.com/titles/9781449302641/load_and_store_funcs.html但一般来说,使用GENERATE并将所需字段存储在一些其他元组中要容易得多,这些元组将仅在STORE函数中使用 关于hadoop-PIG存储函数:storing

hadoop - Apache hive : How to use Unicode character (with octal above 177) as field delim

在我们的用例中,我们将获取格式如下的UTF-8文本数据:Data1§Data2Data3§Data4现在我们希望在ApacheHive中将Data1和Data3放在一列中,将Data2和Data4放在一列中。听起来很简单。但是,我们无法将§字符(即unicodeU+00A7“SectionSign”参见here)指定为字段分隔符。我们已经尝试了以下方法,都没有达到可接受的结果。1)使用方法终止的普通字段ROWFORMATDELIMITEDFIELDSTERMINATEDBY'§'返回(注意附加到每个单元格的?,在其他客户端中,unicode符号表示无法识别的符号)+----------

java - 读取 Avro 文件给出 AvroTypeException : missing required field error (even though the new field is declared null in schema)

我正在尝试反序列化/读取Avro文件,avro数据文件没有新字段。即使新字段在模式中声明为null,它也应该是可选的。但它仍然给我错误作为强制性的。Exceptioninthread"main"org.apache.avro.AvroTypeException:Foundcom.kiran.avro.User,expectingcom.kiran.avro.User,missingrequiredfieldlocAVRO模式声明:{"name":"loc","type":["string","null"]}使用代码读取文件:DatumReaderuserDatumReader=newS

hadoop - pig : Pulling individual fields out after a GROUP

在PigLatin中,我想从要选择的记录中提取其他字段,因为有聚合,例如MAX。我无法解释这个问题,所以这里有一个例子。假设我想获取家中最年长者的姓名:关系A是四列,(name,address,zipcode,age)B=GROUPABY(address,zipcode);#groupbytheaddress#generatetheaddress,theperson'sage,buthowdoIgrabthatperson'sname?C=FOREACHBGENERATEFLATTEN(group),MAX(age),???Name???;如何生成年龄为MAX的人的姓名?