> On Jan. 7, 2015, 1:43 a.m., Jay Kreps wrote: > > samza-sql/src/main/java/org/apache/samza/sql/api/data/Tuple.java, line 34 > > <https://reviews.apache.org/r/29592/diff/1/?file=806958#file806958line34> > > > > Is a tuple basically going to be implemented with a hash map? > > > > There are couple of issues with having zillions of maps: > > 1. hash code and equality check on creation and field access > > 2. Extra Entry object for each field. > > > > Neither of these is the end of the world and this can probably be > > changed later. > > > > The hash code and equality check can be avoided if you are very > > dilligent about making sure you always use a reference to the same string > > so that the hash code is cached and the equality check is just reference > > equality. > > > > The extra entry object for each field can't be avoided, though. > > > > The alternative is something like what Avro does. An object is > > basically a wrapper around Object[] rather than a HashMap which is a > > wrapper around Entry[] where an Entry is a name/value pair. In this model > > each object has a refrence to an associated schema. The schema contains the > > mapping from name=>array_offset. > > > > You can see a complete implementation of something like that for the > > request serialization in Kafka here: > > > > https://git-wip-us.apache.org/repos/asf?p=kafka.git;a=tree;f=clients/src/main/java/org/apache/kafka/common/protocol/types;h=86d10ffa962e7ce49618be9fb9d3e67fdf438732;hb=HEAD
@Jay, thanks! The Tuple class is just defining an interface, not defining the implementation. The issues on the cost incurred by a hash map are true and we will have to address them if we choose to implement it via a hash map. Chris has raised another comment on this interface, regarding to nested data fields in a Tuple. Kafka's implementation of serialization is interesting and one possible solution to that as well. I will need to think about it more. > On Jan. 7, 2015, 1:43 a.m., Jay Kreps wrote: > > samza-sql/src/test/java/org/apache/samza/sql/store/SQLRelationStore.java, > > line 12 > > <https://reviews.apache.org/r/29592/diff/1/?file=806988#file806988line12> > > > > You have StreamSqlTask so maybe this should be SqlRelationStore instead > > of SQLRelationStore? @Jay, good catch! I have made the change in my local working copy. Will be fixed with the next update. - Yi ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/29592/#review66966 ----------------------------------------------------------- On Jan. 5, 2015, 10:19 p.m., Yi Pan (Data Infrastructure) wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/29592/ > ----------------------------------------------------------- > > (Updated Jan. 5, 2015, 10:19 p.m.) > > > Review request for samza, Chris Riccomini, Navina Ramesh, and Naveen > Somasundaram. > > > Bugs: SAMZA-482 > https://issues.apache.org/jira/browse/SAMZA-482 > > > Repository: samza > > > Description > ------- > > StreamSQL operator API draft > - This is the first draft of the StreamSQL operator APIs > - org.apache.samza.sql.api.* contains definitions of all interface classes > - org.apache.samza.sql.operators.* are skeleton implementation of some > example build-in operators > - src/test/java contains the example application (a stream-join application) > using the above APIs > > > Diffs > ----- > > build.gradle 38383bd9e3f0847d6088a4ea4c1ee6f3dcd1e430 > samza-sql/src/main/java/org/apache/samza/sql/api/data/Relation.java > PRE-CREATION > samza-sql/src/main/java/org/apache/samza/sql/api/data/RelationSpec.java > PRE-CREATION > samza-sql/src/main/java/org/apache/samza/sql/api/data/RelationStore.java > PRE-CREATION > samza-sql/src/main/java/org/apache/samza/sql/api/data/StreamSpec.java > PRE-CREATION > samza-sql/src/main/java/org/apache/samza/sql/api/data/Tuple.java > PRE-CREATION > samza-sql/src/main/java/org/apache/samza/sql/api/operators/Operator.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/RelationOperator.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/RelationRelationOperator.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/RelationTupleOperator.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/SqlOperatorFactory.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/TupleOperator.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/TupleRelationOperator.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/TupleTupleOperator.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/spec/OperatorSpec.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/spec/RelationOperatorSpec.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/spec/RelationRelationSpec.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/spec/RelationTupleSpec.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/spec/TupleOperatorSpec.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/spec/TupleRelationSpec.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/api/operators/spec/TupleTupleSpec.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/operators/factory/SimpleOperatorFactoryImpl.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/operators/output/SystemStreamOp.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/operators/output/SystemStreamSpec.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/operators/partition/PartitionOp.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/operators/partition/PartitionSpec.java > PRE-CREATION > samza-sql/src/main/java/org/apache/samza/sql/operators/relation/Join.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/operators/relation/JoinSpec.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/operators/stream/InsertStream.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/operators/stream/InsertStreamSpec.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/operators/window/BoundedTimeWindow.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/operators/window/WindowSpec.java > PRE-CREATION > > samza-sql/src/main/java/org/apache/samza/sql/operators/window/WindowState.java > PRE-CREATION > samza-sql/src/main/java/org/apache/samza/task/SqlTaskContext.java > PRE-CREATION > samza-sql/src/test/java/org/apache/samza/sql/data/IncomingMessageTuple.java > PRE-CREATION > samza-sql/src/test/java/org/apache/samza/sql/store/SQLRelationStore.java > PRE-CREATION > samza-sql/src/test/java/org/apache/samza/sql/task/StreamSqlTask.java > PRE-CREATION > settings.gradle 3a01fd66359b8c79954ae8f34eeaf4b2e3fdc0b4 > > Diff: https://reviews.apache.org/r/29592/diff/ > > > Testing > ------- > > > Thanks, > > Yi Pan (Data Infrastructure) > >
