frankgh commented on code in PR #45: URL: https://github.com/apache/cassandra-analytics/pull/45#discussion_r1541520438
########## cassandra-analytics-core/src/test/java/org/apache/cassandra/spark/bulkwriter/MockBulkWriterContext.java: ########## @@ -77,6 +79,7 @@ public class MockBulkWriterContext implements BulkWriterContext, ClusterInfo, Jo private ConsistencyLevel.CL consistencyLevel; private int sstableDataSizeInMB = 128; private int sstableWriteBatchSize = 2; + private CassandraBridge bridge = CassandraBridgeFactory.get(CassandraVersion.FOURZERO); Review Comment: should this be passed to the mock BW context? I wonder what tests for 50, 51 will look like if we use 40 here always? ########## cassandra-bridge/src/main/java/org/apache/cassandra/spark/data/BridgeUdtValue.java: ########## @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cassandra.spark.data; + +import java.io.Serializable; +import java.util.Map; +import java.util.Objects; + +/** + * The BridgeUdtValue class exists because the Cassandra values produced (UDTValue) are not serializable + * because they come from the classloader inside the bridge, and therefore can't be passed around + * from one Spark phase to another. Therefore, we build a map of these instances (potentially nested) + * and return them from the conversion stage for later use when the writer actually writes them. + */ +public class BridgeUdtValue implements Serializable +{ + public final String name; + public final Map<String, Object> udtMap; + + public BridgeUdtValue(String name, Map<String, Object> valueMap) + { + this.name = name; + this.udtMap = valueMap; + } + + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + BridgeUdtValue udtValue = (BridgeUdtValue) o; + return Objects.equals(name, udtValue.name) && Objects.equals(udtMap, udtValue.udtMap); + } + + public int hashCode() Review Comment: NIT, override annotation ########## cassandra-bridge/src/main/java/org/apache/cassandra/spark/data/BridgeUdtValue.java: ########## @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cassandra.spark.data; + +import java.io.Serializable; +import java.util.Map; +import java.util.Objects; + +/** + * The BridgeUdtValue class exists because the Cassandra values produced (UDTValue) are not serializable + * because they come from the classloader inside the bridge, and therefore can't be passed around + * from one Spark phase to another. Therefore, we build a map of these instances (potentially nested) + * and return them from the conversion stage for later use when the writer actually writes them. + */ +public class BridgeUdtValue implements Serializable +{ + public final String name; + public final Map<String, Object> udtMap; + + public BridgeUdtValue(String name, Map<String, Object> valueMap) + { + this.name = name; + this.udtMap = valueMap; + } + + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + BridgeUdtValue udtValue = (BridgeUdtValue) o; + return Objects.equals(name, udtValue.name) && Objects.equals(udtMap, udtValue.udtMap); + } + + public int hashCode() + { + return Objects.hash(name, udtMap); + } + + public String toString() Review Comment: NIT, override annotation ########## cassandra-bridge/src/main/java/org/apache/cassandra/spark/data/BridgeUdtValue.java: ########## @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cassandra.spark.data; + +import java.io.Serializable; +import java.util.Map; +import java.util.Objects; + +/** + * The BridgeUdtValue class exists because the Cassandra values produced (UDTValue) are not serializable + * because they come from the classloader inside the bridge, and therefore can't be passed around + * from one Spark phase to another. Therefore, we build a map of these instances (potentially nested) + * and return them from the conversion stage for later use when the writer actually writes them. + */ +public class BridgeUdtValue implements Serializable +{ + public final String name; + public final Map<String, Object> udtMap; + + public BridgeUdtValue(String name, Map<String, Object> valueMap) + { + this.name = name; + this.udtMap = valueMap; + } + + public boolean equals(Object o) Review Comment: NIT, override annotation -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org