[ https://issues.apache.org/jira/browse/THRIFT-2877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17368390#comment-17368390 ]
Sai Hemanth Gantasala commented on THRIFT-2877: ----------------------------------------------- [~roshangeorge] A unit test in impala (thrift@09.3.1) is referring to HiveMetastore (0.13.0), this is the stack trace: Here the Partition class in HiveMetastore has generated hashCode method but Impala is trying to refer to the hashcode method in its thrift jar(hashcode method not implemented) and hence we are seeing NoSuchMethod error. {code:java} TestMetastoreService::test_fallback_get_partitions_by_names The stack trace in /tmp/catalogd.INFO is: 617 08:40:47.075518 18851 CatalogMetastoreServer.java:226] Received exception while executing get_partitions_by_names_req : Java exception follows: java.lang.NoSuchMethodError: org.apache.thrift.TBaseHelper.hashCode(J)I at org.apache.hadoop.hive.metastore.api.Partition.hashCode(Partition.java:971) at java.util.HashMap.hash(HashMap.java:339) at java.util.HashMap.put(HashMap.java:612) at org.apache.impala.catalog.CatalogHmsAPIHelper.loadAndSetFileMetadataFromFs(CatalogHmsAPIHelper.java:527) at org.apache.impala.catalog.metastore.MetastoreServiceHandler.get_partitions_by_names_req(MetastoreServiceHandler.java:1443) at org.apache.impala.catalog.metastore.CatalogMetastoreServiceHandler.get_partitions_by_names_req(CatalogMetastoreServiceHandler.java:154) 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.impala.catalog.metastore.CatalogMetastoreServer$TimingInvocationHandler.invoke(CatalogMetastoreServer.java:223) at com.sun.proxy.$Proxy12.get_partitions_by_names_req(Unknown Source) at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$get_partitions_by_names_req.getResult(ThriftHiveMetastore.java:20087) at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$get_partitions_by_names_req.getResult(ThriftHiveMetastore.java:20066) at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39) at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) {code} > Optimize generated hashCode > --------------------------- > > Key: THRIFT-2877 > URL: https://issues.apache.org/jira/browse/THRIFT-2877 > Project: Thrift > Issue Type: Improvement > Components: Java - Compiler > Affects Versions: 0.9.3 > Reporter: Mike Rettig > Assignee: Roshan George > Priority: Critical > Fix For: 0.10.0 > > > The generated java hashCode method allocates an ArrayList then appends the > fields to the list. Primitive fields will be boxed when added to the list. > The generated code shouldn't allocate a list or box primitives. The hashCode > can be calculated by using a primitive int and some static utility methods > which can return the hashCode for each type. > out << indent() << "@Override" << endl << indent() << "public int hashCode() > {" << endl; > 1839 indent_up(); > 1840 indent(out) << "List<Object> list = new ArrayList<Object>();" << endl; > 1841 > 1842 for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { > 1843 out << endl; > 1844 > 1845 t_type* t = get_true_type((*m_iter)->get_type()); > 1846 bool is_optional = (*m_iter)->get_req() == t_field::T_OPTIONAL; > 1847 bool can_be_null = type_can_be_null(t); > 1848 string name = (*m_iter)->get_name(); > 1849 > 1850 string present = "true"; > 1851 > 1852 if (is_optional || can_be_null) { > 1853 present += " && (" + generate_isset_check(*m_iter) + ")"; > 1854 } > 1855 > 1856 indent(out) << "boolean present_" << name << " = " << present << ";" > << endl; > 1857 indent(out) << "list.add(present_" << name << ");" << endl; > 1858 indent(out) << "if (present_" << name << ")" << endl; > 1859 if (t->is_enum()) { > 1860 indent(out) << " list.add(" << name << ".getValue());" << endl; > 1861 } else { > 1862 indent(out) << " list.add(" << name << ");" << endl; > 1863 } > 1864 } > 1865 > 1866 out << endl; > 1867 indent(out) << "return list.hashCode();" << endl; > 1868 indent_down(); > 1869 indent(out) << "}" << endl << endl; > 1870 } -- This message was sent by Atlassian Jira (v8.3.4#803005)