This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.apache.spark.sql.sources.v2 | |
import org.apache.spark.annotation.Experimental | |
import org.apache.spark.sql.catalog.v2.expressions.NamedReference | |
/** | |
* A filter that evaluates to `true` iff the field evaluates to a value | |
* equal to `value`. | |
* | |
* @since 3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.apache.spark.sql.sources.v2; | |
import org.apache.spark.annotation.Experimental; | |
import org.apache.spark.sql.catalog.v2.expressions.NamedReference; | |
@Experimental | |
public abstract class Filter { | |
/** | |
* Returns list of columns that are referenced by this filter. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ObjWithMethod { | |
def runClosure(body: () => Boolean): Boolean = { | |
println("In runClosure") | |
val method = Class.forName("ObjWithMethod") | |
.getDeclaredMethod("calledByRefection", classOf[() => Boolean]) | |
method.invoke(null, body).asInstanceOf[Boolean] | |
} | |
def calledByRefection(body: => Boolean): Boolean = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val jsonTxt = | |
""" | |
|{ | |
| "name": "Tom", | |
| "age": 25, | |
| "address": ["Poland", "5th avenue"] | |
|} | |
|""".stripMargin | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
# Pre-commit hook for running checkstyle on changed Java sources | |
# | |
# To use this you need: | |
# 1. checkstyle's jar file somewhere | |
# 2. a checkstyle XML check file somewhere | |
# 3. To configure git: | |
# * git config --add checkstyle.jar <location of jar> | |
# * git config --add checkstyle.checkfile <location of checkfile> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InMapperCombiner < KEY extends WritableComparable, VALUE extends Writable > { | |
private static final int DEFAULT_CAPACITY = 8388608; | |
private static final int DEFAULT_INITIAL_CAPACITY = 65536; | |
private static final float DEFAULT_LOAD_FACTOR = .75F; | |
private final int maxCacheCapacity; | |
private final Map < KEY, VALUE > lruCache; | |
private CombiningFunction < VALUE > combiningFunction; | |
private Mapper.Context context; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserResource(DuJourModelResource): | |
profile_image_thumbnail = fields.OneToOneField('website.api.v1.media_resources.ImageResource', 'profile_image_thumbnail',full=True, null=True) | |
profile_image_standard = fields.OneToOneField('website.api.v1.media_resources.ImageResource', 'profile_image_standard', full=True, null=True) | |
created_time = fields.DateTimeField(attribute='created_time', readonly=True, default=now) | |
updated_time = fields.DateTimeField(attribute='updated_time', readonly=True, default=now) | |
age = fields.IntegerField(attribute='age') | |
class Meta: | |
serializer = TzSerializer() | |
always_return_data = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def obj_update(self, bundle, request=None, skip_errors=False, **kwargs): | |
""" | |
A ORM-specific implementation of ``obj_update``. | |
""" | |
# import pdb | |
# pdb.set_trace() | |
setattr(bundle.obj,self._meta.detail_uri_name,None) | |
if not bundle.obj or not getattr(bundle.obj,self._meta.detail_uri_name): | |
# Attempt to hydrate data from kwargs before doing a lookup for the object. | |
# This step is needed so certain values (like datetime) will pass model validation. |